summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-21 12:28:25 +0300
committerAndrew Dolgov <[email protected]>2021-02-21 12:28:25 +0300
commit810afdaf5a429468d31b09ae5a7f995dd11568f8 (patch)
tree0b0a7a50046be26a77123c119cb48d3ae21f0ce9 /js
parentfb471652c00abec604e07c2383685c0e352c897e (diff)
prevent creation of filter rules matching no feeds
Diffstat (limited to 'js')
-rw-r--r--js/form/ValidationMultiSelect.js20
-rwxr-xr-xjs/prefs.js1
-rw-r--r--js/tt-rss.js1
3 files changed, 22 insertions, 0 deletions
diff --git a/js/form/ValidationMultiSelect.js b/js/form/ValidationMultiSelect.js
new file mode 100644
index 000000000..4e7263c61
--- /dev/null
+++ b/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;
+ },
+ })
+ });
diff --git a/js/prefs.js b/js/prefs.js
index a23a74856..8f4f45700 100755
--- a/js/prefs.js
+++ b/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",
diff --git a/js/tt-rss.js b/js/tt-rss.js
index 8d7dd00a6..4a7f2e643 100644
--- a/js/tt-rss.js
+++ b/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",