mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: Posts weren't highlighting when jumping using the progress widget
This commit is contained in:
parent
930fc4a109
commit
78d5d22776
2 changed files with 18 additions and 18 deletions
|
@ -203,7 +203,6 @@ Discourse.URL = Em.Object.createWithMixins({
|
|||
|
||||
var container = Discourse.__container__,
|
||||
topicController = container.lookup('controller:topic'),
|
||||
topicProgressController = container.lookup('controller:topic-progress'),
|
||||
opts = {},
|
||||
postStream = topicController.get('postStream');
|
||||
|
||||
|
@ -218,8 +217,10 @@ Discourse.URL = Em.Object.createWithMixins({
|
|||
enteredAt: new Date().getTime().toString()
|
||||
});
|
||||
var closestPost = postStream.closestPostForPostNumber(closest),
|
||||
progress = postStream.progressIndexOfPost(closestPost);
|
||||
topicProgressController.set('progressPosition', progress);
|
||||
progress = postStream.progressIndexOfPost(closestPost),
|
||||
progressController = container.lookup('controller:topic-progress');
|
||||
|
||||
progressController.set('progressPosition', progress);
|
||||
Discourse.PostView.considerHighlighting(topicController, closest);
|
||||
}).then(function() {
|
||||
Discourse.URL.jumpToPost(closest);
|
||||
|
|
|
@ -307,28 +307,27 @@ Discourse.PostView = Discourse.GroupedView.extend(Ember.Evented, {
|
|||
}.observes('controller.searchHighlight', 'cooked')
|
||||
});
|
||||
|
||||
function highlight(postNumber) {
|
||||
var $contents = $('#post_' + postNumber +' .topic-body'),
|
||||
origColor = $contents.data('orig-color') || $contents.css('backgroundColor');
|
||||
|
||||
$contents.data("orig-color", origColor)
|
||||
.addClass('highlighted')
|
||||
.stop()
|
||||
.animate({ backgroundColor: origColor }, 2500, 'swing', function(){
|
||||
$contents.removeClass('highlighted');
|
||||
$contents.css({'background-color': ''});
|
||||
});
|
||||
}
|
||||
|
||||
Discourse.PostView.reopenClass({
|
||||
highlight: function(postNumber){
|
||||
var $contents = $('#post_' + postNumber +' .topic-body'),
|
||||
origColor = $contents.data('orig-color') || $contents.css('backgroundColor');
|
||||
|
||||
$contents.data("orig-color", origColor);
|
||||
$contents
|
||||
.addClass('highlighted')
|
||||
.stop()
|
||||
.animate({ backgroundColor: origColor }, 2500, 'swing', function(){
|
||||
$contents.removeClass('highlighted');
|
||||
$contents.css({'background-color': ''});
|
||||
});
|
||||
},
|
||||
|
||||
considerHighlighting: function(controller, postNumber) {
|
||||
var highlightNumber = controller.get('highlightOnInsert');
|
||||
|
||||
// If we're meant to highlight a post
|
||||
if (highlightNumber === postNumber) {
|
||||
controller.set('highlightOnInsert', null);
|
||||
this.highlight(postNumber);
|
||||
Ember.run.scheduleOnce('afterRender', null, highlight, postNumber);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue