prevent creation of filter rules matching no feeds

This commit is contained in:
Andrew Dolgov 2021-02-21 12:28:25 +03:00
parent fb471652c0
commit 810afdaf5a
4 changed files with 23 additions and 1 deletions

View File

@ -695,7 +695,7 @@ class Pref_Filters extends Handler_Protected {
$feed_ids = explode(",", clean($_REQUEST["ids"]));
print json_encode([
"multiselect" => $this->_feed_multi_select("feed_id", $feed_ids, 'style="width : 540px; height : 300px" dojoType="dijit.form.MultiSelect"')
"multiselect" => $this->_feed_multi_select("feed_id", $feed_ids, 'required="1" style="width : 540px; height : 300px" dojoType="fox.form.ValidationMultiSelect"')
]);
}

View File

@ -0,0 +1,20 @@
/* global define */
// only supports required for the time being
// TODO: maybe show dojo native error message? i dunno
define(["dojo/_base/declare", "dojo/_base/lang", "dijit/form/MultiSelect", ],
function(declare, lang, MultiSelect) {
return declare('fox.form.ValidationMultiSelect', [MultiSelect], {
constructor: function(params){
this.constraints = {};
this.baseClass += ' dijitValidationMultiSelect';
},
validate: function(/*Boolean*/ isFocused){
if (this.required && this.attr('value').length == 0)
return false;
return true;
},
})
});

View File

@ -53,6 +53,7 @@ require(["dojo/_base/kernel",
"fox/PrefLabelTree",
"fox/Toolbar",
"fox/SingleUseDialog",
"fox/form/ValidationMultiSelect",
"fox/form/ValidationTextArea",
"fox/form/Select",
"fox/form/ComboButton",

View File

@ -51,6 +51,7 @@ require(["dojo/_base/kernel",
"fox/FeedTree",
"fox/Toolbar",
"fox/SingleUseDialog",
"fox/form/ValidationMultiSelect",
"fox/form/ValidationTextArea",
"fox/form/Select",
"fox/form/ComboButton",