Browse Source

prevent creation of filter rules matching no feeds

master
Andrew Dolgov 1 year ago
parent
commit
810afdaf5a
  1. 2
      classes/pref/filters.php
  2. 20
      js/form/ValidationMultiSelect.js
  3. 1
      js/prefs.js
  4. 1
      js/tt-rss.js

2
classes/pref/filters.php

@ -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"')
]);
}

20
js/form/ValidationMultiSelect.js

@ -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;
},
})
});

1
js/prefs.js

@ -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",

1
js/tt-rss.js

@ -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",

Loading…
Cancel
Save