1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Improvements to keyboard shorcuts

This commit is contained in:
Hillel Coren 2017-06-28 18:33:09 +03:00
parent 50a84f9ffb
commit a61a75b007
2 changed files with 16 additions and 1 deletions

View File

@ -218,6 +218,12 @@
$('#statusWrapper_{{ $entityType }}').show();
@for ($i = 1; $i <= 10; $i++)
Mousetrap.bind('g {{ $i }}', function(e) {
location.href = $('#DataTables_Table_0').find('tr:nth-child({{ $i }})').find('a').attr('href');
});
@endfor
});
</script>

View File

@ -192,7 +192,16 @@
'r' => ENTITY_RECURRING_INVOICE,
] as $key => $value)
Mousetrap.bind('n {{ $key }}', function(e) {
location.href = "{{ url($value . 's/create') }}";
var link = "{{ url($value . 's/create') }}";
@if (in_array($value, [ENTITY_INVOICE, ENTITY_PAYMENT, ENTITY_TASK, ENTITY_VENDOR, ENTITY_RECURRING_INVOICE]))
if (location.pathname.indexOf('/clients/') >= 0) {
var matches = location.pathname.match(/\d+/g);
if (matches.length) {
link += '/' + matches[0];
}
}
@endif
location.href = link;
});
Mousetrap.bind('l {{ $key }}', function(e) {
location.href = "{{ url($value . 's') }}";