From 995c01fb58acee7b38701fe84ede70a9f7a01941 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 9 May 2016 15:15:39 -0400 Subject: [PATCH] Deprecation: Remove `controller` from templates --- app/assets/javascripts/admin/templates/emojis.hbs | 4 ++-- app/assets/javascripts/admin/templates/groups_type.hbs | 4 ++-- .../javascripts/admin/templates/logs/screened_emails.hbs | 2 +- .../admin/templates/logs/screened_ip_addresses.hbs | 2 +- .../javascripts/admin/templates/logs/screened_urls.hbs | 2 +- .../admin/templates/logs/staff_action_logs.hbs | 2 +- app/assets/javascripts/admin/templates/permalinks.hbs | 2 +- app/assets/javascripts/admin/templates/plugins-index.hbs | 2 +- app/assets/javascripts/admin/templates/site-settings.hbs | 2 +- app/assets/javascripts/admin/templates/user_badges.hbs | 4 ++-- .../javascripts/admin/templates/users-list-show.hbs | 2 +- .../discourse/components/bulk-select-button.js.es6 | 2 +- .../javascripts/discourse/controllers/composer.js.es6 | 6 ++++-- .../discourse/controllers/topic-bulk-actions.js.es6 | 9 +++------ app/assets/javascripts/discourse/templates/composer.hbs | 2 +- .../javascripts/discourse/templates/discovery/topics.hbs | 2 +- .../javascripts/discourse/templates/full-page-search.hbs | 6 +++--- .../javascripts/discourse/templates/group-index.hbs | 2 +- .../templates/mobile/components/basic-topic-list.hbs | 4 ++-- .../templates/mobile/list/topic_list_item.raw.hbs | 4 ++-- .../templates/modal/bulk_notification_level.hbs | 2 +- app/assets/javascripts/discourse/templates/tags/show.hbs | 2 +- app/assets/javascripts/discourse/templates/user-card.hbs | 2 +- .../javascripts/discourse/templates/user/badges.hbs | 2 +- 24 files changed, 36 insertions(+), 37 deletions(-) diff --git a/app/assets/javascripts/admin/templates/emojis.hbs b/app/assets/javascripts/admin/templates/emojis.hbs index 146baba74..ca6fd742d 100644 --- a/app/assets/javascripts/admin/templates/emojis.hbs +++ b/app/assets/javascripts/admin/templates/emojis.hbs @@ -5,7 +5,7 @@

{{emoji-uploader done="emojiUploaded"}}

- {{#if controller}} + {{#if model}}
@@ -16,7 +16,7 @@ - {{#each controller as |e|}} + {{#each model as |e|}} diff --git a/app/assets/javascripts/admin/templates/groups_type.hbs b/app/assets/javascripts/admin/templates/groups_type.hbs index 4486b8780..45bb054ad 100644 --- a/app/assets/javascripts/admin/templates/groups_type.hbs +++ b/app/assets/javascripts/admin/templates/groups_type.hbs @@ -2,7 +2,7 @@

{{i18n 'admin.groups.edit'}}

    - {{#each controller as |group|}} + {{#each model as |group|}}
  • {{#link-to "adminGroup" group.type group.name}}{{group.name}} {{#if group.userCountDisplay}} @@ -13,7 +13,7 @@ {{/each}}
- {{#if controller.isAuto}} + {{#if isAuto}} {{d-button action="refreshAutoGroups" icon="refresh" label="admin.groups.refresh" disabled=refreshingAutoGroups}} {{else}} {{#link-to 'adminGroup' 'new' class="btn"}} diff --git a/app/assets/javascripts/admin/templates/logs/screened_emails.hbs b/app/assets/javascripts/admin/templates/logs/screened_emails.hbs index 8817c49a2..b36d2a568 100644 --- a/app/assets/javascripts/admin/templates/logs/screened_emails.hbs +++ b/app/assets/javascripts/admin/templates/logs/screened_emails.hbs @@ -19,7 +19,7 @@
- {{screened-emails-list content=controller}} + {{screened-emails-list content=model}}
{{else}} diff --git a/app/assets/javascripts/admin/templates/logs/screened_ip_addresses.hbs b/app/assets/javascripts/admin/templates/logs/screened_ip_addresses.hbs index 5fb4217e3..82e4f8888 100644 --- a/app/assets/javascripts/admin/templates/logs/screened_ip_addresses.hbs +++ b/app/assets/javascripts/admin/templates/logs/screened_ip_addresses.hbs @@ -24,7 +24,7 @@
- {{screened-ip-addresses-list content=controller}} + {{screened-ip-addresses-list content=model}} {{else}} diff --git a/app/assets/javascripts/admin/templates/logs/screened_urls.hbs b/app/assets/javascripts/admin/templates/logs/screened_urls.hbs index 493205f27..68071cb32 100644 --- a/app/assets/javascripts/admin/templates/logs/screened_urls.hbs +++ b/app/assets/javascripts/admin/templates/logs/screened_urls.hbs @@ -16,7 +16,7 @@
- {{screened-urls-list content=controller}} + {{screened-urls-list content=model}} {{else}} {{i18n 'search.no_results'}} diff --git a/app/assets/javascripts/admin/templates/logs/staff_action_logs.hbs b/app/assets/javascripts/admin/templates/logs/staff_action_logs.hbs index ef7109c36..4b2654ead 100644 --- a/app/assets/javascripts/admin/templates/logs/staff_action_logs.hbs +++ b/app/assets/javascripts/admin/templates/logs/staff_action_logs.hbs @@ -50,7 +50,7 @@ {{#conditional-loading-spinner condition=loading}} {{#if model.length}} - {{staff-action-logs-list content=controller}} + {{staff-action-logs-list content=model}} {{else}} {{i18n 'search.no_results'}} {{/if}} diff --git a/app/assets/javascripts/admin/templates/permalinks.hbs b/app/assets/javascripts/admin/templates/permalinks.hbs index 1d6151b95..17b33b003 100644 --- a/app/assets/javascripts/admin/templates/permalinks.hbs +++ b/app/assets/javascripts/admin/templates/permalinks.hbs @@ -17,7 +17,7 @@
- {{permalinks-list content=controller}} + {{permalinks-list content=model}} {{else}} {{i18n 'search.no_results'}} diff --git a/app/assets/javascripts/admin/templates/plugins-index.hbs b/app/assets/javascripts/admin/templates/plugins-index.hbs index f90ea2d1c..34bf63c75 100644 --- a/app/assets/javascripts/admin/templates/plugins-index.hbs +++ b/app/assets/javascripts/admin/templates/plugins-index.hbs @@ -21,7 +21,7 @@ - {{#each controller as |plugin|}} + {{#each model as |plugin|}} - {{#if controller.showApproval}} + {{#if showApproval}}
:{{e.name}}:
{{#if plugin.url}} diff --git a/app/assets/javascripts/admin/templates/site-settings.hbs b/app/assets/javascripts/admin/templates/site-settings.hbs index b9a96c90c..5fd954593 100644 --- a/app/assets/javascripts/admin/templates/site-settings.hbs +++ b/app/assets/javascripts/admin/templates/site-settings.hbs @@ -14,7 +14,7 @@
{{#if user.can_approve}} {{input type="checkbox" checked=user.selected}} diff --git a/app/assets/javascripts/discourse/components/bulk-select-button.js.es6 b/app/assets/javascripts/discourse/components/bulk-select-button.js.es6 index 8c50f5e0e..fd5d45946 100644 --- a/app/assets/javascripts/discourse/components/bulk-select-button.js.es6 +++ b/app/assets/javascripts/discourse/components/bulk-select-button.js.es6 @@ -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()); } } }); diff --git a/app/assets/javascripts/discourse/controllers/composer.js.es6 b/app/assets/javascripts/discourse/controllers/composer.js.es6 index b22330abb..20f6490b1 100644 --- a/app/assets/javascripts/discourse/controllers/composer.js.es6 +++ b/app/assets/javascripts/discourse/controllers/composer.js.es6 @@ -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'); } diff --git a/app/assets/javascripts/discourse/controllers/topic-bulk-actions.js.es6 b/app/assets/javascripts/discourse/controllers/topic-bulk-actions.js.es6 index 89a6b0e70..e1c710115 100644 --- a/app/assets/javascripts/discourse/controllers/topic-bulk-actions.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic-bulk-actions.js.es6 @@ -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'); }); }, diff --git a/app/assets/javascripts/discourse/templates/composer.hbs b/app/assets/javascripts/discourse/templates/composer.hbs index f3140a70c..44c91b570 100644 --- a/app/assets/javascripts/discourse/templates/composer.hbs +++ b/app/assets/javascripts/discourse/templates/composer.hbs @@ -44,7 +44,7 @@ {{#if model.canEditTitle}}
{{#if model.creatingPrivateMessage}} - {{user-selector topicId=controller.controllers.topic.model.id + {{user-selector topicId=topicModel.id excludeCurrentUser="true" id="private-message-users" includeMentionableGroups="true" diff --git a/app/assets/javascripts/discourse/templates/discovery/topics.hbs b/app/assets/javascripts/discourse/templates/discovery/topics.hbs index 8bb13926f..b467b0f92 100644 --- a/app/assets/javascripts/discourse/templates/discovery/topics.hbs +++ b/app/assets/javascripts/discourse/templates/discovery/topics.hbs @@ -13,7 +13,7 @@
{{/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}} diff --git a/app/assets/javascripts/discourse/templates/full-page-search.hbs b/app/assets/javascripts/discourse/templates/full-page-search.hbs index 7c39f11aa..e8a74f294 100644 --- a/app/assets/javascripts/discourse/templates/full-page-search.hbs +++ b/app/assets/javascripts/discourse/templates/full-page-search.hbs @@ -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}} @@ -66,7 +66,7 @@ {{/if}} {{avatar result imageSize="tiny"}} - {{topic-status topic=result.topic disableActions=true}}{{#highlight-text highlight=controller.q}}{{{unbound result.topic.fancyTitle}}}{{/highlight-text}} + {{topic-status topic=result.topic disableActions=true}}{{#highlight-text highlight=q}}{{{unbound result.topic.fancyTitle}}}{{/highlight-text}}
{{category-link result.topic.category}} @@ -84,7 +84,7 @@ {{/if}} {{#if result.blurb}} - {{#highlight-text highlight=controller.q}} + {{#highlight-text highlight=q}} {{{unbound result.blurb}}} {{/highlight-text}} {{/if}} diff --git a/app/assets/javascripts/discourse/templates/group-index.hbs b/app/assets/javascripts/discourse/templates/group-index.hbs index 1641286ad..f38104880 100644 --- a/app/assets/javascripts/discourse/templates/group-index.hbs +++ b/app/assets/javascripts/discourse/templates/group-index.hbs @@ -1 +1 @@ -{{group-post-stream posts=controller emptyText=emptyText loadMore="loadMore"}} +{{group-post-stream posts=model emptyText=emptyText loadMore="loadMore"}} diff --git a/app/assets/javascripts/discourse/templates/mobile/components/basic-topic-list.hbs b/app/assets/javascripts/discourse/templates/mobile/components/basic-topic-list.hbs index be2b59358..8abe6bc1f 100644 --- a/app/assets/javascripts/discourse/templates/mobile/components/basic-topic-list.hbs +++ b/app/assets/javascripts/discourse/templates/mobile/components/basic-topic-list.hbs @@ -32,12 +32,12 @@ {{raw "list/activity-column" topic=t tagName="div" class="num activity last"}} {{t.last_poster_username}}
- {{#unless controller.hideCategory}} + {{#unless hideCategory}}
{{category-link t.category}}
{{/unless}} - {{#if controller.showParticipants}} + {{#if showParticipants}}
{{#each participants as |p|}} {{avatar p usernamePath="user.username" imageSize="small"}} diff --git a/app/assets/javascripts/discourse/templates/mobile/list/topic_list_item.raw.hbs b/app/assets/javascripts/discourse/templates/mobile/list/topic_list_item.raw.hbs index e890fdacf..1047de967 100644 --- a/app/assets/javascripts/discourse/templates/mobile/list/topic_list_item.raw.hbs +++ b/app/assets/javascripts/discourse/templates/mobile/list/topic_list_item.raw.hbs @@ -17,11 +17,11 @@
- {{raw "list/post-count-or-badges" topic=topic postBadgesEnabled=controller.showTopicPostBadges}} + {{raw "list/post-count-or-badges" topic=topic postBadgesEnabled=showTopicPostBadges}}
- {{#unless controller.hideCategory}} + {{#unless hideCategory}}
{{category-link topic.category}}
diff --git a/app/assets/javascripts/discourse/templates/modal/bulk_notification_level.hbs b/app/assets/javascripts/discourse/templates/modal/bulk_notification_level.hbs index a52aaffb7..34484ac61 100644 --- a/app/assets/javascripts/discourse/templates/modal/bulk_notification_level.hbs +++ b/app/assets/javascripts/discourse/templates/modal/bulk_notification_level.hbs @@ -1,7 +1,7 @@ {{#each notificationLevels as |level|}}
diff --git a/app/assets/javascripts/discourse/templates/tags/show.hbs b/app/assets/javascripts/discourse/templates/tags/show.hbs index 0421c8d03..dcecef2c9 100644 --- a/app/assets/javascripts/discourse/templates/tags/show.hbs +++ b/app/assets/javascripts/discourse/templates/tags/show.hbs @@ -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 diff --git a/app/assets/javascripts/discourse/templates/user-card.hbs b/app/assets/javascripts/discourse/templates/user-card.hbs index 9c765d856..f2ae2adb0 100644 --- a/app/assets/javascripts/discourse/templates/user-card.hbs +++ b/app/assets/javascripts/discourse/templates/user-card.hbs @@ -1,4 +1,4 @@ -{{#if controller.visible}} +{{#if visible}}
{{bound-avatar avatar "huge"}} diff --git a/app/assets/javascripts/discourse/templates/user/badges.hbs b/app/assets/javascripts/discourse/templates/user/badges.hbs index 042b08fbf..835a7fea3 100644 --- a/app/assets/javascripts/discourse/templates/user/badges.hbs +++ b/app/assets/javascripts/discourse/templates/user/badges.hbs @@ -1,5 +1,5 @@
- {{#each controller as |ub|}} + {{#each model as |ub|}} {{badge-card badge=ub.badge count=ub.count navigateOnClick="true" username=user.username_lower}} {{/each}}