Skip to content

Commit

Permalink
[IMP] point_of_sale: removed actionbars, were not used anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic van der Essen committed Aug 25, 2014
1 parent a1ed181 commit 2b67528
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 154 deletions.
27 changes: 0 additions & 27 deletions addons/point_of_sale/static/src/js/screens.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,26 +211,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
barcode_error_action: function(code){
this.pos_widget.screen_selector.show_popup('error-barcode',code.code);
},
// shows an action bar on the screen. The actionbar is automatically shown when you add a button
// with add_action_button()
show_action_bar: function(){
this.pos_widget.action_bar.show();
},

// hides the action bar. The actionbar is automatically hidden when it is empty
hide_action_bar: function(){
this.pos_widget.action_bar.hide();
},

// adds a new button to the action bar. The button definition takes three parameters, all optional :
// - label: the text below the button
// - icon: a small icon that will be shown
// - click: a callback that will be executed when the button is clicked.
// the method returns a reference to the button widget, and automatically show the actionbar.
add_action_button: function(button_def){
this.show_action_bar();
return this.pos_widget.action_bar.add_new_button(button_def);
},

// this method shows the screen and sets up all the widget related to this screen. Extend this method
// if you want to alter the behavior of the screen.
Expand All @@ -242,12 +222,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
this.$el.removeClass('oe_hidden');
}

if(this.pos_widget.action_bar.get_button_count() > 0){
this.show_action_bar();
}else{
this.hide_action_bar();
}

var self = this;

this.pos_widget.set_numpad_visible(this.show_numpad);
Expand All @@ -270,7 +244,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
if(this.pos.barcode_reader){
this.pos.barcode_reader.reset_action_callbacks();
}
this.pos_widget.action_bar.destroy_buttons();
},

// this methods hides the screen. It's not a good place to put your cleanup stuff as it is called on the
Expand Down
88 changes: 0 additions & 88 deletions addons/point_of_sale/static/src/js/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,90 +293,6 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
},
});

module.ActionButtonWidget = instance.web.Widget.extend({
template:'ActionButtonWidget',
icon_template:'ActionButtonWidgetWithIcon',
init: function(parent, options){
this._super(parent, options);
this.label = options.label || 'button';
this.rightalign = options.rightalign || false;
this.click_action = options.click;
this.disabled = options.disabled || false;
if(options.icon){
this.icon = options.icon;
this.template = this.icon_template;
}
},
set_disabled: function(disabled){
if(this.disabled != disabled){
this.disabled = !!disabled;
this.renderElement();
}
},
renderElement: function(){
this._super();
if(this.click_action && !this.disabled){
this.$el.click(_.bind(this.click_action, this));
}
},
});

module.ActionBarWidget = instance.web.Widget.extend({
template:'ActionBarWidget',
init: function(parent, options){
this._super(parent,options);
this.button_list = [];
this.buttons = {};
this.visibility = {};
},
set_element_visible: function(element, visible, action){
if(visible != this.visibility[element]){
this.visibility[element] = !!visible;
if(visible){
this.$('.'+element).removeClass('oe_hidden');
}else{
this.$('.'+element).addClass('oe_hidden');
}
}
if(visible && action){
this.action[element] = action;
this.$('.'+element).off('click').click(action);
}
},
set_button_disabled: function(name, disabled){
var b = this.buttons[name];
if(b){
b.set_disabled(disabled);
}
},
destroy_buttons:function(){
for(var i = 0; i < this.button_list.length; i++){
this.button_list[i].destroy();
}
this.button_list = [];
this.buttons = {};
return this;
},
get_button_count: function(){
return this.button_list.length;
},
add_new_button: function(button_options){
var button = new module.ActionButtonWidget(this,button_options);
this.button_list.push(button);
if(button_options.name){
this.buttons[button_options.name] = button;
}
button.appendTo(this.$('.pos-actionbar-button-list'));
return button;
},
show:function(){
this.$el.removeClass('oe_hidden');
},
hide:function(){
this.$el.addClass('oe_hidden');
},
});

module.ProductCategoriesWidget = module.PosBaseWidget.extend({
template: 'ProductCategoriesWidget',
init: function(parent, options){
Expand Down Expand Up @@ -891,7 +807,6 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
// - a header, containing the list of orders
// - a leftpane, containing the list of bought products (orderlines)
// - a rightpane, containing the screens (see pos_screens.js)
// - an actionbar on the bottom, containing various action buttons
// - popups
// - an onscreen keyboard
// a screen_selector which controls the switching between screens and the showing/closing of popups
Expand Down Expand Up @@ -1125,9 +1040,6 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
this.username = new module.UsernameWidget(this,{});
this.username.replace(this.$('.placeholder-UsernameWidget'));

this.action_bar = new module.ActionBarWidget(this);
this.action_bar.replace(this.$(".placeholder-RightActionBar"));

this.actionpad = new module.ActionpadWidget(this, {});
this.actionpad.replace(this.$('.placeholder-ActionpadWidget'));

Expand Down
39 changes: 0 additions & 39 deletions addons/point_of_sale/static/src/xml/pos.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@
</div>
</div>

<div class='subwindow collapsed'>
<div class='subwindow-container'>
<div class='subwindow-container-fix'>
<div class='placeholder-LeftActionBar'></div>
</div>
</div>
</div>
</div>
</div>

Expand All @@ -60,14 +53,6 @@
</div>
</div>
</div>

<div class='subwindow collapsed'>
<div class='subwindow-container'>
<div class='subwindow-container-fix'>
<div class='placeholder-RightActionBar'></div>
</div>
</div>
</div>
</div>
</div>

Expand Down Expand Up @@ -1157,30 +1142,6 @@
</div>
</t>

<t t-name="ActionBarWidget">
<div class="pos-actionbar">
<ul class="pos-actionbar-button-list">
</ul>
</div>
</t>

<t t-name="ActionButtonWidget">
<li t-att-class=" 'button '+ (widget.rightalign ? 'rightalign ' : '') + (widget.disabled ? 'disabled ' : '')">
<div class='label'>
<t t-esc="widget.label" />
</div>
</li>
</t>

<t t-name="ActionButtonWidgetWithIcon">
<li t-att-class=" 'button '+ (widget.rightalign ? 'rightalign ' : '') + (widget.disabled ? 'disabled ' : '')">
<div class='icon'>
<img t-att-src="widget.icon" />
<div class='iconlabel'><t t-esc="widget.label" /></div>
</div>
</li>
</t>

<!-- Onscreen Keyboard :
http://net.tutsplus.com/tutorials/javascript-ajax/creating-a-keyboard-with-css-and-jquery/ -->
<t t-name="OnscreenKeyboardFull">
Expand Down

0 comments on commit 2b67528

Please sign in to comment.