From 05677af8c1c9c604605c9946c972376505ab6727 Mon Sep 17 00:00:00 2001 From: Amy Lam Date: Fri, 23 Sep 2016 15:10:06 -0700 Subject: [PATCH] Keyboard ctrl-S or cmd-S is same as clicking Update button Resolves: https://github.com/HospitalRun/hospitalrun-frontend/issues/540 Pair: @alychloe --- app/admin/lookup/controller.js | 15 +++++++++++++-- package.json | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/admin/lookup/controller.js b/app/admin/lookup/controller.js index c8b1120660..3dd7887065 100644 --- a/app/admin/lookup/controller.js +++ b/app/admin/lookup/controller.js @@ -6,8 +6,10 @@ import ImagingPricingTypes from 'hospitalrun/mixins/imaging-pricing-types'; import InventoryTypeList from 'hospitalrun/mixins/inventory-type-list'; import UnitTypes from 'hospitalrun/mixins/unit-types'; import VisitTypes from 'hospitalrun/mixins/visit-types'; -export default Ember.Controller.extend(BillingCategories, LabPricingTypes, - ModalHelper, ImagingPricingTypes, InventoryTypeList, UnitTypes, VisitTypes, { +import { EKMixin, keyDown } from 'ember-keyboard'; +export default Ember.Controller.extend(BillingCategories, EKMixin, + ImagingPricingTypes, InventoryTypeList, LabPricingTypes, ModalHelper, + UnitTypes, VisitTypes, { fileSystem: Ember.inject.service('filesystem'), lookupTypes: Ember.computed(function() { return [{ @@ -311,6 +313,15 @@ export default Ember.Controller.extend(BillingCategories, LabPricingTypes, return Ember.compare(a.toLowerCase(), b.toLowerCase()); }, + activateKeyboard: Ember.on('init', function() { + this.set('keyboardActivated', true); + }), + + updateListKeyboard: Ember.on(keyDown('ctrl+KeyS'), keyDown('cmd+KeyS'), function(event) { + this.send('updateList'); + event.preventDefault(); + }), + actions: { addValue: function() { this.send('openModal', 'admin.lookup.edit', Ember.Object.create({ diff --git a/package.json b/package.json index f83d6d6b2c..116f735275 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "ember-data": "~2.6.2", "ember-export-application-global": "^1.0.5", "ember-i18n": "4.3.2", + "ember-keyboard": "2.1.3", "ember-load-initializers": "^0.5.1", "ember-pouch": "4.0.1", "ember-radio-buttons": "^4.0.1",