Deprecation: Remove controller from templates

This commit is contained in:
Robin Ward 2016-05-09 15:15:39 -04:00
parent c7beecd8e3
commit 995c01fb58
No known key found for this signature in database
GPG key ID: 0E091E2B4ED1B83D
24 changed files with 36 additions and 37 deletions

View file

@ -5,7 +5,7 @@
<p>{{emoji-uploader done="emojiUploaded"}}</p> <p>{{emoji-uploader done="emojiUploaded"}}</p>
{{#if controller}} {{#if model}}
<div class="span8"> <div class="span8">
<table id="custom_emoji"> <table id="custom_emoji">
<thead> <thead>
@ -16,7 +16,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{#each controller as |e|}} {{#each model as |e|}}
<tr> <tr>
<th><img class="emoji" src="{{unbound e.url}}" title="{{unbound e.name}}"></th> <th><img class="emoji" src="{{unbound e.url}}" title="{{unbound e.name}}"></th>
<th>:{{e.name}}:</th> <th>:{{e.name}}:</th>

View file

@ -2,7 +2,7 @@
<div class='content-list span6'> <div class='content-list span6'>
<h3>{{i18n 'admin.groups.edit'}}</h3> <h3>{{i18n 'admin.groups.edit'}}</h3>
<ul> <ul>
{{#each controller as |group|}} {{#each model as |group|}}
<li> <li>
{{#link-to "adminGroup" group.type group.name}}{{group.name}} {{#link-to "adminGroup" group.type group.name}}{{group.name}}
{{#if group.userCountDisplay}} {{#if group.userCountDisplay}}
@ -13,7 +13,7 @@
{{/each}} {{/each}}
</ul> </ul>
<div class='controls'> <div class='controls'>
{{#if controller.isAuto}} {{#if isAuto}}
{{d-button action="refreshAutoGroups" icon="refresh" label="admin.groups.refresh" disabled=refreshingAutoGroups}} {{d-button action="refreshAutoGroups" icon="refresh" label="admin.groups.refresh" disabled=refreshingAutoGroups}}
{{else}} {{else}}
{{#link-to 'adminGroup' 'new' class="btn"}} {{#link-to 'adminGroup' 'new' class="btn"}}

View file

@ -19,7 +19,7 @@
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
{{screened-emails-list content=controller}} {{screened-emails-list content=model}}
</div> </div>
{{else}} {{else}}

View file

@ -24,7 +24,7 @@
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
{{screened-ip-addresses-list content=controller}} {{screened-ip-addresses-list content=model}}
</div> </div>
{{else}} {{else}}

View file

@ -16,7 +16,7 @@
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
{{screened-urls-list content=controller}} {{screened-urls-list content=model}}
</div> </div>
{{else}} {{else}}
{{i18n 'search.no_results'}} {{i18n 'search.no_results'}}

View file

@ -50,7 +50,7 @@
{{#conditional-loading-spinner condition=loading}} {{#conditional-loading-spinner condition=loading}}
{{#if model.length}} {{#if model.length}}
{{staff-action-logs-list content=controller}} {{staff-action-logs-list content=model}}
{{else}} {{else}}
{{i18n 'search.no_results'}} {{i18n 'search.no_results'}}
{{/if}} {{/if}}

View file

@ -17,7 +17,7 @@
<div class="col heading actions"></div> <div class="col heading actions"></div>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
{{permalinks-list content=controller}} {{permalinks-list content=model}}
</div> </div>
{{else}} {{else}}
{{i18n 'search.no_results'}} {{i18n 'search.no_results'}}

View file

@ -21,7 +21,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{#each controller as |plugin|}} {{#each model as |plugin|}}
<tr> <tr>
<td> <td>
{{#if plugin.url}} {{#if plugin.url}}

View file

@ -14,7 +14,7 @@
<div class="admin-nav pull-left"> <div class="admin-nav pull-left">
<ul class="nav nav-stacked"> <ul class="nav nav-stacked">
{{#each controller as |category|}} {{#each model as |category|}}
{{#link-to 'adminSiteSettingsCategory' category.nameKey tagName='li' class=category.nameKey}} {{#link-to 'adminSiteSettingsCategory' category.nameKey tagName='li' class=category.nameKey}}
{{#link-to 'adminSiteSettingsCategory' category.nameKey class=category.nameKey}} {{#link-to 'adminSiteSettingsCategory' category.nameKey class=category.nameKey}}
{{category.name}} {{category.name}}

View file

@ -16,13 +16,13 @@
<form class="form-horizontal"> <form class="form-horizontal">
<div> <div>
<label>{{i18n 'admin.badges.badge'}}</label> <label>{{i18n 'admin.badges.badge'}}</label>
{{combo-box valueAttribute="id" value=controller.selectedBadgeId content=controller.grantableBadges nameProperty="name"}} {{combo-box valueAttribute="id" value=selectedBadgeId content=grantableBadges nameProperty="name"}}
</div> </div>
<label> <label>
<label>{{i18n 'admin.badges.reason'}}</label> <label>{{i18n 'admin.badges.reason'}}</label>
{{input type="text" value=badgeReason}}<br><small>{{i18n 'admin.badges.reason_help'}}</small> {{input type="text" value=badgeReason}}<br><small>{{i18n 'admin.badges.reason_help'}}</small>
</label> </label>
<button class='btn btn-primary' {{action "grantBadge" controller.selectedBadgeId}}>{{i18n 'admin.badges.grant'}}</button> <button class='btn btn-primary' {{action "grantBadge" selectedBadgeId}}>{{i18n 'admin.badges.grant'}}</button>
</form> </form>
{{/if}} {{/if}}

View file

@ -43,7 +43,7 @@
{{#each model as |user|}} {{#each model as |user|}}
<tr class="{{user.selected}} {{unless user.active 'not-activated'}}"> <tr class="{{user.selected}} {{unless user.active 'not-activated'}}">
{{#if controller.showApproval}} {{#if showApproval}}
<td> <td>
{{#if user.can_approve}} {{#if user.can_approve}}
{{input type="checkbox" checked=user.selected}} {{input type="checkbox" checked=user.selected}}

View file

@ -4,7 +4,7 @@ export default Ember.Component.extend({
actions: { actions: {
showBulkActions() { showBulkActions() {
const controller = showModal('topic-bulk-actions', { model: this.get('selected'), title: 'topics.bulk.actions' }); 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());
} }
} }
}); });

View file

@ -77,6 +77,8 @@ export default Ember.Controller.extend({
} }
}), }),
topicModel: Ember.computed.alias('controllers.topic.model'),
_initializeSimilar: function() { _initializeSimilar: function() {
this.set('similarTopics', []); this.set('similarTopics', []);
}.on('init'), }.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 we are replying to a topic AND not on the topic pop the window up
if (!force && composer.get('replyingToTopic')) { 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')) if (!currentTopic || currentTopic.get('id') !== composer.get('topic.id'))
{ {
const message = I18n.t("composer.posting_not_on_topic"); 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' && 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'); staged = composer.get('stagedPost');
} }

View file

@ -61,8 +61,7 @@ export default Ember.ArrayController.extend(ModalFunctionality, {
this.perform(operation).then(topics => { this.perform(operation).then(topics => {
if (topics) { if (topics) {
topics.forEach(cb); topics.forEach(cb);
const refreshTarget = this.get('refreshTarget'); (this.get('refreshClosure') || Ember.k)();
if (refreshTarget) { refreshTarget.send('refresh'); }
this.send('closeModal'); this.send('closeModal');
} }
}); });
@ -70,8 +69,7 @@ export default Ember.ArrayController.extend(ModalFunctionality, {
performAndRefresh(operation) { performAndRefresh(operation) {
return this.perform(operation).then(() => { return this.perform(operation).then(() => {
const refreshTarget = this.get('refreshTarget'); (this.get('refreshClosure') || Ember.k)();
if (refreshTarget) { refreshTarget.send('refresh'); }
this.send('closeModal'); this.send('closeModal');
}); });
}, },
@ -117,8 +115,7 @@ export default Ember.ArrayController.extend(ModalFunctionality, {
this.perform({type: 'change_category', category_id: categoryId}).then(topics => { this.perform({type: 'change_category', category_id: categoryId}).then(topics => {
topics.forEach(t => t.set('category', category)); topics.forEach(t => t.set('category', category));
const refreshTarget = this.get('refreshTarget'); (this.get('refreshClosure') || Ember.k)();
if (refreshTarget) { refreshTarget.send('refresh'); }
this.send('closeModal'); this.send('closeModal');
}); });
}, },

View file

@ -44,7 +44,7 @@
{{#if model.canEditTitle}} {{#if model.canEditTitle}}
<div class='form-element clearfix'> <div class='form-element clearfix'>
{{#if model.creatingPrivateMessage}} {{#if model.creatingPrivateMessage}}
{{user-selector topicId=controller.controllers.topic.model.id {{user-selector topicId=topicModel.id
excludeCurrentUser="true" excludeCurrentUser="true"
id="private-message-users" id="private-message-users"
includeMentionableGroups="true" includeMentionableGroups="true"

View file

@ -13,7 +13,7 @@
</div> </div>
{{/if}} {{/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}} {{#discovery-topics-list model=model refresh="refresh" incomingCount=topicTrackingState.incomingCount}}
{{#if top}} {{#if top}}

View file

@ -9,7 +9,7 @@
{{#if canBulkSelect}} {{#if canBulkSelect}}
{{#if model.posts}} {{#if model.posts}}
{{d-button icon="list" class="bulk-select" title="topics.bulk.toggle" action="toggleBulkSelect"}} {{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}}
{{/if}} {{/if}}
</div> </div>
@ -66,7 +66,7 @@
{{/if}} {{/if}}
{{avatar result imageSize="tiny"}} {{avatar result imageSize="tiny"}}
<a class='search-link' href='{{unbound result.url}}'> <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> </a>
<div class='search-category'> <div class='search-category'>
{{category-link result.topic.category}} {{category-link result.topic.category}}
@ -84,7 +84,7 @@
{{/if}} {{/if}}
</span> </span>
{{#if result.blurb}} {{#if result.blurb}}
{{#highlight-text highlight=controller.q}} {{#highlight-text highlight=q}}
{{{unbound result.blurb}}} {{{unbound result.blurb}}}
{{/highlight-text}} {{/highlight-text}}
{{/if}} {{/if}}

View file

@ -1 +1 @@
{{group-post-stream posts=controller emptyText=emptyText loadMore="loadMore"}} {{group-post-stream posts=model emptyText=emptyText loadMore="loadMore"}}

View file

@ -32,12 +32,12 @@
{{raw "list/activity-column" topic=t tagName="div" class="num activity last"}} {{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> <a href="{{t.lastPostUrl}}" title='{{i18n 'last_post'}}: {{{raw-date t.bumped_at}}}'>{{t.last_poster_username}}</a>
</div> </div>
{{#unless controller.hideCategory}} {{#unless hideCategory}}
<div class='category'> <div class='category'>
{{category-link t.category}} {{category-link t.category}}
</div> </div>
{{/unless}} {{/unless}}
{{#if controller.showParticipants}} {{#if showParticipants}}
<div class='participants'> <div class='participants'>
{{#each participants as |p|}} {{#each participants as |p|}}
<a href="{{unbound p.user.path}}" class="{{unbound p.extras}}">{{avatar p usernamePath="user.username" imageSize="small"}}</a> <a href="{{unbound p.user.path}}" class="{{unbound p.extras}}">{{avatar p usernamePath="user.username" imageSize="small"}}</a>

View file

@ -17,11 +17,11 @@
</div> </div>
<div class='pull-right'> <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>
<div class="topic-item-stats clearfix"> <div class="topic-item-stats clearfix">
{{#unless controller.hideCategory}} {{#unless hideCategory}}
<div class='category'> <div class='category'>
{{category-link topic.category}} {{category-link topic.category}}
</div> </div>

View file

@ -1,7 +1,7 @@
{{#each notificationLevels as |level|}} {{#each notificationLevels as |level|}}
<div class='controls'> <div class='controls'>
<label class='radio'> <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> <div class='description'>{{{unbound level.description}}}</div>
</label> </label>
</div> </div>

View file

@ -42,7 +42,7 @@
{{#unless loading}} {{#unless loading}}
{{#if list.topics}} {{#if list.topics}}
{{#discovery-topics-list model=list refresh="refresh"}} {{#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 {{topic-list topics=list.topics
canBulkSelect=canBulkSelect canBulkSelect=canBulkSelect

View file

@ -1,4 +1,4 @@
{{#if controller.visible}} {{#if visible}}
<div class="card-content"> <div class="card-content">
<a href={{user.path}} {{action "showUser"}} class="card-huge-avatar">{{bound-avatar avatar "huge"}}</a> <a href={{user.path}} {{action "showUser"}} class="card-huge-avatar">{{bound-avatar avatar "huge"}}</a>

View file

@ -1,5 +1,5 @@
<section class='user-content user-badges-list'> <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}} {{badge-card badge=ub.badge count=ub.count navigateOnClick="true" username=user.username_lower}}
{{/each}} {{/each}}
</section> </section>