mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Feature: Show keyboard shortcuts link on desktop hamburger
(only shows up for desktop, hides "mobile view") If you really need mobile view add ?mobile_view=1 to end of URL (also fixed)
This commit is contained in:
parent
488d4eebbe
commit
32cea9d8cc
4 changed files with 21 additions and 3 deletions
|
@ -11,7 +11,13 @@ export default Ember.ArrayController.extend(Discourse.HasCurrentUser, {
|
|||
|
||||
badgesUrl: Discourse.getURL('/badges'),
|
||||
|
||||
showMobileToggle: Discourse.computed.setting('enable_mobile_theme'),
|
||||
showKeyboardShortcuts: function(){
|
||||
return !Discourse.Mobile.mobileView && !Discourse.Mobile.isMobileDevice;
|
||||
}.property(),
|
||||
|
||||
showMobileToggle: function(){
|
||||
return Discourse.SiteSettings.enable_mobile_theme && Discourse.Mobile.isMobileDevice;
|
||||
}.property(),
|
||||
|
||||
mobileViewLinkTextKey: function() {
|
||||
return Discourse.Mobile.mobileView ? "desktop_view" : "mobile_view";
|
||||
|
@ -29,6 +35,9 @@ export default Ember.ArrayController.extend(Discourse.HasCurrentUser, {
|
|||
}.property(),
|
||||
|
||||
actions: {
|
||||
keyboardShortcuts: function(){
|
||||
Discourse.__container__.lookup('controller:application').send('showKeyboardShortcutsHelp');
|
||||
},
|
||||
toggleMobileView: function() {
|
||||
Discourse.Mobile.toggleMobileView();
|
||||
}
|
||||
|
|
|
@ -14,7 +14,13 @@ Discourse.Mobile = {
|
|||
this.mobileView = $html.hasClass('mobile-view');
|
||||
|
||||
try{
|
||||
if (localStorage && localStorage.mobileView) {
|
||||
if (window.location.search.test(/mobile_view=1/)){
|
||||
localStorage.mobileView = true;
|
||||
}
|
||||
if (window.location.search.test(/mobile_view=0/)){
|
||||
localStorage.mobileView = false;
|
||||
}
|
||||
if (localStorage.mobileView) {
|
||||
var savedValue = (localStorage.mobileView === 'true');
|
||||
if (savedValue !== this.mobileView) {
|
||||
this.reloadPage(savedValue);
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
{{#if showBadgesLink}}
|
||||
<li>{{partial "siteMap/badges"}}</li>
|
||||
{{/if}}
|
||||
{{#if showKeyboardShortcuts}}
|
||||
<li><a href="#" {{action keyboardShortcuts}} class="keyboard-shortcuts-link">{{i18n keyboard_shortcuts_help.title}}</a>
|
||||
{{/if}}
|
||||
<li>{{partial "siteMap/faqLink"}}</li>
|
||||
{{#if showMobileToggle}}
|
||||
<li>{{partial "siteMap/mobileToggleLink"}}</li>
|
||||
|
|
|
@ -1926,7 +1926,7 @@ en:
|
|||
download: "download"
|
||||
|
||||
keyboard_shortcuts_help:
|
||||
title: 'Keyboard Shortcuts (experimental)'
|
||||
title: 'Keyboard Shortcuts'
|
||||
jump_to:
|
||||
title: 'Jump To'
|
||||
home: '<b>g</b> then <b>h</b> Home (Latest)'
|
||||
|
|
Loading…
Reference in a new issue