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

View file

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

View file

@ -1,4 +1,4 @@
{{#if categories}} {{#if model.categories}}
<div class='contents'> <div class='contents'>
<table class='topic-list categories'> <table class='topic-list categories'>
<thead> <thead>
@ -9,9 +9,9 @@
</tr> </tr>
</thead> </thead>
<tbody> <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"}}> <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>
<div class="pull-left"> <div class="pull-left">
{{category-title-link category=c}} {{category-title-link category=c}}

View file

@ -45,7 +45,7 @@
bulkSelectEnabled=bulkSelectEnabled bulkSelectEnabled=bulkSelectEnabled
selected=selected selected=selected
expandGloballyPinned=expandGloballyPinned expandGloballyPinned=expandGloballyPinned
expandAllPinned=model.expandAllPinned expandAllPinned=expandAllPinned
topics=model.topics}} topics=model.topics}}
{{/if}} {{/if}}
</div> </div>
@ -67,7 +67,7 @@
</div> </div>
<h3> <h3>
{{footerMessage}} {{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> </h3>
{{else}} {{else}}
{{#if top}} {{#if top}}

View file

@ -26892,17 +26892,7 @@ enifed('ember-runtime/controllers/object_controller', ['exports', 'ember-metal/c
@uses Ember.ControllerMixin @uses Ember.ControllerMixin
@deprecated @deprecated
**/ **/
exports['default'] = ObjectProxy['default'].extend(ControllerMixin['default'], { 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;
}); });
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) { 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) {