[REF] web(_tests): list view (editable): action buttons

Refactoring of the DOM structure and classnames of the list view's action
buttons (in the control panel), for new design compatibility. This refactoring
was required as some addons shared between both editions (e.g. base_import)
define their own buttons and extend the ListView.buttons template to insert
them.
This commit is contained in:
Aaron Bohy
2015-07-29 08:41:02 +02:00
parent 4e24b81616
commit 71e9de4ecc
6 changed files with 24 additions and 34 deletions
+5 -11
View File
@@ -2340,7 +2340,7 @@
height: auto;
line-height: 16px;
}
.openerp .oe_form_field_one2many .oe_list_buttons.oe_editing .oe_list_save, .openerp .oe_form_field_many2many .oe_list_buttons.oe_editing .oe_list_save {
.openerp .oe_form_field_one2many .oe_list_buttons.oe_editing .o_list_button_save, .openerp .oe_form_field_many2many .oe_list_buttons.oe_editing .o_list_button_save {
visibility: hidden;
}
.openerp .oe_form_editable .oe_list_editable .oe_list_content td.oe_required {
@@ -2417,24 +2417,18 @@
.openerp .oe_form .oe_form_field_many2many > .oe_list .oe_list_pager_single_page {
display: none;
}
.openerp .oe_list_buttons .oe_alternative {
visibility: hidden;
}
.openerp .oe_list_buttons .oe_list_save, .openerp .oe_list_buttons .oe_list_discard {
.openerp .oe_list_buttons .o_list_button_save, .openerp .oe_list_buttons .o_list_button_discard {
display: none;
}
.openerp .oe_list_buttons.oe_editing .oe_list_add {
.openerp .oe_list_buttons.oe_editing .o_list_button_add {
display: none;
}
.openerp .oe_list_buttons.oe_editing .oe_list_save {
.openerp .oe_list_buttons.oe_editing .o_list_button_save {
display: inline-block;
}
.openerp .oe_list_buttons.oe_editing .oe_list_discard {
.openerp .oe_list_buttons.oe_editing .o_list_button_discard {
display: inline;
}
.openerp .oe_list_buttons.oe_editing .oe_alternative {
visibility: visible;
}
.openerp .oe_list.oe_cannot_edit .oe_list_header_handle, .openerp .oe_list.oe_cannot_edit .oe_list_field_handle {
display: none !important;
padding: 0 !important;
+5 -9
View File
@@ -1925,7 +1925,7 @@ $sheet-padding: 16px
li
height: auto
line-height: 16px
.oe_list_buttons.oe_editing .oe_list_save
.oe_list_buttons.oe_editing .o_list_button_save
// keep "save row" button hidden in o2m
visibility: hidden
.oe_form_editable
@@ -1993,19 +1993,15 @@ $sheet-padding: 16px
// }}}
// ListView {{{
.oe_list_buttons
.oe_alternative
visibility: hidden
.oe_list_save, .oe_list_discard
.o_list_button_save, .o_list_button_discard
display: none
&.oe_editing
.oe_list_add
.o_list_button_add
display: none
.oe_list_save
.o_list_button_save
display: inline-block
.oe_list_discard
.o_list_button_discard
display: inline
.oe_alternative
visibility: visible
.oe_list
&.oe_cannot_edit
+1 -1
View File
@@ -278,7 +278,7 @@ var ListView = View.extend( /** @lends instance.web.ListView# */ {
if (!this.$buttons) {
this.$buttons = $(QWeb.render("ListView.buttons", {'widget': this}));
this.$buttons.find('.oe_list_add').click(this.proxy('do_add_record'));
this.$buttons.find('.o_list_button_add').click(this.proxy('do_add_record'));
$node = $node || this.options.$buttons;
if ($node) {
@@ -312,10 +312,10 @@ ListView.include(/** @lends instance.web.ListView# */{
this._super.apply(this, arguments); // Sets this.$buttons
if (add_button && this.editable()) {
this.$buttons
.off('click', '.oe_list_save')
.on('click', '.oe_list_save', this.proxy('save_edition'))
.off('click', '.oe_list_discard')
.on('click', '.oe_list_discard', function (e) {
.off('click', '.o_list_button_save')
.on('click', '.o_list_button_save', this.proxy('save_edition'))
.off('click', '.o_list_button_discard')
.on('click', '.o_list_button_discard', function (e) {
e.preventDefault();
self.cancel_edition();
});
+8 -8
View File
@@ -705,7 +705,7 @@
<t t-name="ListView.buttons">
<t t-if="!widget.no_leaf and widget.options.action_buttons !== false and widget.options.addable and widget.is_action_enabled('create')">
<div class="oe_list_buttons">
<button type="button" class="oe_list_add btn btn-primary btn-sm">
<button type="button" class="btn btn-sm btn-primary o_list_button_add">
<t t-esc="widget.options.addable"/>
</button>
</div>
@@ -745,13 +745,13 @@
</td>
</tr>
<t t-extend="ListView.buttons">
<t t-jquery="button.oe_list_add" t-operation="after">
<button class="oe_button oe_list_save oe_highlight"
type="button">Save</button>
<span class="oe_alternative">
<span class="oe_fade">or</span>
<a href="#" class="oe_bold oe_list_discard">Discard</a>
</span>
<t t-jquery="button.o_list_button_add" t-operation="after">
<button type="button" class="btn btn-primary btn-sm o_list_button_save">
Save
</button>
<button type="button" class="btn btn-default btn-sm o_list_button_discard">
Discard
</button>
</t>
</t>
<button t-name="ListView.row.text_button" type="button"
+1 -1
View File
@@ -17,7 +17,7 @@ Tour.register({
{
title: "create new discussion",
element: '.oe_application:has(.oe-view-title:contains(Discussions)) button.oe_list_add'
element: '.oe_application:has(.oe-view-title:contains(Discussions)) button.o_list_button_add'
},
{
title: "insert title",