From 5ca96e741d7e42dd9c4423b22dfed13ec4c1b0ea Mon Sep 17 00:00:00 2001 From: cpradio Date: Fri, 29 Aug 2014 09:44:26 -0400 Subject: [PATCH 1/3] UX: Add keyboard bidning for incoming/updated topics --- app/assets/javascripts/discourse/lib/keyboard_shortcuts.js | 6 ++++++ .../templates/modal/keyboard_shortcuts_help.js.handlebars | 1 + config/locales/client.en.yml | 1 + 3 files changed, 8 insertions(+) diff --git a/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js b/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js index 991879ba00e..12a04e80b4a 100644 --- a/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js +++ b/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js @@ -51,6 +51,7 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({ 'u': 'goBack', '`': 'nextSection', '~': 'prevSection', + '.': 'showIncomingUpdatedTopics', '/': 'showSearch', '=': 'showSiteMap', // open site map menu 'p': 'showCurrentUser', // open current user menu @@ -133,6 +134,11 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({ } }, + showIncomingUpdatedTopics: function() { + $('.alert .alert-info .clickable').click(); + return false; + }, + toggleProgress: function() { Discourse.__container__.lookup('controller:topic-progress').send('toggleExpansion', {highlight: true}); }, diff --git a/app/assets/javascripts/discourse/templates/modal/keyboard_shortcuts_help.js.handlebars b/app/assets/javascripts/discourse/templates/modal/keyboard_shortcuts_help.js.handlebars index 76617712dce..3d0f01c65cc 100644 --- a/app/assets/javascripts/discourse/templates/modal/keyboard_shortcuts_help.js.handlebars +++ b/app/assets/javascripts/discourse/templates/modal/keyboard_shortcuts_help.js.handlebars @@ -26,6 +26,7 @@
  • {{{i18n keyboard_shortcuts_help.application.notifications}}}
  • {{{i18n keyboard_shortcuts_help.application.site_map_menu}}}
  • {{{i18n keyboard_shortcuts_help.application.user_profile_menu}}}
  • +
  • {{{i18n keyboard_shortcuts_help.application.show_incoming_updated_topics}}}
  • {{{i18n keyboard_shortcuts_help.application.search}}}
  • {{{i18n keyboard_shortcuts_help.application.help}}}
  • diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 7fe3c5299ce..96ec00746ae 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -2056,6 +2056,7 @@ en: notifications: 'n Open notifications' site_map_menu: '= Open site map menu' user_profile_menu: 'p Open user profile menu' + show_incoming_updated_topics: '. Show incoming/updated topics' search: '/ Search' help: '? Open keyboard shortcuts help' actions: From 8033972536f4fc9e82c66333e7c02e086402f5f2 Mon Sep 17 00:00:00 2001 From: cpradio Date: Fri, 29 Aug 2014 10:01:36 -0400 Subject: [PATCH 2/3] UX: Add keyboard bidning for incoming/updated topics Fixed the selector used to gain access to the clickable div --- app/assets/javascripts/discourse/lib/keyboard_shortcuts.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js b/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js index 12a04e80b4a..f1abde1d402 100644 --- a/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js +++ b/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js @@ -35,6 +35,7 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({ 'm r': 'div.notification-options li[data-id="1"] a', // mark topic as regular '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 + '.': '.alert.alert-info.clickable', // show incoming/updated topics 'n': '#user-notifications', // open notifications menu 'o,enter': '.topic-list tr.selected a.title', // open selected topic 'shift+r': '#topic-footer-buttons button.create', // reply to topic @@ -51,7 +52,6 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({ 'u': 'goBack', '`': 'nextSection', '~': 'prevSection', - '.': 'showIncomingUpdatedTopics', '/': 'showSearch', '=': 'showSiteMap', // open site map menu 'p': 'showCurrentUser', // open current user menu @@ -134,11 +134,6 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({ } }, - showIncomingUpdatedTopics: function() { - $('.alert .alert-info .clickable').click(); - return false; - }, - toggleProgress: function() { Discourse.__container__.lookup('controller:topic-progress').send('toggleExpansion', {highlight: true}); }, From 8a8552019a6b2594e0b6ccca233d3c2f349be1f1 Mon Sep 17 00:00:00 2001 From: cpradio Date: Fri, 29 Aug 2014 18:03:27 -0400 Subject: [PATCH 3/3] Fixed qunit test assertion --- test/javascripts/components/keyboard-shortcuts-test.js.es6 | 1 + 1 file changed, 1 insertion(+) diff --git a/test/javascripts/components/keyboard-shortcuts-test.js.es6 b/test/javascripts/components/keyboard-shortcuts-test.js.es6 index cb290355c95..627de5641da 100644 --- a/test/javascripts/components/keyboard-shortcuts-test.js.es6 +++ b/test/javascripts/components/keyboard-shortcuts-test.js.es6 @@ -47,6 +47,7 @@ module("Discourse.KeyboardShortcuts", { " ", " ", "", + "
    ", "", "
    ", "
    ",