From 3cc78f06799b0c91957767e8d9255e67b30edd96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 24 Oct 2016 11:20:11 +0200 Subject: Added shortcuts --- app/AppKernel.php | 1 + app/Resources/static/themes/_global/js/tools.js | 12 ++++++++++++ app/config/config.yml | 3 +++ app/config/routing.yml | 3 +++ 4 files changed, 19 insertions(+) (limited to 'app') diff --git a/app/AppKernel.php b/app/AppKernel.php index 342bd139..81b83ef9 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -30,6 +30,7 @@ class AppKernel extends Kernel new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), new Craue\ConfigBundle\CraueConfigBundle(), new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(), + new FOS\JsRoutingBundle\FOSJsRoutingBundle(), // wallabag bundles new Wallabag\CoreBundle\WallabagCoreBundle(), diff --git a/app/Resources/static/themes/_global/js/tools.js b/app/Resources/static/themes/_global/js/tools.js index 55de090c..9a98f0a6 100644 --- a/app/Resources/static/themes/_global/js/tools.js +++ b/app/Resources/static/themes/_global/js/tools.js @@ -1,4 +1,5 @@ const $ = require('jquery'); +require('mousetrap'); /* Allows inline call qr-code call */ import jrQrcode from 'jr-qrcode'; // eslint-disable-line @@ -51,3 +52,14 @@ function initExport() { } export { savePercent, retrievePercent, initFilters, initExport }; + +/** Shortcuts **/ + +/* Go to */ +Mousetrap.bind('g u', function() { window.location.href = Routing.generate('homepage') }); +Mousetrap.bind('g s', function() { window.location.href = Routing.generate('starred') }); + +/* Actions */ +Mousetrap.bind('g a', function() { + $("#nav-btn-add").trigger("click"); +}); diff --git a/app/config/config.yml b/app/config/config.yml index 168634cf..494a67a9 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -351,3 +351,6 @@ old_sound_rabbit_mq: queue_options: name: 'wallabag.import.chrome' callback: wallabag_import.consumer.amqp.chrome + +fos_js_routing: + routes_to_expose: [ homepage, starred, archive, all, tag, config, import, developer, howto, about, logout ] diff --git a/app/config/routing.yml b/app/config/routing.yml index 750ed435..eedf51d5 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -52,3 +52,6 @@ craue_config_settings_modify: path: /settings defaults: _controller: CraueConfigBundle:Settings:modify + +fos_js_routing: + resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml" -- cgit v1.2.3