FIX: Progress bar updates faster

This commit is contained in:
Robin Ward 2013-07-02 12:46:49 -04:00
parent 5770879472
commit 064efa1671
2 changed files with 6 additions and 16 deletions

View File

@ -15,12 +15,12 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
editingTopic: false, editingTopic: false,
jumpTopDisabled: function() { jumpTopDisabled: function() {
return this.get('currentPost') === 1; return (this.get('progressPosition') === 1);
}.property('currentPost'), }.property('postStream.filteredPostsCount', 'progressPosition'),
jumpBottomDisabled: function() { jumpBottomDisabled: function() {
return this.get('currentPost') === this.get('highest_post_number'); return this.get('progressPosition') === this.get('postStream.filteredPostsCount');
}.property('currentPost'), }.property('postStream.filteredPostsCount', 'progressPosition'),
canMergeTopic: function() { canMergeTopic: function() {
if (!this.get('details.can_move_posts')) return false; if (!this.get('details.can_move_posts')) return false;

View File

@ -17,7 +17,6 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
postStream: Em.computed.alias('controller.postStream'), postStream: Em.computed.alias('controller.postStream'),
// Update the progress bar using sweet animations
updateBar: function() { updateBar: function() {
if (!this.get('postStream.loaded')) return; if (!this.get('postStream.loaded')) return;
@ -28,20 +27,11 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
var totalWidth = $topicProgress.width(); var totalWidth = $topicProgress.width();
var progressWidth = ratio * totalWidth; var progressWidth = ratio * totalWidth;
var bg = $topicProgress.find('.bg'); var bg = $topicProgress.find('.bg');
bg.stop(true, true);
var currentWidth = bg.width(); var currentWidth = bg.width();
if (currentWidth === totalWidth) { bg.css("border-right-width", (progressWidth === totalWidth) ? "0px" : "1px")
bg.width(currentWidth - 1); .width(progressWidth);
}
if (progressWidth === totalWidth) {
bg.css("border-right-width", "0px");
} else {
bg.css("border-right-width", "1px");
}
bg.width(progressWidth);
}.observes('controller.progressPosition', 'postStream.filteredPostsCount', 'topic.loaded'), }.observes('controller.progressPosition', 'postStream.filteredPostsCount', 'topic.loaded'),
updateTitle: function() { updateTitle: function() {