diff --git a/brewman/brewman/static/js/mousetrap.min-1.4.5.js b/brewman/brewman/static/js/mousetrap.min-1.4.5.js new file mode 100644 index 00000000..b3262b7d --- /dev/null +++ b/brewman/brewman/static/js/mousetrap.min-1.4.5.js @@ -0,0 +1,9 @@ +/* mousetrap v1.4.5 craig.is/killing/mice */ +(function(J,r,f){function s(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)}function A(a){if("keypress"==a.type){var b=String.fromCharCode(a.which);a.shiftKey||(b=b.toLowerCase());return b}return h[a.which]?h[a.which]:B[a.which]?B[a.which]:String.fromCharCode(a.which).toLowerCase()}function t(a){a=a||{};var b=!1,c;for(c in n)a[c]?b=!0:n[c]=0;b||(u=!1)}function C(a,b,c,d,e,v){var g,k,f=[],h=c.type;if(!l[a])return[];"keyup"==h&&w(a)&&(b=[a]);for(g=0;gg||h.hasOwnProperty(g)&&(p[h[g]]=g)}e=p[c]?"keydown":"keypress"}"keypress"==e&&f.length&&(e="keydown");return{key:d,modifiers:f,action:e}}function F(a,b,c,d,e){q[a+":"+c]=b;a=a.replace(/\s+/g," ");var f=a.split(" ");1":".","?":"/","|":"\\"},G={option:"alt",command:"meta","return":"enter",escape:"esc",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},p,l={},q={},n={},D,z=!1,I=!1,u=!1;for(f=1;20>f;++f)h[111+f]="f"+f;for(f=0;9>=f;++f)h[f+96]=f;s(r,"keypress",y);s(r,"keydown",y);s(r,"keyup",y);var m={bind:function(a,b,c){a=a instanceof Array?a:[a];for(var d=0;d -
+
@@ -33,7 +33,7 @@ - + diff --git a/brewman/brewman/static/scripts/angular_directive.js b/brewman/brewman/static/scripts/angular_directive.js index 5530840d..1b0ef702 100644 --- a/brewman/brewman/static/scripts/angular_directive.js +++ b/brewman/brewman/static/scripts/angular_directive.js @@ -264,6 +264,7 @@ overlord_directive.directive('aceEditor', ['$parse', function ($parse) { editor.getSession().on('change', function () { if (valid(editor)) { +// ngModel.$setViewValue(editor.getValue()); setter(scope, editor.getValue()); scope.$apply(); } @@ -319,4 +320,19 @@ overlord_directive.directive('chosen', ['$parse', function ($parse) { restrict: 'A', link: linker } -}]) \ No newline at end of file +}]) + +overlord_directive.directive('keypress', [function () { + return function (scope, element, attrs) { + // console.log(scope, element, attrs); + var attribute = scope.$eval(attrs.keypress || '{}'); + for (var k in attribute) { + (function (k) { + console.log('binding ' + k + ' as ' + attribute[k]); + Mousetrap.bind(k, function () { + return attribute[k](scope, element); + }); + })(k); + } + }; +}]); \ No newline at end of file diff --git a/brewman/brewman/static/scripts/ledger.js b/brewman/brewman/static/scripts/ledger.js index e598fbda..55e4479c 100644 --- a/brewman/brewman/static/scripts/ledger.js +++ b/brewman/brewman/static/scripts/ledger.js @@ -1,13 +1,46 @@ 'use strict'; var LedgerCtrl = ['$scope', '$routeParams', '$location', 'ledger', 'Ledger', function ($scope, $routeParams, $location, ledger, Ledger) { + $scope.shortcuts = { + 'up': function () { + if ($scope.selected > 0) { + $scope.$apply(function () { + $scope.selected = $scope.selected -= 1; + }); + } + }, + 'down': function () { + if ($scope.selected < $scope.info.Body.length - 1) { + $scope.$apply(function () { + $scope.selected = $scope.selected += 1; + }); + } + }, + 'alt+r': function () { + console.log('alt+r'); + }, + 'enter': function () { + var path = $scope.info.Body[$scope.selected].Url.replace(/^(?:\/\/|[^\/]+)*/, ""); + $scope.$apply(function () { + $location.path(path).search('StartDate', null).search('FinishDate', null); + }); + }, + 'alt+u': function () { + console.log('alt+u'); + } + }; + + $scope.selected = 0; + $scope.setSelected = function (index) { + $scope.selected = index; + } $scope.info = ledger; $scope.show = function () { var id = $scope.info.Ledger.LedgerID; var start_date = $scope.info.StartDate; var finish_date = $scope.info.FinishDate; if (id == $routeParams.id && start_date == $routeParams.StartDate && finish_date == $routeParams.FinishDate) { - Ledger.get({id:id, StartDate:start_date, FinishDate:finish_date}, function (data) { + Ledger.get({id: id, StartDate: start_date, FinishDate: finish_date}, function (data) { $scope.info = data; }); } @@ -21,11 +54,15 @@ var LedgerCtrl = ['$scope', '$routeParams', '$location', 'ledger', 'Ledger', fun html = html.replace(/á/g, 'á'); window.open('data:application/vnd.ms-excel;charset=UTF-8,' + encodeURIComponent(html)); } - $('#txtLedger').focus(); + if ($routeParams.id) { + $('#gvGrid').focus(); + } else { + $('#txtLedger').focus(); + } }] LedgerCtrl.resolve = { - ledger:['$q', '$route', 'Ledger', function ($q, $route, Ledger) { + ledger: ['$q', '$route', 'Ledger', function ($q, $route, Ledger) { var deferred = $q.defer(); var id = $route.current.params.id; @@ -39,7 +76,7 @@ LedgerCtrl.resolve = { if (typeof id === 'undefined') { Ledger.get({}, successCb); } else { - Ledger.get({id:id, StartDate:start_date, FinishDate:finish_date}, successCb); + Ledger.get({id: id, StartDate: start_date, FinishDate: finish_date}, successCb); } return deferred.promise; }] diff --git a/brewman/brewman/templates/angular_base.mako b/brewman/brewman/templates/angular_base.mako index 6c78bcc3..af093539 100644 --- a/brewman/brewman/templates/angular_base.mako +++ b/brewman/brewman/templates/angular_base.mako @@ -20,6 +20,7 @@ + diff --git a/brewman/brewman/views/services/voucher/credit_salary.py b/brewman/brewman/views/services/voucher/credit_salary.py new file mode 100644 index 00000000..5e84a522 --- /dev/null +++ b/brewman/brewman/views/services/voucher/credit_salary.py @@ -0,0 +1 @@ +__author__ = 'tanshu'
{{item.Date}} {{item.Name}} {{item.Type}}