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:
Sam 2013-06-03 10:38:57 +10:00
parent da22c0f359
commit 3ef16f292d
5 changed files with 14 additions and 16 deletions

View File

@ -42,15 +42,17 @@ Discourse = Ember.Application.createWithMixins({
}
title += Discourse.SiteSettings.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
window.setTimeout(function() {
document.title = ".";
document.title = title;
}, 200);
}.observes('title', 'hasFocus', 'notify'),
}.observes('title', 'hasFocus', 'notifyCount'),
// The classes of buttons to show on a post
postButtons: function() {
@ -59,8 +61,8 @@ Discourse = Ember.Application.createWithMixins({
});
}.property('Discourse.SiteSettings.post_menu'),
notifyTitle: function() {
this.set('notify', true);
notifyTitle: function(count) {
this.set('notifyCount', count);
},
openComposer: function(opts) {

View File

@ -80,16 +80,6 @@ Discourse.ListTopicsController = Discourse.ObjectController.extend({
}
}.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() {
this.set('loadingMore', true);
var listTopicsController = this;

View File

@ -347,7 +347,6 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
topic.set('highest_post_number', data.post_number);
topic.set('last_poster', data.user);
topic.set('last_posted_at', data.created_at);
Discourse.notifyTitle();
});
},

View File

@ -24,6 +24,8 @@ Discourse.Route = Em.Route.extend({
$('header ul.icons li').removeClass('active');
$('[data-toggle="dropdown"]').parent().removeClass('open');
Discourse.set('notifyCount',0);
var hideDropDownFunction = $('html').data('hide-dropdown');
if (hideDropDownFunction) return hideDropDownFunction();
}

View File

@ -51,8 +51,13 @@ Discourse.ListTopicsView = Discourse.View.extend(Discourse.Scrolling, {
}
}.property('list.topics.@each','topicTrackingState.hasIncoming'),
updateTitle: function(){
Discourse.notifyTitle(this.get('topicTrackingState.incomingCount'));
}.observes('topicTrackingState.incomingCount'),
loadMore: function() {
var listTopicsView = this;
Discourse.notifyTitle(0);
listTopicsView.get('controller').loadMore().then(function (hasMoreResults) {
Em.run.schedule('afterRender', function() {
listTopicsView.saveScrollPos();