some improvements to advanced find

This commit is contained in:
rlx 2016-01-14 14:11:52 +05:30
parent 7b5d587a21
commit b10a710a63
4 changed files with 48 additions and 43 deletions

View file

@ -4,34 +4,39 @@ oml.ui.findDialog = function() {
var ui = oml.user.ui, var ui = oml.user.ui,
that = Ox.Dialog({ that = Ox.Dialog({
buttons: [ buttons: [
Ox.Button({ Ox.Button({
id: 'done', id: 'done',
style: 'squared', style: 'squared',
title: Ox._('Done') title: Ox._('Done')
}) })
.bindEvent({ .bindEvent({
click: function() { click: function() {
var list = oml.$ui.findForm.getList(); var list = oml.$ui.findForm.getList();
if (list.save) { if (list.save) {
oml.addList({ oml.addList({
name: list.name, name: list.name,
query: list.query query: list.query
}); });
}
that.close();
} }
that.close() })
} ],
}) closeButton: true,
], content: oml.$ui.findForm = oml.ui.findForm().css({margin: '16px'}),
closeButton: true, fixedSize: true,
content: oml.$ui.findForm = oml.ui.findForm().css({margin: '16px'}), height: 264,
fixedSize: true, removeOnClose: true,
height: 264, title: Ox._('Advanced Find'),
removeOnClose: true, width: 648 + Ox.UI.SCROLLBAR_SIZE
title: Ox._('Advanced Find'), })
width: 648 + Ox.UI.SCROLLBAR_SIZE .bindEvent({
}), close: function() {
// ...
}
}),
$updateCheckbox = Ox.Checkbox({ $updateCheckbox = Ox.Checkbox({
style: 'squared', style: 'squared',

View file

@ -9,13 +9,13 @@ oml.ui.findElement = function() {
hasPressedClear = false, hasPressedClear = false,
previousFindKey = findKey, previousFindKey = findKey,
that = Ox.FormElementGroup({ that = Ox.FormElementGroup({
elements: [ elements: [
oml.$ui.findInSelect = renderFindInSelect(), oml.$ui.findInSelect = renderFindInSelect(),
oml.$ui.findSelect = Ox.Select({ oml.$ui.findSelect = Ox.Select({
id: 'select', id: 'select',
items: [].concat( items: [].concat(
oml.config.findKeys.map(function(key) { oml.config.findKeys.map(function(key) {

View file

@ -41,22 +41,17 @@ oml.ui.findForm = function(list) {
query: data.value query: data.value
} : {}, function(result) { } : {}, function(result) {
if (list || ui.updateResults) { if (list || ui.updateResults) {
updateResults(); if (!list) {
oml.UI.set({find: Ox.clone(data.value, true)});
oml.$ui.findElement.updateElement();
}
oml.reloadLists();
} }
}); });
} }
}) })
.appendTo(that); .appendTo(that);
function updateResults() {
if (list || ui.updateResults) {
oml.reloadLists();
} else {
oml.UI.set({find: Ox.clone($filter.options('value'), true)});
oml.$ui.findElement.updateElement();
}
}
that.getList = $filter.getList; that.getList = $filter.getList;
that.value = $filter.value; that.value = $filter.value;

View file

@ -478,7 +478,10 @@ oml.ui.mainMenu = function() {
(oml.$ui.titlesDialog || ( (oml.$ui.titlesDialog || (
oml.$ui.titlesDialog = oml.ui.titlesDialog() oml.$ui.titlesDialog = oml.ui.titlesDialog()
)).open(); )).open();
} else if (id == 'advancedfind') {
oml.$ui.findDialog = oml.ui.findDialog().open();
} else if (id == 'download') { } else if (id == 'download') {
// FIXME: what is this??
if (oml.user.ui.item) { if (oml.user.ui.item) {
document.location.href = '/' + oml.user.ui.item + '/get/'; document.location.href = '/' + oml.user.ui.item + '/get/';
} else { } else {
@ -568,7 +571,7 @@ oml.ui.mainMenu = function() {
oml.$ui.findInput.focusInput(true); oml.$ui.findInput.focusInput(true);
}); });
} else { } else {
oml.$ui.filterDialog = oml.ui.filterDialog().open(); oml.$ui.findDialog = oml.ui.findDialog().open();
} }
} }
}, },
@ -578,7 +581,9 @@ oml.ui.mainMenu = function() {
} }
}, },
key_control_shift_f: function() { key_control_shift_f: function() {
Ox.print('FIXME: NOT IMPLEMENTED') if (!oml.hasDialogOrScreen()) {
oml.$ui.findDialog = oml.ui.findDialog().open();
}
}, },
key_control_shift_w: function() { key_control_shift_w: function() {
if (!oml.hasDialogOrScreen()) { if (!oml.hasDialogOrScreen()) {