Fixes deprecations on various discovery routes

This commit is contained in:
Robin Ward 2015-05-05 16:45:33 -04:00
parent 0b65c88003
commit 39a1444838
7 changed files with 25 additions and 30 deletions

View File

@ -3,7 +3,7 @@ import DiscoveryController from 'discourse/controllers/discovery';
export default DiscoveryController.extend({
needs: ['modal', 'discovery'],
withLogo: Em.computed.filterBy('categories', 'logo_url'),
withLogo: Em.computed.filterBy('model.categories', 'logo_url'),
showPostsColumn: Em.computed.empty('withLogo'),
actions: {
@ -35,7 +35,7 @@ export default DiscoveryController.extend({
}.property(),
latestTopicOnly: function() {
return this.get('categories').find(function(c) { return c.get('featuredTopics.length') > 1; }) === undefined;
}.property('categories.@each.featuredTopics.length')
return this.get('model.categories').find(function(c) { return c.get('featuredTopics.length') > 1; }) === undefined;
}.property('model.categories.@each.featuredTopics.length')
});

View File

@ -14,6 +14,7 @@ var controllerOpts = {
order: 'default',
ascending: false,
expandGloballyPinned: false,
expandAllPinned: false,
actions: {
@ -86,12 +87,12 @@ var controllerOpts = {
},
showDismissRead: function() {
return this.isFilterPage(this.get('filter'), 'unread') && this.get('topics.length') > 0;
}.property('filter', 'topics.length'),
return this.isFilterPage(this.get('model.filter'), 'unread') && this.get('model.topics.length') > 0;
}.property('model.filter', 'model.topics.length'),
showResetNew: function() {
return this.get('filter') === 'new' && this.get('topics.length') > 0;
}.property('filter', 'topics.length'),
return this.get('model.filter') === 'new' && this.get('model.topics.length') > 0;
}.property('model.filter', 'model.topics.length'),
showDismissAtTop: function() {
return (this.isFilterPage(this.get('model.filter'), 'new') ||
@ -117,7 +118,7 @@ var controllerOpts = {
return I18n.t('topics.bottom.category', {category: category.get('name')});
} else {
var split = (this.get('model.filter') || '').split('/');
if (this.get('topics.length') === 0) {
if (this.get('model.topics.length') === 0) {
return I18n.t("topics.none." + split[0], {
category: split[1]
});
@ -127,19 +128,19 @@ var controllerOpts = {
});
}
}
}.property('allLoaded', 'topics.length'),
}.property('allLoaded', 'model.topics.length'),
footerEducation: function() {
if (!this.get('allLoaded') || this.get('topics.length') > 0 || !Discourse.User.current()) { return; }
if (!this.get('allLoaded') || this.get('model.topics.length') > 0 || !Discourse.User.current()) { return; }
var split = (this.get('filter') || '').split('/');
var split = (this.get('model.filter') || '').split('/');
if (split[0] !== 'new' && split[0] !== 'unread') { return; }
return I18n.t("topics.none.educate." + split[0], {
userPrefsUrl: Discourse.getURL("/users/") + (Discourse.User.currentProp("username_lower")) + "/preferences"
});
}.property('allLoaded', 'topics.length'),
}.property('allLoaded', 'model.topics.length'),
loadMoreTopics() {
return this.get('model').loadMore();

View File

@ -0,0 +1,4 @@
export default Ember.Handlebars.makeBoundHelper(function(value) {
return ("border-color: #" + value).htmlSafe();
});

View File

@ -41,7 +41,7 @@ const TopicList = RestModel.extend({
refreshSort: function(order, ascending) {
const self = this,
params = this.get('params');
params = this.get('params') || {};
params.order = order || params.order;

View File

@ -1,4 +1,4 @@
{{#if categories}}
{{#if model.categories}}
<div class='contents'>
<table class='topic-list categories'>
<thead>
@ -9,9 +9,9 @@
</tr>
</thead>
<tbody>
{{#each c in categories}}
{{#each c in model.categories}}
<tr data-category_id='{{unbound c.id}}' {{bind-attr class="c.description_excerpt:has-description:no-description c.logo_url:has-logo:no-logo"}}>
<td class='category' style="border-color: #{{unbound c.color}}">
<td class='category' style={{border-color c.color}}>
<div>
<div class="pull-left">
{{category-title-link category=c}}

View File

@ -45,7 +45,7 @@
bulkSelectEnabled=bulkSelectEnabled
selected=selected
expandGloballyPinned=expandGloballyPinned
expandAllPinned=model.expandAllPinned
expandAllPinned=expandAllPinned
topics=model.topics}}
{{/if}}
</div>
@ -67,7 +67,7 @@
</div>
<h3>
{{footerMessage}}
{{#if can_create_topic}}<a href {{action "createTopic"}}>{{i18n 'topic.suggest_create_topic'}}</a>{{/if}}
{{#if model.can_create_topic}}<a href {{action "createTopic"}}>{{i18n 'topic.suggest_create_topic'}}</a>{{/if}}
</h3>
{{else}}
{{#if top}}

View File

@ -26892,17 +26892,7 @@ enifed('ember-runtime/controllers/object_controller', ['exports', 'ember-metal/c
@uses Ember.ControllerMixin
@deprecated
**/
exports['default'] = ObjectProxy['default'].extend(ControllerMixin['default'], {
init: function() {
this._super();
Ember['default'].deprecate(objectControllerDeprecation, this.isGenerated, {
url: 'http://emberjs.com/guides/deprecations/#toc_objectcontroller'
});
}
});
exports.objectControllerDeprecation = objectControllerDeprecation;
exports['default'] = ObjectProxy['default'].extend(ControllerMixin['default']);
});
enifed('ember-runtime/copy', ['exports', 'ember-metal/enumerable_utils', 'ember-metal/utils', 'ember-runtime/system/object', 'ember-runtime/mixins/copyable'], function (exports, enumerable_utils, utils, EmberObject, Copyable) {
@ -49407,4 +49397,4 @@ enifed("rsvp/utils",
});
requireModule("ember");
})();
})();