diff --git a/app/assets/javascripts/admin/controllers/admin-flags-list.js.es6 b/app/assets/javascripts/admin/controllers/admin-flags-list.js.es6 index 94de6841c..0c8574977 100644 --- a/app/assets/javascripts/admin/controllers/admin-flags-list.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-flags-list.js.es6 @@ -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){ - flags.set("allLoaded",true); - } - flags.addObjects(data); - }); + loadMore(){ + 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); + }); + } } }); diff --git a/app/assets/javascripts/admin/templates/flags-list.hbs b/app/assets/javascripts/admin/templates/flags-list.hbs index 5503f4254..d6211e700 100644 --- a/app/assets/javascripts/admin/templates/flags-list.hbs +++ b/app/assets/javascripts/admin/templates/flags-list.hbs @@ -1,5 +1,5 @@ -{{#if length}} - +{{#if model.length}} + {{#load-more tagName="table" className="admin-flags" selector="tbody tr" action="loadMore"}} @@ -9,7 +9,7 @@ - {{#each flaggedPost in content}} + {{#each content as |flaggedPost|}} -
@@ -145,9 +145,8 @@ {{/each}}
+ {{/load-more}} - {{conditional-loading-spinner condition=view.loading}} {{else}}

{{i18n 'admin.flags.no_results'}}

{{/if}} diff --git a/app/assets/javascripts/admin/views/admin-flags-list.js.es6 b/app/assets/javascripts/admin/views/admin-flags-list.js.es6 deleted file mode 100644 index bcf3867a2..000000000 --- a/app/assets/javascripts/admin/views/admin-flags-list.js.es6 +++ /dev/null @@ -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); - }); - } - } - -}); diff --git a/app/assets/javascripts/discourse/components/choose-topic.js.es6 b/app/assets/javascripts/discourse/components/choose-topic.js.es6 index 85b46c5ab..a42a8559a 100644 --- a/app/assets/javascripts/discourse/components/choose-topic.js.es6 +++ b/app/assets/javascripts/discourse/components/choose-topic.js.es6 @@ -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; } } diff --git a/app/assets/javascripts/discourse/templates/components/choose-topic.hbs b/app/assets/javascripts/discourse/templates/components/choose-topic.hbs index 03af7f616..52c772fcd 100644 --- a/app/assets/javascripts/discourse/templates/components/choose-topic.hbs +++ b/app/assets/javascripts/discourse/templates/components/choose-topic.hbs @@ -1,17 +1,17 @@ -{{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}}

{{i18n 'loading'}}

{{else}} - {{#if view.noResults}} + {{#if noResults}}

{{i18n 'choose_topic.none_found'}}

{{else}} - {{#each view.topics as |t|}} + {{#each topics as |t|}}
{{#each sources as |s|}} - {{share-source source=s title=view.title action="share"}} + {{share-source source=s title=title action="share"}} {{/each}}