mirror of
https://github.com/discourse/discourse.git
synced 2025-04-29 09:24:33 +08:00
Deprecation: Removes more references to view.xyz
in templates
This commit is contained in:
parent
995c01fb58
commit
b2bcefd906
@ -28,16 +28,16 @@ export default Ember.ArrayController.extend({
|
|||||||
doneTopicFlags(item) {
|
doneTopicFlags(item) {
|
||||||
this.send("disagreeFlags", item);
|
this.send("disagreeFlags", item);
|
||||||
},
|
},
|
||||||
},
|
|
||||||
|
|
||||||
loadMore(){
|
loadMore(){
|
||||||
var flags = this.get("model");
|
const flags = this.get('model');
|
||||||
return FlaggedPost.findAll(this.get("query"),flags.length+1).then(function(data){
|
return FlaggedPost.findAll(this.get('query'), flags.length+1).then(data => {
|
||||||
if (data.length===0) {
|
if (data.length===0) {
|
||||||
flags.set("allLoaded",true);
|
flags.set("allLoaded",true);
|
||||||
}
|
}
|
||||||
flags.addObjects(data);
|
flags.addObjects(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{#if length}}
|
{{#if model.length}}
|
||||||
<table class='admin-flags'>
|
{{#load-more tagName="table" className="admin-flags" selector="tbody tr" action="loadMore"}}
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class='user'></th>
|
<th class='user'></th>
|
||||||
@ -9,7 +9,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{#each flaggedPost in content}}
|
{{#each content as |flaggedPost|}}
|
||||||
<tr class={{flaggedPost.extraClasses}}>
|
<tr class={{flaggedPost.extraClasses}}>
|
||||||
|
|
||||||
<td class='user'>
|
<td class='user'>
|
||||||
@ -145,9 +145,8 @@
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
{{/load-more}}
|
||||||
|
|
||||||
{{conditional-loading-spinner condition=view.loading}}
|
|
||||||
{{else}}
|
{{else}}
|
||||||
<p>{{i18n 'admin.flags.no_results'}}</p>
|
<p>{{i18n 'admin.flags.no_results'}}</p>
|
||||||
{{/if}}
|
{{/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';
|
import { searchForTerm } from 'discourse/lib/search';
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
|
loading: null,
|
||||||
|
noResults: null,
|
||||||
|
topics: null,
|
||||||
|
|
||||||
topicTitleChanged: function() {
|
topicTitleChanged: function() {
|
||||||
this.setProperties({
|
this.setProperties({
|
||||||
loading: true,
|
loading: true,
|
||||||
@ -38,14 +42,10 @@ export default Ember.Component.extend({
|
|||||||
}, 300),
|
}, 300),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
chooseTopic: function (topic) {
|
chooseTopic(topic) {
|
||||||
const topicId = Em.get(topic, 'id');
|
const topicId = Em.get(topic, 'id');
|
||||||
this.set('selectedTopicId', topicId);
|
this.set('selectedTopicId', topicId);
|
||||||
|
Ember.run.next(() => $('#choose-topic-' + topicId).prop('checked', 'true'));
|
||||||
Em.run.next(function () {
|
|
||||||
$('#choose-topic-' + topicId).prop('checked', 'true');
|
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
<label for='choose-topic-title'>{{i18n 'choose_topic.title.search'}}</label>
|
<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>
|
<p>{{i18n 'loading'}}</p>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if view.noResults}}
|
{{#if noResults}}
|
||||||
<p>{{i18n 'choose_topic.none_found'}}</p>
|
<p>{{i18n 'choose_topic.none_found'}}</p>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#each view.topics as |t|}}
|
{{#each topics as |t|}}
|
||||||
<div class='controls'>
|
<div class='controls'>
|
||||||
<label class='radio'>
|
<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}}
|
{{#if t.category.parentCategory}}
|
||||||
{{bound-category-link t.category.parentCategory}}
|
{{bound-category-link t.category.parentCategory}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<label>
|
<label>
|
||||||
{{input type="checkbox" checked=view.checked}}
|
{{input type="checkbox" checked=checked}}
|
||||||
{{title}}
|
{{title}}
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#each sources as |s|}}
|
{{#each sources as |s|}}
|
||||||
{{share-source source=s title=view.title action="share"}}
|
{{share-source source=s title=title action="share"}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
<div class='link'>
|
<div class='link'>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user