forked from 0x2620/pandora
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
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||||
'use strict';
|
'use strict';
|
||||||
pandora.ui.filterDialog = function(list) {
|
pandora.ui.filterDialog = function() {
|
||||||
|
|
||||||
var that = Ox.Dialog({
|
var that = Ox.Dialog({
|
||||||
buttons: [
|
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,
|
maxWidth: 648 + Ox.UI.SCROLLBAR_SIZE,
|
||||||
minHeight: 264,
|
minHeight: 264,
|
||||||
minWidth: 648 + Ox.UI.SCROLLBAR_SIZE,
|
minWidth: 648 + Ox.UI.SCROLLBAR_SIZE,
|
||||||
height: 264,
|
height: 264,
|
||||||
// keys: {enter: 'save', escape: 'cancel'},
|
// keys: {enter: 'save', escape: 'cancel'},
|
||||||
removeOnClose: true,
|
removeOnClose: true,
|
||||||
title: list ? Ox._('Smart List - {0}', [list.name]) : Ox._('Advanced Find'),
|
title: Ox._('Advanced Find'),
|
||||||
width: 648 + Ox.UI.SCROLLBAR_SIZE
|
width: 648 + Ox.UI.SCROLLBAR_SIZE
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
pandora.ui.filterForm = function(list) {
|
pandora.ui.filterForm = function(options) {
|
||||||
var that = Ox.Element();
|
var list = options.list,
|
||||||
|
mode = options.mode,
|
||||||
|
that = Ox.Element();
|
||||||
pandora.api.findLists({
|
pandora.api.findLists({
|
||||||
query: {
|
query: {
|
||||||
conditions: [{key: 'type', value: 'static', operator: '='}],
|
conditions: [{key: 'type', value: 'static', operator: '='}],
|
||||||
|
@ -33,18 +35,18 @@ pandora.ui.filterForm = function(list) {
|
||||||
return item.id;
|
return item.id;
|
||||||
})
|
})
|
||||||
}]),
|
}]),
|
||||||
list: list ? null : {
|
list: mode == 'find' ? {
|
||||||
sort: pandora.user.ui.listSort,
|
sort: pandora.user.ui.listSort,
|
||||||
view: pandora.user.ui.listView
|
view: pandora.user.ui.listView
|
||||||
},
|
} : null,
|
||||||
query: Ox.clone(list ? list.query : pandora.user.ui.find, true),
|
query: Ox.clone(mode == 'list' ? list.query : pandora.user.ui.find, true),
|
||||||
sortKeys: pandora.site.sortKeys,
|
sortKeys: pandora.site.sortKeys,
|
||||||
viewKeys: pandora.site.listViews
|
viewKeys: pandora.site.listViews
|
||||||
})
|
})
|
||||||
.css({padding: '16px'})
|
.css(mode == 'embed' ? {} : {padding: '16px'})
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
change: function(data) {
|
change: function(data) {
|
||||||
if (list) {
|
if (mode == 'list') {
|
||||||
pandora.api.editList({
|
pandora.api.editList({
|
||||||
id: list.id,
|
id: list.id,
|
||||||
query: data.query
|
query: data.query
|
||||||
|
@ -63,7 +65,7 @@ pandora.ui.filterForm = function(list) {
|
||||||
that.getList = that.$filter.getList;
|
that.getList = that.$filter.getList;
|
||||||
});
|
});
|
||||||
that.updateResults = function() {
|
that.updateResults = function() {
|
||||||
if (list) {
|
if (mode == 'list') {
|
||||||
Ox.Request.clearCache(list.id);
|
Ox.Request.clearCache(list.id);
|
||||||
if (pandora.user.ui.section == 'edits') {
|
if (pandora.user.ui.section == 'edits') {
|
||||||
pandora.$ui.folderList[
|
pandora.$ui.folderList[
|
||||||
|
|
Loading…
Reference in a new issue