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

View file

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

View file

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

View file

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

View file

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

View file

@ -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}}

View file

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

View file

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

View file

@ -14,7 +14,7 @@
<div class="admin-nav pull-left">
<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 class=category.nameKey}}
{{category.name}}

View file

@ -16,13 +16,13 @@
<form class="form-horizontal">
<div>
<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>
<label>
<label>{{i18n 'admin.badges.reason'}}</label>
{{input type="text" value=badgeReason}}<br><small>{{i18n 'admin.badges.reason_help'}}</small>
</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>
{{/if}}

View file

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

View file

@ -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());
}
}
});

View file

@ -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');
}

View file

@ -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');
});
},

View file

@ -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"

View file

@ -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}}

View file

@ -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}}

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"}}
<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>

View file

@ -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>

View file

@ -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>

View file

@ -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

View file

@ -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>

View file

@ -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>