[ADD] focus last input if the user clicks somewhere in the search view, outside of a search view control
bzr revid: xmo@openerp.com-20120502134312-0tuspwcmtlw5el3o
This commit is contained in:
parent
a40e410d1a
commit
f009c76598
|
@ -1046,6 +1046,7 @@
|
|||
white-space: nowrap;
|
||||
}
|
||||
.openerp .oe_searchview {
|
||||
cursor: text;
|
||||
position: relative;
|
||||
float: right;
|
||||
padding-right: 20px;
|
||||
|
@ -1059,6 +1060,12 @@
|
|||
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) inset;
|
||||
-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) inset;
|
||||
}
|
||||
.openerp .oe_searchview.oe_focused {
|
||||
border-color: #a6a6fe;
|
||||
-moz-box-shadow: 0 1px 2px #a6a6fe inset;
|
||||
-webkit-box-shadow: 0 1px 2px #a6a6fe inset;
|
||||
-box-shadow: 0 1px 2px #a6a6fe inset;
|
||||
}
|
||||
.openerp .oe_searchview .oe_searchview_clear {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
|
|
|
@ -819,6 +819,7 @@ $colour4: #8a89ba
|
|||
// }}}
|
||||
// SearchView xmo {{{
|
||||
.oe_searchview
|
||||
cursor: text
|
||||
position: relative
|
||||
float: right
|
||||
padding-right: 20px
|
||||
|
@ -828,6 +829,10 @@ $colour4: #8a89ba
|
|||
@include radius(1em)
|
||||
@include box-shadow(0 1px 2px rgba(0,0,0,0.2) inset)
|
||||
|
||||
&.oe_focused
|
||||
border-color: $facets-border-selected
|
||||
@include box-shadow(0 1px 2px $facets-border-selected inset)
|
||||
|
||||
.oe_searchview_clear
|
||||
cursor: pointer
|
||||
position: absolute
|
||||
|
|
|
@ -155,6 +155,7 @@ my.FacetView = instance.web.Widget.extend({
|
|||
if ($(e.target).is('.oe_facet_remove')) {
|
||||
return;
|
||||
}
|
||||
e.stopPropagation();
|
||||
self.$element.siblings().trigger('deselect');
|
||||
self.$element.addClass('oe_selected');
|
||||
});
|
||||
|
@ -259,7 +260,8 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
|
|||
});
|
||||
}
|
||||
|
||||
this.$element.on('click', '.oe_searchview_unfold_drawer', function () {
|
||||
this.$element.on('click', '.oe_searchview_unfold_drawer', function (e) {
|
||||
e.stopImmediatePropagation();
|
||||
self.$element.toggleClass('oe_searchview_open_drawer');
|
||||
});
|
||||
this.$element.on('click', '.oe_facet_remove', function (e) {
|
||||
|
@ -271,6 +273,19 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
|
|||
self.query.remove(
|
||||
self.query.at(index), {trigger_search: true});
|
||||
});
|
||||
this.$element.on('click', function (e) {
|
||||
// Focus last input if the view itself is clicked (but not one of
|
||||
// its children, that would be weird)
|
||||
if (e.target === self.$element[0]) {
|
||||
self.$element.find('.oe_searchview_input:last').focus();
|
||||
}
|
||||
});
|
||||
this.$element.on('focus', function () {
|
||||
self.$element.addClass('oe_focused');
|
||||
});
|
||||
this.$element.on('blur', function () {
|
||||
self.$element.removeClass('oe_focused');
|
||||
});
|
||||
|
||||
return $.when(p, this.ready);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue