filterForm: add options arg (mode: 'find', 'list', 'embed', list: listData)
This commit is contained in:
parent
37c9fcb192
commit
00b140b9f1
2 changed files with 13 additions and 11 deletions
|
@ -1,6 +1,6 @@
|
|||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||
'use strict';
|
||||
pandora.ui.filterDialog = function(list) {
|
||||
pandora.ui.filterDialog = function() {
|
||||
|
||||
var that = Ox.Dialog({
|
||||
buttons: [
|
||||
|
@ -42,14 +42,14 @@ pandora.ui.filterDialog = function(list) {
|
|||
}
|
||||
})
|
||||
],
|
||||
content: pandora.$ui.filterForm = pandora.ui.filterForm(list),
|
||||
content: pandora.$ui.filterForm = pandora.ui.filterForm({mode: 'find'}),
|
||||
maxWidth: 648 + Ox.UI.SCROLLBAR_SIZE,
|
||||
minHeight: 264,
|
||||
minWidth: 648 + Ox.UI.SCROLLBAR_SIZE,
|
||||
height: 264,
|
||||
// keys: {enter: 'save', escape: 'cancel'},
|
||||
removeOnClose: true,
|
||||
title: list ? Ox._('Smart List - {0}', [list.name]) : Ox._('Advanced Find'),
|
||||
title: Ox._('Advanced Find'),
|
||||
width: 648 + Ox.UI.SCROLLBAR_SIZE
|
||||
}),
|
||||
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
pandora.ui.filterForm = function(list) {
|
||||
var that = Ox.Element();
|
||||
pandora.ui.filterForm = function(options) {
|
||||
var list = options.list,
|
||||
mode = options.mode,
|
||||
that = Ox.Element();
|
||||
pandora.api.findLists({
|
||||
query: {
|
||||
conditions: [{key: 'type', value: 'static', operator: '='}],
|
||||
|
@ -33,18 +35,18 @@ pandora.ui.filterForm = function(list) {
|
|||
return item.id;
|
||||
})
|
||||
}]),
|
||||
list: list ? null : {
|
||||
list: mode == 'find' ? {
|
||||
sort: pandora.user.ui.listSort,
|
||||
view: pandora.user.ui.listView
|
||||
},
|
||||
query: Ox.clone(list ? list.query : pandora.user.ui.find, true),
|
||||
} : null,
|
||||
query: Ox.clone(mode == 'list' ? list.query : pandora.user.ui.find, true),
|
||||
sortKeys: pandora.site.sortKeys,
|
||||
viewKeys: pandora.site.listViews
|
||||
})
|
||||
.css({padding: '16px'})
|
||||
.css(mode == 'embed' ? {} : {padding: '16px'})
|
||||
.bindEvent({
|
||||
change: function(data) {
|
||||
if (list) {
|
||||
if (mode == 'list') {
|
||||
pandora.api.editList({
|
||||
id: list.id,
|
||||
query: data.query
|
||||
|
@ -63,7 +65,7 @@ pandora.ui.filterForm = function(list) {
|
|||
that.getList = that.$filter.getList;
|
||||
});
|
||||
that.updateResults = function() {
|
||||
if (list) {
|
||||
if (mode == 'list') {
|
||||
Ox.Request.clearCache(list.id);
|
||||
if (pandora.user.ui.section == 'edits') {
|
||||
pandora.$ui.folderList[
|
||||
|
|
Loading…
Reference in a new issue