Deprecation: Remove controller from templates

This commit is contained in:
Robin Ward
2016-05-09 15:15:39 -04:00
parent c7beecd8e3
commit 995c01fb58
24 changed files with 36 additions and 37 deletions
@@ -4,7 +4,7 @@ export default Ember.Component.extend({
actions: {
showBulkActions() {
const controller = showModal('topic-bulk-actions', { model: this.get('selected'), title: 'topics.bulk.actions' });
controller.set('refreshTarget', this.get('refreshTarget'));
controller.set('refreshClosure', () => this.sendAction());
}
}
});
@@ -77,6 +77,8 @@ export default Ember.Controller.extend({
}
}),
topicModel: Ember.computed.alias('controllers.topic.model'),
_initializeSimilar: function() {
this.set('similarTopics', []);
}.on('init'),
@@ -252,7 +254,7 @@ export default Ember.Controller.extend({
// if we are replying to a topic AND not on the topic pop the window up
if (!force && composer.get('replyingToTopic')) {
const currentTopic = this.get('controllers.topic.model');
const currentTopic = this.get('topicModel');
if (!currentTopic || currentTopic.get('id') !== composer.get('topic.id'))
{
const message = I18n.t("composer.posting_not_on_topic");
@@ -346,7 +348,7 @@ export default Ember.Controller.extend({
});
if (this.get('controllers.application.currentRouteName').split('.')[0] === 'topic' &&
composer.get('topic.id') === this.get('controllers.topic.model.id')) {
composer.get('topic.id') === this.get('topicModel.id')) {
staged = composer.get('stagedPost');
}
@@ -61,8 +61,7 @@ export default Ember.ArrayController.extend(ModalFunctionality, {
this.perform(operation).then(topics => {
if (topics) {
topics.forEach(cb);
const refreshTarget = this.get('refreshTarget');
if (refreshTarget) { refreshTarget.send('refresh'); }
(this.get('refreshClosure') || Ember.k)();
this.send('closeModal');
}
});
@@ -70,8 +69,7 @@ export default Ember.ArrayController.extend(ModalFunctionality, {
performAndRefresh(operation) {
return this.perform(operation).then(() => {
const refreshTarget = this.get('refreshTarget');
if (refreshTarget) { refreshTarget.send('refresh'); }
(this.get('refreshClosure') || Ember.k)();
this.send('closeModal');
});
},
@@ -117,8 +115,7 @@ export default Ember.ArrayController.extend(ModalFunctionality, {
this.perform({type: 'change_category', category_id: categoryId}).then(topics => {
topics.forEach(t => t.set('category', category));
const refreshTarget = this.get('refreshTarget');
if (refreshTarget) { refreshTarget.send('refresh'); }
(this.get('refreshClosure') || Ember.k)();
this.send('closeModal');
});
},
@@ -44,7 +44,7 @@
{{#if model.canEditTitle}}
<div class='form-element clearfix'>
{{#if model.creatingPrivateMessage}}
{{user-selector topicId=controller.controllers.topic.model.id
{{user-selector topicId=topicModel.id
excludeCurrentUser="true"
id="private-message-users"
includeMentionableGroups="true"
@@ -13,7 +13,7 @@
</div>
{{/if}}
{{bulk-select-button selected=selected refreshTarget=controller}}
{{bulk-select-button selected=selected action="refresh"}}
{{#discovery-topics-list model=model refresh="refresh" incomingCount=topicTrackingState.incomingCount}}
{{#if top}}
@@ -9,7 +9,7 @@
{{#if canBulkSelect}}
{{#if model.posts}}
{{d-button icon="list" class="bulk-select" title="topics.bulk.toggle" action="toggleBulkSelect"}}
{{bulk-select-button selected=selected refreshTarget=controller}}
{{bulk-select-button selected=selected action="refresh"}}
{{/if}}
{{/if}}
</div>
@@ -66,7 +66,7 @@
{{/if}}
{{avatar result imageSize="tiny"}}
<a class='search-link' href='{{unbound result.url}}'>
{{topic-status topic=result.topic disableActions=true}}<span class='topic-title'>{{#highlight-text highlight=controller.q}}{{{unbound result.topic.fancyTitle}}}{{/highlight-text}}</span>
{{topic-status topic=result.topic disableActions=true}}<span class='topic-title'>{{#highlight-text highlight=q}}{{{unbound result.topic.fancyTitle}}}{{/highlight-text}}</span>
</a>
<div class='search-category'>
{{category-link result.topic.category}}
@@ -84,7 +84,7 @@
{{/if}}
</span>
{{#if result.blurb}}
{{#highlight-text highlight=controller.q}}
{{#highlight-text highlight=q}}
{{{unbound result.blurb}}}
{{/highlight-text}}
{{/if}}
@@ -1 +1 @@
{{group-post-stream posts=controller emptyText=emptyText loadMore="loadMore"}}
{{group-post-stream posts=model emptyText=emptyText loadMore="loadMore"}}
@@ -32,12 +32,12 @@
{{raw "list/activity-column" topic=t tagName="div" class="num activity last"}}
<a href="{{t.lastPostUrl}}" title='{{i18n 'last_post'}}: {{{raw-date t.bumped_at}}}'>{{t.last_poster_username}}</a>
</div>
{{#unless controller.hideCategory}}
{{#unless hideCategory}}
<div class='category'>
{{category-link t.category}}
</div>
{{/unless}}
{{#if controller.showParticipants}}
{{#if showParticipants}}
<div class='participants'>
{{#each participants as |p|}}
<a href="{{unbound p.user.path}}" class="{{unbound p.extras}}">{{avatar p usernamePath="user.username" imageSize="small"}}</a>
@@ -17,11 +17,11 @@
</div>
<div class='pull-right'>
{{raw "list/post-count-or-badges" topic=topic postBadgesEnabled=controller.showTopicPostBadges}}
{{raw "list/post-count-or-badges" topic=topic postBadgesEnabled=showTopicPostBadges}}
</div>
<div class="topic-item-stats clearfix">
{{#unless controller.hideCategory}}
{{#unless hideCategory}}
<div class='category'>
{{category-link topic.category}}
</div>
@@ -1,7 +1,7 @@
{{#each notificationLevels as |level|}}
<div class='controls'>
<label class='radio'>
{{radio-button value=level.id name="notification_level" selection=controller.notificationLevelId}} <strong>{{unbound level.name}}</strong>
{{radio-button value=level.id name="notification_level" selection=notificationLevelId}} <strong>{{unbound level.name}}</strong>
<div class='description'>{{{unbound level.description}}}</div>
</label>
</div>
@@ -42,7 +42,7 @@
{{#unless loading}}
{{#if list.topics}}
{{#discovery-topics-list model=list refresh="refresh"}}
{{bulk-select-button selected=selected refreshTarget=controller}}
{{bulk-select-button selected=selected action="refresh"}}
{{topic-list topics=list.topics
canBulkSelect=canBulkSelect
@@ -1,4 +1,4 @@
{{#if controller.visible}}
{{#if visible}}
<div class="card-content">
<a href={{user.path}} {{action "showUser"}} class="card-huge-avatar">{{bound-avatar avatar "huge"}}</a>
@@ -1,5 +1,5 @@
<section class='user-content user-badges-list'>
{{#each controller as |ub|}}
{{#each model as |ub|}}
{{badge-card badge=ub.badge count=ub.count navigateOnClick="true" username=user.username_lower}}
{{/each}}
</section>