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());
|
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() {
|
toggleVisibility: function() {
|
||||||
this.get('content').toggleStatus('visible');
|
this.get('content').toggleStatus('visible');
|
||||||
},
|
},
|
||||||
|
|
|
@ -46,14 +46,14 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
{{#if view.topic.canConvertToRegular}}
|
{{#if canConvertToRegular}}
|
||||||
<li>
|
<li>
|
||||||
<button {{action convertToRegular}} class='btn btn-admin'><i class='icon-minus'></i> {{i18n topic.actions.convert_to_topic}}</button>
|
<button {{action convertToRegular}} class='btn btn-admin'><i class='icon-minus'></i> {{i18n topic.actions.convert_to_topic}}</button>
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<li>
|
<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>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -142,17 +142,6 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
||||||
this.debounceLoadSuggested();
|
this.debounceLoadSuggested();
|
||||||
}.observes('topicTrackingState.incomingCount'),
|
}.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(){
|
gotFocus: function(){
|
||||||
if (Discourse.get('hasFocus')){
|
if (Discourse.get('hasFocus')){
|
||||||
this.scrolled();
|
this.scrolled();
|
||||||
|
|
Loading…
Reference in New Issue