[IMP] unify open/close behavior of advanced and custom filters, close custom after creating
bzr revid: xmo@openerp.com-20120511143225-472ineg91e111tvv
This commit is contained in:
parent
3ecf0e1ae1
commit
c20d7cfb47
|
@ -1183,6 +1183,13 @@
|
|||
border-top: none;
|
||||
margin: 0;
|
||||
}
|
||||
.openerp .oe_searchview .oe_searchview_drawer h4, .openerp .oe_searchview .oe_searchview_drawer h4 * {
|
||||
margin: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
.openerp .oe_searchview .oe_searchview_drawer h4:before {
|
||||
content: "▸ ";
|
||||
}
|
||||
.openerp .oe_searchview .oe_searchview_drawer button, .openerp .oe_searchview .oe_searchview_drawer .button {
|
||||
border: none;
|
||||
background: white;
|
||||
|
@ -1224,24 +1231,20 @@
|
|||
.openerp .oe_searchview .oe_searchview_drawer .oe_searchview_filters li:hover {
|
||||
background-color: #f0f0fa;
|
||||
}
|
||||
.openerp .oe_searchview .oe_searchview_drawer .oe_searchview_custom .oe_searchview_custom_save {
|
||||
.openerp .oe_searchview .oe_searchview_drawer .oe_searchview_custom form {
|
||||
display: none;
|
||||
}
|
||||
.openerp .oe_searchview .oe_searchview_drawer .oe_searchview_custom form button {
|
||||
font-size: 1px;
|
||||
letter-spacing: -1px;
|
||||
color: transparent;
|
||||
}
|
||||
.openerp .oe_searchview .oe_searchview_drawer .oe_searchview_custom .oe_searchview_custom_save:before {
|
||||
.openerp .oe_searchview .oe_searchview_drawer .oe_searchview_custom form button:before {
|
||||
font-family: "mnmliconsRegular";
|
||||
content: "S";
|
||||
font-size: 20px;
|
||||
color: #404040;
|
||||
}
|
||||
.openerp .oe_searchview .oe_searchview_drawer .oe_searchview_advanced h4 {
|
||||
margin: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
.openerp .oe_searchview .oe_searchview_drawer .oe_searchview_advanced h4:before {
|
||||
content: "▸ ";
|
||||
}
|
||||
.openerp .oe_searchview .oe_searchview_drawer .oe_searchview_advanced form {
|
||||
display: none;
|
||||
}
|
||||
|
@ -1259,10 +1262,10 @@
|
|||
list-style: none;
|
||||
margin: 0;
|
||||
}
|
||||
.openerp .oe_searchview .oe_searchview_drawer .oe_searchview_advanced.oe_opened h4:before {
|
||||
.openerp .oe_searchview .oe_searchview_drawer .oe_opened h4:before {
|
||||
content: "▾ ";
|
||||
}
|
||||
.openerp .oe_searchview .oe_searchview_drawer .oe_searchview_advanced.oe_opened form {
|
||||
.openerp .oe_searchview .oe_searchview_drawer .oe_opened form {
|
||||
display: block;
|
||||
}
|
||||
.openerp .oe_view_topbar {
|
||||
|
|
|
@ -939,6 +939,13 @@ $colour4: #8a89ba
|
|||
border-top: none
|
||||
margin: 0
|
||||
|
||||
h4, h4 *
|
||||
margin: 0
|
||||
cursor: pointer
|
||||
|
||||
h4:before
|
||||
content: "▸ "
|
||||
|
||||
button, .button
|
||||
border: none
|
||||
background: white
|
||||
|
@ -975,24 +982,20 @@ $colour4: #8a89ba
|
|||
background-color: #f0f0fa
|
||||
|
||||
.oe_searchview_custom
|
||||
.oe_searchview_custom_save
|
||||
font-size: 1px
|
||||
letter-spacing: -1px
|
||||
color: transparent
|
||||
&:before
|
||||
font-family: "mnmliconsRegular"
|
||||
content: "S"
|
||||
font-size: 20px
|
||||
color: #404040
|
||||
form
|
||||
display: none
|
||||
|
||||
button
|
||||
font-size: 1px
|
||||
letter-spacing: -1px
|
||||
color: transparent
|
||||
&:before
|
||||
font-family: "mnmliconsRegular"
|
||||
content: "S"
|
||||
font-size: 20px
|
||||
color: #404040
|
||||
|
||||
.oe_searchview_advanced
|
||||
h4
|
||||
margin: 0
|
||||
cursor: pointer
|
||||
|
||||
h4:before
|
||||
content: "▸ "
|
||||
|
||||
form
|
||||
display: none
|
||||
|
||||
|
@ -1008,11 +1011,11 @@ $colour4: #8a89ba
|
|||
list-style: none
|
||||
margin: 0
|
||||
|
||||
&.oe_opened
|
||||
h4:before
|
||||
content: "▾ "
|
||||
form
|
||||
display: block
|
||||
.oe_opened
|
||||
h4:before
|
||||
content: "▾ "
|
||||
form
|
||||
display: block
|
||||
// }}}
|
||||
// View.topbar {{{
|
||||
.oe_view_topbar
|
||||
|
|
|
@ -1483,9 +1483,13 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({
|
|||
template: 'SearchView.CustomFilters',
|
||||
_in_drawer: true,
|
||||
start: function () {
|
||||
var self = this;
|
||||
this.model = new instance.web.Model('ir.filters');
|
||||
this.filters = {};
|
||||
this.$element.on('submit', 'form', this.proxy('save_current'));
|
||||
this.$element.on('click', 'h4', function () {
|
||||
self.$element.toggleClass('oe_opened');
|
||||
});
|
||||
// FIXME: local eval of domain and context to get rid of special endpoint
|
||||
return this.rpc('/web/searchview/get_filters', {
|
||||
model: this.view.model
|
||||
|
@ -1508,7 +1512,8 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({
|
|||
|
||||
$('<button type="button">').appendTo($filter)
|
||||
.text(_t("Delete"))
|
||||
.click(function () {
|
||||
.click(function (e) {
|
||||
e.stopPropagation();
|
||||
self.model.call('unlink', [id]).then(function () {
|
||||
$filter.remove();
|
||||
});
|
||||
|
@ -1534,7 +1539,7 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({
|
|||
save_current: function () {
|
||||
var self = this;
|
||||
var $name = this.$element.find('input:first');
|
||||
var private_filter = this.$element.find('input:last').prop('checked');
|
||||
var private_filter = !this.$element.find('input:last').prop('checked');
|
||||
|
||||
var search = this.view.build_search_data();
|
||||
this.rpc('/web/session/eval_domain_and_context', {
|
||||
|
@ -1558,7 +1563,9 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({
|
|||
filter.id = id;
|
||||
}
|
||||
self.append_filter(filter);
|
||||
$name.val('');
|
||||
self.$element
|
||||
.removeClass('oe_opened')
|
||||
.find('form')[0].reset();
|
||||
});
|
||||
});
|
||||
return false;
|
||||
|
|
|
@ -1472,13 +1472,13 @@
|
|||
</div>
|
||||
<div t-name="SearchView.CustomFilters" class="oe_searchview_custom">
|
||||
<ul class="oe_searchview_custom_list"/>
|
||||
<form class="oe_searchview_custom_closed">
|
||||
<label for="oe_searchview_custom_input" class="oe_searchview_custom_title">
|
||||
Save current search</label>
|
||||
<h4 class="oe_searchview_custom_title">
|
||||
<label for="oe_searchview_custom_input">Save search</label></h4>
|
||||
<form>
|
||||
<input id="oe_searchview_custom_input"/>
|
||||
<label for="oe_searchview_custom_private">Private: </label>
|
||||
<input id="oe_searchview_custom_private" type="checkbox" checked="checked"/>
|
||||
<button class="oe_searchview_custom_save">Save</button>
|
||||
<button>Save</button><br/>
|
||||
<label for="oe_searchview_custom_public">Share with all users:</label>
|
||||
<input id="oe_searchview_custom_public" type="checkbox"/>
|
||||
</form>
|
||||
</div>
|
||||
<div t-name="SearchView.advanced" class="oe_searchview_advanced">
|
||||
|
|
Loading…
Reference in New Issue