# HG changeset patch # User Marcin Kuzminski # Date 2017-01-08 14:14:20 # Node ID ef42222859394dc17ad7f4984f38513fd36aab16 # Parent de8a3cb8f3b8e8478462139ac9daa3e06e876f23 templates: removed some unused JS variables. - cleanup of duplicated keyboard bindings that are now set in seperate file. diff --git a/rhodecode/public/js/rhodecode/base/keyboard-bindings.js b/rhodecode/public/js/rhodecode/base/keyboard-bindings.js --- a/rhodecode/public/js/rhodecode/base/keyboard-bindings.js +++ b/rhodecode/public/js/rhodecode/base/keyboard-bindings.js @@ -58,7 +58,7 @@ function setRCMouseBindings(repoName, re window.location = pyroutes.url('new_repo'); }); - if (repoName !== '' && repoLandingRev !== '') { + if (repoName && repoName != '') { // nav in repo context Mousetrap.bind(['g s'], function(e) { window.location = pyroutes.url( diff --git a/rhodecode/templates/base/base.mako b/rhodecode/templates/base/base.mako --- a/rhodecode/templates/base/base.mako +++ b/rhodecode/templates/base/base.mako @@ -521,64 +521,6 @@ window.location = e.choice.url; }); - ## Global mouse bindings ## - - // general help "?" - Mousetrap.bind(['?'], function(e) { - $('#help_kb').modal({}) - }); - - // / open the quick filter - Mousetrap.bind(['/'], function(e) { - $("#repo_switcher").select2("open"); - - // return false to prevent default browser behavior - // and stop event from bubbling - return false; - }); - - // general nav g + action - Mousetrap.bind(['g h'], function(e) { - window.location = pyroutes.url('home'); - }); - Mousetrap.bind(['g g'], function(e) { - window.location = pyroutes.url('gists', {'private':1}); - }); - Mousetrap.bind(['g G'], function(e) { - window.location = pyroutes.url('gists', {'public':1}); - }); - Mousetrap.bind(['n g'], function(e) { - window.location = pyroutes.url('new_gist'); - }); - Mousetrap.bind(['n r'], function(e) { - window.location = pyroutes.url('new_repo'); - }); - - % if hasattr(c, 'repo_name') and hasattr(c, 'rhodecode_db_repo'): - // nav in repo context - Mousetrap.bind(['g s'], function(e) { - window.location = pyroutes.url('summary_home', {'repo_name': REPO_NAME}); - }); - Mousetrap.bind(['g c'], function(e) { - window.location = pyroutes.url('changelog_home', {'repo_name': REPO_NAME}); - }); - Mousetrap.bind(['g F'], function(e) { - window.location = pyroutes.url('files_home', {'repo_name': REPO_NAME, 'revision': '${c.rhodecode_db_repo.landing_rev[1]}', 'f_path': '', 'search': '1'}); - }); - Mousetrap.bind(['g f'], function(e) { - window.location = pyroutes.url('files_home', {'repo_name': REPO_NAME, 'revision': '${c.rhodecode_db_repo.landing_rev[1]}', 'f_path': ''}); - }); - Mousetrap.bind(['g p'], function(e) { - window.location = pyroutes.url('pullrequest_show_all', {'repo_name': REPO_NAME}); - }); - Mousetrap.bind(['g o'], function(e) { - window.location = pyroutes.url('edit_repo', {'repo_name': REPO_NAME}); - }); - Mousetrap.bind(['g O'], function(e) { - window.location = pyroutes.url('edit_repo_perms', {'repo_name': REPO_NAME}); - }); - % endif - diff --git a/rhodecode/templates/base/root.mako b/rhodecode/templates/base/root.mako --- a/rhodecode/templates/base/root.mako +++ b/rhodecode/templates/base/root.mako @@ -79,23 +79,10 @@ c.template_context['visual']['default_re // register templateContext to pass template variables to JS var templateContext = ${h.json.dumps(c.template_context)|n}; - var REPO_NAME = "${getattr(c, 'repo_name', '')}"; - %if hasattr(c, 'rhodecode_db_repo'): - var REPO_LANDING_REV = '${c.rhodecode_db_repo.landing_rev[1]}'; - var REPO_TYPE = '${c.rhodecode_db_repo.repo_type}'; - %else: - var REPO_LANDING_REV = ''; - var REPO_TYPE = ''; - %endif var APPLICATION_URL = "${h.url('home').rstrip('/')}"; var ASSET_URL = "${h.asset('')}"; var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}"; var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}"; - % if getattr(c, 'rhodecode_user', None): - var USER = {name:'${c.rhodecode_user.username}'}; - % else: - var USER = {name:null}; - % endif var APPENLIGHT = { enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'}, diff --git a/rhodecode/templates/errors/error_document.mako b/rhodecode/templates/errors/error_document.mako --- a/rhodecode/templates/errors/error_document.mako +++ b/rhodecode/templates/errors/error_document.mako @@ -7,7 +7,6 @@ - %if c.redirect_time: @@ -18,7 +17,10 @@ - +