mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
Deprecation: Removes more references to view.xyz
in templates
This commit is contained in:
parent
995c01fb58
commit
b2bcefd906
7 changed files with 26 additions and 47 deletions
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -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}}
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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}}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<label>
|
||||
{{input type="checkbox" checked=view.checked}}
|
||||
{{input type="checkbox" checked=checked}}
|
||||
{{title}}
|
||||
</label>
|
||||
|
||||
|
|
|
@ -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'>
|
||||
|
|
Loading…
Reference in a new issue