Remove reliance on views for logic, move to controller
This commit is contained in:
parent
19c169540c
commit
bb5a9aa34b
|
@ -254,6 +254,17 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
|
|||
this.get('content').destroy(Discourse.User.current());
|
||||
},
|
||||
|
||||
resetRead: function() {
|
||||
Discourse.ScreenTrack.instance().reset();
|
||||
this.unsubscribe();
|
||||
|
||||
var topicController = this;
|
||||
this.get('model').resetRead().then(function() {
|
||||
topicController.set('message', I18n.t("topic.read_position_reset"));
|
||||
topicController.set('postStream.loaded', false);
|
||||
});
|
||||
},
|
||||
|
||||
toggleVisibility: function() {
|
||||
this.get('content').toggleStatus('visible');
|
||||
},
|
||||
|
|
|
@ -46,14 +46,14 @@
|
|||
{{/if}}
|
||||
</li>
|
||||
|
||||
{{#if view.topic.canConvertToRegular}}
|
||||
{{#if canConvertToRegular}}
|
||||
<li>
|
||||
<button {{action convertToRegular}} class='btn btn-admin'><i class='icon-minus'></i> {{i18n topic.actions.convert_to_topic}}</button>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
<li>
|
||||
<button class='btn btn-admin' {{action resetRead target="view.parentView"}}><i class='icon-remove'></i> {{i18n topic.actions.reset_read}}</button>
|
||||
<button class='btn btn-admin' {{action resetRead}}><i class='icon-remove'></i> {{i18n topic.actions.reset_read}}</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -142,17 +142,6 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
|||
this.debounceLoadSuggested();
|
||||
}.observes('topicTrackingState.incomingCount'),
|
||||
|
||||
resetRead: function(e) {
|
||||
Discourse.ScreenTrack.instance().reset();
|
||||
this.get('controller').unsubscribe();
|
||||
|
||||
var topicView = this;
|
||||
this.get('topic').resetRead().then(function() {
|
||||
topicView.set('controller.message', I18n.t("topic.read_position_reset"));
|
||||
topicView.set('controller.loaded', false);
|
||||
});
|
||||
},
|
||||
|
||||
gotFocus: function(){
|
||||
if (Discourse.get('hasFocus')){
|
||||
this.scrolled();
|
||||
|
|
Loading…
Reference in New Issue