Browse Source

[fix] [minor] select on selecting filter

version-14
Rushabh Mehta 10 years ago
parent
commit
3eb8a6a6b6
2 changed files with 21 additions and 19 deletions
  1. +19
    -17
      frappe/public/js/frappe/ui/filters/filters.js
  2. +2
    -2
      frappe/public/js/frappe/ui/toolbar/awesome_bar.js

+ 19
- 17
frappe/public/js/frappe/ui/filters/filters.js View File

@@ -382,26 +382,28 @@ frappe.ui.Filter = Class.extend({
frappe.ui.FieldSelect = Class.extend({
// opts parent, doctype, filter_fields, with_blank, select
init: function(opts) {
var me = this;
$.extend(this, opts);
this.fields_by_name = {};
this.options = [];
this.$select = $('<input class="form-control">').appendTo(this.parent);
var me = this;
this.$select.autocomplete({
source: me.options,
minLength: 0,
focus: function(event, ui) {
ui.item && me.$select.val(ui.item.label);
return false;
},
select: function(event, ui) {
me.selected_doctype = ui.item.doctype;
me.selected_fieldname = ui.item.fieldname;
me.$select.val(ui.item.label);
if(me.select) me.select(ui.item.doctype, ui.item.fieldname);
return false;
}
});
this.$select = $('<input class="form-control">')
.appendTo(this.parent)
.on("click", function () { $(this).select(); })
.autocomplete({
source: me.options,
minLength: 0,
focus: function(event, ui) {
ui.item && me.$select.val(ui.item.label);
return false;
},
select: function(event, ui) {
me.selected_doctype = ui.item.doctype;
me.selected_fieldname = ui.item.fieldname;
me.$select.val(ui.item.label);
if(me.select) me.select(ui.item.doctype, ui.item.fieldname);
return false;
}
});

this.$select.data('ui-autocomplete')._renderItem = function(ul, item) {
return $(repl('<li class="filter-field-select"><p>%(label)s</p></li>', item))


+ 2
- 2
frappe/public/js/frappe/ui/toolbar/awesome_bar.js View File

@@ -226,8 +226,8 @@ frappe.search.verbs = [
function(txt) {
frappe.search.find(keys(frappe.search.pages), txt, function(match) {
return {
label: __("Open {0}", ["<b>"+__(match)+"</b>"]),
value: __("Open {0}", [__(match)]),
label: __("Report {0}", ["<b>"+__(match)+"</b>"]),
value: __("Report {0}", [__(match)]),
route: [frappe.search.pages[match].route || frappe.search.pages[match].name]
}
});


Loading…
Cancel
Save