remove dead code
update title properly when count in list changes remove broken (*) title notification from topic cause its just weird
This commit is contained in:
parent
da22c0f359
commit
3ef16f292d
|
@ -42,15 +42,17 @@ Discourse = Ember.Application.createWithMixins({
|
||||||
}
|
}
|
||||||
title += Discourse.SiteSettings.title;
|
title += Discourse.SiteSettings.title;
|
||||||
$('title').text(title);
|
$('title').text(title);
|
||||||
if (!this.get('hasFocus') && this.get('notify')) {
|
|
||||||
title = "(*) " + title;
|
var notifyCount = this.get('notifyCount');
|
||||||
|
if (notifyCount > 0) {
|
||||||
|
title = "(" + notifyCount + ") " + title;
|
||||||
}
|
}
|
||||||
// chrome bug workaround see: http://stackoverflow.com/questions/2952384/changing-the-window-title-when-focussing-the-window-doesnt-work-in-chrome
|
// chrome bug workaround see: http://stackoverflow.com/questions/2952384/changing-the-window-title-when-focussing-the-window-doesnt-work-in-chrome
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function() {
|
||||||
document.title = ".";
|
document.title = ".";
|
||||||
document.title = title;
|
document.title = title;
|
||||||
}, 200);
|
}, 200);
|
||||||
}.observes('title', 'hasFocus', 'notify'),
|
}.observes('title', 'hasFocus', 'notifyCount'),
|
||||||
|
|
||||||
// The classes of buttons to show on a post
|
// The classes of buttons to show on a post
|
||||||
postButtons: function() {
|
postButtons: function() {
|
||||||
|
@ -59,8 +61,8 @@ Discourse = Ember.Application.createWithMixins({
|
||||||
});
|
});
|
||||||
}.property('Discourse.SiteSettings.post_menu'),
|
}.property('Discourse.SiteSettings.post_menu'),
|
||||||
|
|
||||||
notifyTitle: function() {
|
notifyTitle: function(count) {
|
||||||
this.set('notify', true);
|
this.set('notifyCount', count);
|
||||||
},
|
},
|
||||||
|
|
||||||
openComposer: function(opts) {
|
openComposer: function(opts) {
|
||||||
|
|
|
@ -80,16 +80,6 @@ Discourse.ListTopicsController = Discourse.ObjectController.extend({
|
||||||
}
|
}
|
||||||
}.property('allLoaded', 'topics.length'),
|
}.property('allLoaded', 'topics.length'),
|
||||||
|
|
||||||
insertedCount: function() {
|
|
||||||
var insertedLength = this.get('inserted.length');
|
|
||||||
if (!insertedLength) return 0;
|
|
||||||
return insertedLength;
|
|
||||||
}.property('inserted.length'),
|
|
||||||
|
|
||||||
rollUp: function() {
|
|
||||||
return this.get('insertedCount') > Discourse.SiteSettings.new_topics_rollup;
|
|
||||||
}.property('insertedCount'),
|
|
||||||
|
|
||||||
loadMore: function() {
|
loadMore: function() {
|
||||||
this.set('loadingMore', true);
|
this.set('loadingMore', true);
|
||||||
var listTopicsController = this;
|
var listTopicsController = this;
|
||||||
|
|
|
@ -347,7 +347,6 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
|
||||||
topic.set('highest_post_number', data.post_number);
|
topic.set('highest_post_number', data.post_number);
|
||||||
topic.set('last_poster', data.user);
|
topic.set('last_poster', data.user);
|
||||||
topic.set('last_posted_at', data.created_at);
|
topic.set('last_posted_at', data.created_at);
|
||||||
Discourse.notifyTitle();
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@ Discourse.Route = Em.Route.extend({
|
||||||
$('header ul.icons li').removeClass('active');
|
$('header ul.icons li').removeClass('active');
|
||||||
$('[data-toggle="dropdown"]').parent().removeClass('open');
|
$('[data-toggle="dropdown"]').parent().removeClass('open');
|
||||||
|
|
||||||
|
Discourse.set('notifyCount',0);
|
||||||
|
|
||||||
var hideDropDownFunction = $('html').data('hide-dropdown');
|
var hideDropDownFunction = $('html').data('hide-dropdown');
|
||||||
if (hideDropDownFunction) return hideDropDownFunction();
|
if (hideDropDownFunction) return hideDropDownFunction();
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,8 +51,13 @@ Discourse.ListTopicsView = Discourse.View.extend(Discourse.Scrolling, {
|
||||||
}
|
}
|
||||||
}.property('list.topics.@each','topicTrackingState.hasIncoming'),
|
}.property('list.topics.@each','topicTrackingState.hasIncoming'),
|
||||||
|
|
||||||
|
updateTitle: function(){
|
||||||
|
Discourse.notifyTitle(this.get('topicTrackingState.incomingCount'));
|
||||||
|
}.observes('topicTrackingState.incomingCount'),
|
||||||
|
|
||||||
loadMore: function() {
|
loadMore: function() {
|
||||||
var listTopicsView = this;
|
var listTopicsView = this;
|
||||||
|
Discourse.notifyTitle(0);
|
||||||
listTopicsView.get('controller').loadMore().then(function (hasMoreResults) {
|
listTopicsView.get('controller').loadMore().then(function (hasMoreResults) {
|
||||||
Em.run.schedule('afterRender', function() {
|
Em.run.schedule('afterRender', function() {
|
||||||
listTopicsView.saveScrollPos();
|
listTopicsView.saveScrollPos();
|
||||||
|
|
Loading…
Reference in New Issue