Deprecation: Removes more references to view.xyz in templates

This commit is contained in:
Robin Ward 2016-05-09 16:07:36 -04:00
parent 995c01fb58
commit b2bcefd906
No known key found for this signature in database
GPG key ID: 0E091E2B4ED1B83D
7 changed files with 26 additions and 47 deletions

View file

@ -28,16 +28,16 @@ export default Ember.ArrayController.extend({
doneTopicFlags(item) {
this.send("disagreeFlags", item);
},
},
loadMore(){
var flags = this.get("model");
return FlaggedPost.findAll(this.get("query"),flags.length+1).then(function(data){
if(data.length===0){
const flags = this.get('model');
return FlaggedPost.findAll(this.get('query'), flags.length+1).then(data => {
if (data.length===0) {
flags.set("allLoaded",true);
}
flags.addObjects(data);
});
}
}
});

View file

@ -1,5 +1,5 @@
{{#if length}}
<table class='admin-flags'>
{{#if model.length}}
{{#load-more tagName="table" className="admin-flags" selector="tbody tr" action="loadMore"}}
<thead>
<tr>
<th class='user'></th>
@ -9,7 +9,7 @@
</tr>
</thead>
<tbody>
{{#each flaggedPost in content}}
{{#each content as |flaggedPost|}}
<tr class={{flaggedPost.extraClasses}}>
<td class='user'>
@ -145,9 +145,8 @@
{{/each}}
</tbody>
</table>
{{/load-more}}
{{conditional-loading-spinner condition=view.loading}}
{{else}}
<p>{{i18n 'admin.flags.no_results'}}</p>
{{/if}}

View file

@ -1,20 +0,0 @@
import LoadMore from "discourse/mixins/load-more";
export default Ember.View.extend(LoadMore, {
loading: false,
eyelineSelector: '.admin-flags tbody tr',
actions: {
loadMore: function() {
var self = this;
if (this.get("loading") || this.get("model.allLoaded")) { return; }
this.set("loading", true);
this.get("controller").loadMore().then(function () {
self.set("loading", false);
});
}
}
});

View file

@ -2,6 +2,10 @@ import debounce from 'discourse/lib/debounce';
import { searchForTerm } from 'discourse/lib/search';
export default Ember.Component.extend({
loading: null,
noResults: null,
topics: null,
topicTitleChanged: function() {
this.setProperties({
loading: true,
@ -38,14 +42,10 @@ export default Ember.Component.extend({
}, 300),
actions: {
chooseTopic: function (topic) {
chooseTopic(topic) {
const topicId = Em.get(topic, 'id');
this.set('selectedTopicId', topicId);
Em.run.next(function () {
$('#choose-topic-' + topicId).prop('checked', 'true');
});
Ember.run.next(() => $('#choose-topic-' + topicId).prop('checked', 'true'));
return false;
}
}

View file

@ -1,17 +1,17 @@
<label for='choose-topic-title'>{{i18n 'choose_topic.title.search'}}</label>
{{text-field value=view.topicTitle placeholderKey="choose_topic.title.placeholder" id="choose-topic-title"}}
{{text-field value=topicTitle placeholderKey="choose_topic.title.placeholder" id="choose-topic-title"}}
{{#if view.loading}}
{{#if loading}}
<p>{{i18n 'loading'}}</p>
{{else}}
{{#if view.noResults}}
{{#if noResults}}
<p>{{i18n 'choose_topic.none_found'}}</p>
{{else}}
{{#each view.topics as |t|}}
{{#each topics as |t|}}
<div class='controls'>
<label class='radio'>
<input type='radio' id="choose-topic-{{unbound t.id}}" name='choose_topic_id' {{action "chooseTopic" t target="view"}}>{{t.title}}
<input type='radio' id="choose-topic-{{unbound t.id}}" name='choose_topic_id' {{action "chooseTopic" t}}>{{t.title}}
{{#if t.category.parentCategory}}
{{bound-category-link t.category.parentCategory}}
{{/if}}

View file

@ -1,5 +1,5 @@
<label>
{{input type="checkbox" checked=view.checked}}
{{input type="checkbox" checked=checked}}
{{title}}
</label>

View file

@ -11,7 +11,7 @@
</div>
{{#each sources as |s|}}
{{share-source source=s title=view.title action="share"}}
{{share-source source=s title=title action="share"}}
{{/each}}
<div class='link'>