Merge remote-tracking branch 'upstream/master' into update-mac-doc

This commit is contained in:
Adam Loving 2014-05-28 23:30:50 -07:00
commit ce4d43b111
7 changed files with 47 additions and 17 deletions

View File

@ -31,7 +31,7 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
'm t': 'div.notification-options li[data-id="2"] a', // mark topic as tracking
'm w': 'div.notification-options li[data-id="3"] a', // mark topic as watching
'n': '#user-notifications', // open notifictions menu
'o,enter': '#topic-list tr.topic-list-item.selected a.title', // open selected topic
'o,enter': '#topic-list tr.selected a.title', // open selected topic
'shift+r': '#topic-footer-buttons button.create', // reply to topic
'r': '.topic-post.selected button.create', // reply to selected post
'shift+s': '#topic-footer-buttons button.share', // share topic
@ -48,7 +48,8 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
'`': 'nextSection',
'~': 'prevSection',
'/': 'showSearch',
'?': 'showHelpModal' // open keyboard shortcut help
'?': 'showHelpModal', // open keyboard shortcut help
'q': 'quoteReply'
},
bindEvents: function(keyTrapper) {
@ -58,6 +59,14 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
_.each(this.FUNCTION_BINDINGS, this._bindToFunction, this);
},
quoteReply: function(){
$('.topic-post.selected button.create').click();
// lazy but should work for now
setTimeout(function(){
$('#wmd-quote-post').click();
}, 500);
},
goToFirstPost: function() {
this._jumpTo('jumpTop');
},
@ -133,25 +142,53 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
// loop is not allowed
if (direction === -1 && index === 0) { return; }
// if nothing is selected go to the first post on screen
if ($selected.length === 0) {
var scrollTop = $('body').scrollTop();
index = 0;
$articles.each(function(){
var top = $(this).position().top;
if(top > scrollTop) {
return false;
}
index += 1;
});
if(index >= $articles.length){
index = $articles.length - 1;
}
}
var $article = $articles.eq(index + direction);
if ($article.size() > 0) {
$articles.removeClass('selected');
$article.addClass('selected');
Em.run.next(function(){
$article.addClass('selected');
});
var rgx = new RegExp("post-cloak-(\\d+)").exec($article.parent()[0].id);
if (rgx === null || typeof rgx[1] === 'undefined') {
this._scrollList($article);
this._scrollList($article, direction);
} else {
Discourse.TopicView.jumpToPost(rgx[1]);
}
}
},
_scrollList: function($article) {
_scrollList: function($article, direction) {
var $body = $('body'),
distToElement = $article.position().top + $article.height() - $(window).height() - $body.scrollTop();
// cut some bottom slack
distToElement += 40;
// don't scroll backwards, its silly
if((direction > 0 && distToElement < 0) || (direction < 0 && distToElement > 0)) {
return;
}
$('html, body').scrollTop($body.scrollTop() + distToElement);
},
@ -160,7 +197,7 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
$topicArea = $('.posts-wrapper');
if ($topicArea.size() > 0) {
return $topicArea.find('.topic-post');
return $('.posts-wrapper .topic-post, #topic-list tbody tr');
}
else if ($topicList.size() > 0) {
return $topicList.find('.topic-list-item');

View File

@ -35,6 +35,7 @@
<li>{{{i18n keyboard_shortcuts_help.actions.share_post}}}</li>
<li>{{{i18n keyboard_shortcuts_help.actions.reply_topic}}}</li>
<li>{{{i18n keyboard_shortcuts_help.actions.reply_post}}}</li>
<li>{{{i18n keyboard_shortcuts_help.actions.quote_post}}}</li>
<li>{{{i18n keyboard_shortcuts_help.actions.like}}}</li>
<li>{{{i18n keyboard_shortcuts_help.actions.flag}}}</li>
<li>{{{i18n keyboard_shortcuts_help.actions.bookmark}}}</li>

View File

@ -166,11 +166,6 @@ body {
.avatar-wrapper {
background-color: $secondary;
display: inline-block;
border: 1px solid scale-color-diff();
@include border-radius-all(5px);
img {
@include border-radius-all(4px);
}
}
.profiler-results.profiler-left {

View File

@ -10,12 +10,8 @@
display: inline-block;
color: $primary;
}
.avatar-wrapper {
border: none;
}
.avatar-link {
margin-right: 3px;
}
}

View File

@ -2,7 +2,7 @@
border-left: 1px solid transparent;
}
.topic-list-item.selected td:first-child, .topic-post.selected {
#topic-list tr.selected td:first-child, .topic-list-item.selected td:first-child, .topic-post.selected {
border-left: 1px solid $danger;
}

View File

@ -331,7 +331,7 @@
}
.avatar-link {
float: left;
margin-right: 10px;
margin-right: 4px;
}
.title {
display: block;

View File

@ -1837,6 +1837,7 @@ en:
share_post: '<b>s</b> Share post'
reply_topic: '<b>shift r</b> Reply to topic'
reply_post: '<b>r</b> Reply to post'
quote_post: '<b>q</b> Quote post'
like: '<b>l</b> Like post'
flag: '<b>!</b> Flag post'
bookmark: '<b>b</b> Bookmark post'