mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FEATURE: Allow keyboard shortcuts for topic list to start from last viewed topic
This commit is contained in:
parent
823a699d41
commit
d8165d7cee
2 changed files with 6 additions and 3 deletions
|
@ -113,11 +113,12 @@ export default Ember.Component.extend(StringBuffer, {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
highlight() {
|
highlight(isLastViewedTopic = false) {
|
||||||
const $topic = this.$();
|
const $topic = this.$();
|
||||||
const originalCol = $topic.css('backgroundColor');
|
const originalCol = $topic.css('backgroundColor');
|
||||||
$topic
|
$topic
|
||||||
.addClass('highlighted')
|
.addClass('highlighted')
|
||||||
|
.attr('data-islastviewedtopic', isLastViewedTopic)
|
||||||
.stop()
|
.stop()
|
||||||
.animate({ backgroundColor: originalCol }, 2500, 'swing', function() {
|
.animate({ backgroundColor: originalCol }, 2500, 'swing', function() {
|
||||||
$topic.removeClass('highlighted');
|
$topic.removeClass('highlighted');
|
||||||
|
@ -128,7 +129,7 @@ export default Ember.Component.extend(StringBuffer, {
|
||||||
// highlight the last topic viewed
|
// highlight the last topic viewed
|
||||||
if (this.session.get('lastTopicIdViewed') === this.get('topic.id')) {
|
if (this.session.get('lastTopicIdViewed') === this.get('topic.id')) {
|
||||||
this.session.set('lastTopicIdViewed', null);
|
this.session.set('lastTopicIdViewed', null);
|
||||||
this.highlight();
|
this.highlight(true);
|
||||||
} else if (this.get('topic.highlight')) {
|
} else if (this.get('topic.highlight')) {
|
||||||
// highlight new topics that have been loaded from the server or the one we just created
|
// highlight new topics that have been loaded from the server or the one we just created
|
||||||
this.set('topic.highlight', false);
|
this.set('topic.highlight', false);
|
||||||
|
|
|
@ -277,7 +277,9 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const $selected = $articles.filter('.selected');
|
const $selected = ($articles.filter('.selected').length !== 0)
|
||||||
|
? $articles.filter('.selected')
|
||||||
|
: $articles.filter('[data-islastviewedtopic=true]');
|
||||||
let index = $articles.index($selected);
|
let index = $articles.index($selected);
|
||||||
|
|
||||||
if ($selected.length !== 0) { //boundries check
|
if ($selected.length !== 0) { //boundries check
|
||||||
|
|
Loading…
Reference in a new issue