From a755177763dfe7d3c62191d87de356d612c8ba0a Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Thu, 6 Feb 2014 10:52:10 +0000 Subject: [PATCH] edit smart edit query --- static/js/filterForm.js | 34 +++++++++++++++++++++++----------- static/js/listDialog.js | 11 ++++++++--- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/static/js/filterForm.js b/static/js/filterForm.js index 6bd10d009..f5bbf57f6 100644 --- a/static/js/filterForm.js +++ b/static/js/filterForm.js @@ -65,17 +65,29 @@ pandora.ui.filterForm = function(list) { that.updateResults = function() { if (list) { Ox.Request.clearCache(list.id); - pandora.$ui.list && pandora.$ui.list.bindEventOnce({ - init: function(data) { - pandora.$ui.folderList[ - pandora.getListData().folder - ].value(list.id, 'query', that.$filter.options('query')); - } - }) - .reloadList(); - pandora.$ui.filters && pandora.$ui.filters.forEach(function($filter) { - $filter.reloadList(); - }); + if (pandora.user.ui.section == 'edits') { + pandora.$ui.folderList[ + pandora.getListData().folder + ].value(list.id, 'query', that.$filter.options('query')); + pandora.api.editEdit({ + id: list.id, + query: that.$filter.options('query') + }, function(result) { + pandora.$ui.editPanel.updatePanel(); + }); + } else { + pandora.$ui.list && pandora.$ui.list.bindEventOnce({ + init: function(data) { + pandora.$ui.folderList[ + pandora.getListData().folder + ].value(list.id, 'query', that.$filter.options('query')); + } + }) + .reloadList(); + pandora.$ui.filters && pandora.$ui.filters.forEach(function($filter) { + $filter.reloadList(); + }); + } } else { pandora.UI.set({find: Ox.clone(that.$filter.options('query'), true)}); pandora.$ui.findElement.updateElement(); diff --git a/static/js/listDialog.js b/static/js/listDialog.js index 8c88b3398..420bf754a 100644 --- a/static/js/listDialog.js +++ b/static/js/listDialog.js @@ -140,8 +140,10 @@ pandora.ui.listDialog = function(section) { } }); - $($updateCheckbox.find('.OxButton')[0]).css({margin: 0}); - $($dialog.$element.find('.OxBar')[2]).append($updateCheckbox); + if (pandora.user.ui.section == 'items') { + $($updateCheckbox.find('.OxButton')[0]).css({margin: 0}); + $($dialog.$element.find('.OxBar')[2]).append($updateCheckbox); + } function getWidth(section) { return section == 'general' ? 496 @@ -440,9 +442,12 @@ pandora.ui.listIconPanel = function(listData) { }; }, items: function(data, callback) { + var listData = pandora.getListData(); pandora.api.find(Ox.extend(data, { query: { - conditions: ui.section == 'items' ? [{key: 'list', value: listData.id, operator: '=='}] : [], + conditions: ui.section == 'items' + ? [{key: 'list', value: listData.id, operator: '=='}] + : listData.query ? listData.query.conditions : [], operator: '&' } }), callback);