[IMP] use optgroups in searchview commands dropdown: cleaner look
bzr revid: xmo@openerp.com-20111130164555-ks7qfvfhv7rca4rg
This commit is contained in:
@@ -198,17 +198,11 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search
|
||||
var self = this;
|
||||
var select = this.$element.find(".oe_search-view-filters-management");
|
||||
var val = select.val();
|
||||
|
||||
if (val.slice(0,1) == "_") { // useless action
|
||||
select.val("_filters");
|
||||
return;
|
||||
}
|
||||
switch(val) {
|
||||
case 'add_to_dashboard':
|
||||
this.on_add_to_dashboard();
|
||||
break;
|
||||
case 'manage_filters':
|
||||
select.val("_filters");
|
||||
this.do_action({
|
||||
res_model: 'ir.filters',
|
||||
views: [[false, 'list'], [false, 'form']],
|
||||
@@ -221,7 +215,6 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search
|
||||
});
|
||||
break;
|
||||
case 'save_filter':
|
||||
select.val("_filters");
|
||||
var data = this.build_search_data();
|
||||
var context = new openerp.web.CompoundContext();
|
||||
_.each(data.contexts, function(x) {
|
||||
@@ -261,6 +254,8 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search
|
||||
val = parseInt(val, 10);
|
||||
var filter = this.managed_filters[val];
|
||||
this.on_search([filter.domain], [filter.context], []);
|
||||
} else {
|
||||
select.val('');
|
||||
}
|
||||
},
|
||||
on_add_to_dashboard: function() {
|
||||
|
||||
@@ -1123,16 +1123,17 @@
|
||||
</form>
|
||||
</t>
|
||||
<t t-name="SearchView.managed-filters">
|
||||
<option value="_filters">-- Filters --</option>
|
||||
<t t-set="i" t-value="0"/>
|
||||
<t t-foreach="filters" t-as="filter">
|
||||
<option t-att-value="'get:' + i"><t t-esc="filter.name"/></option>
|
||||
<t t-set="i" t-value="i+1"/>
|
||||
</t>
|
||||
<option value="_actions">-- Actions --</option>
|
||||
<option value="save_filter">Save Filter</option>
|
||||
<option value="add_to_dashboard">Add to Dashboard</option>
|
||||
<option value="manage_filters">Manage Filters</option>
|
||||
<option/>
|
||||
<optgroup label="-- Filters --">
|
||||
<t t-foreach="filters" t-as="filter">
|
||||
<option t-attf-value="get:#{filter_index}"><t t-esc="filter.name"/></option>
|
||||
</t>
|
||||
</optgroup>
|
||||
<optgroup label="-- Actions --">
|
||||
<option value="save_filter">Save Filter</option>
|
||||
<option value="add_to_dashboard">Add to Dashboard</option>
|
||||
<option value="manage_filters">Manage Filters</option>
|
||||
</optgroup>
|
||||
</t>
|
||||
<t t-name="SearchView.managed-filters.add">
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user