Skip to content
Permalink
Browse files

fix keyboard entry in cart

  • Loading branch information...
kilbot committed Jun 11, 2015
1 parent 358d95f commit ee61744083ebeaf9bdb6e9d717c8f8acbd3a6698
@@ -14,7 +14,7 @@ var NumpadBehavior = Behavior.extend({
events: {
'click @ui.target' : 'numpadPopover',
'open:numpad @ui.input' : 'numpadPopover',
'keyup @ui.target' : 'closePopover'
'keypress @ui.target' : 'keyboardEntry'
},

onRender: function() {
@@ -68,8 +68,14 @@ var NumpadBehavior = Behavior.extend({
},
/* jshint +W071 */

closePopover: function(e){
$(e.target).popover('hide');
keyboardEntry: function(e){
var target = $(e.target);
if( target.data('popoverOpen') ){
target.one('hidden.bs.popover', function(){
target.val( String.fromCharCode(e.keyCode) ).trigger('input');
});
target.popover('hide');
}
}

});
@@ -71,6 +71,7 @@ module.exports = LayoutView.extend({
},

shown: function(){
this.target.data('popoverOpen', true);
$('body').on('click', this.close);
},

@@ -87,6 +88,7 @@ module.exports = LayoutView.extend({
});
this.destroy();
this.target.popover('destroy');
this.target.data('popoverOpen', false);
}

});
@@ -13,22 +13,16 @@ module.exports = Service.extend({
},

open: function(options){
if(this.popoverOpen(options.target)){ return; }
if( options.target.data('popoverOpen') ){
return;
}
this.layout = new Layout(options);
this.layout.open();
return this.layout;
},

close: function(){
this.layout.close();
},

popoverOpen: function(target){
var describedby = target.attr('aria-describedby');
if(describedby && describedby.slice(0,7) === 'popover'){
return true;
}
return false;
}

});

0 comments on commit ee61744

Please sign in to comment.
You can’t perform that action at this time.