diff --git a/app/assets/javascripts/discourse/controllers/site-map.js.es6 b/app/assets/javascripts/discourse/controllers/site-map.js.es6 index 5f5c97111..9e96862d1 100644 --- a/app/assets/javascripts/discourse/controllers/site-map.js.es6 +++ b/app/assets/javascripts/discourse/controllers/site-map.js.es6 @@ -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(); } diff --git a/app/assets/javascripts/discourse/lib/mobile.js b/app/assets/javascripts/discourse/lib/mobile.js index 4ad2c5b82..cb51b5888 100644 --- a/app/assets/javascripts/discourse/lib/mobile.js +++ b/app/assets/javascripts/discourse/lib/mobile.js @@ -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); diff --git a/app/assets/javascripts/discourse/templates/site_map.js.handlebars b/app/assets/javascripts/discourse/templates/site_map.js.handlebars index 4c91b7e47..99c5f0be7 100644 --- a/app/assets/javascripts/discourse/templates/site_map.js.handlebars +++ b/app/assets/javascripts/discourse/templates/site_map.js.handlebars @@ -8,6 +8,9 @@ {{#if showBadgesLink}}