]>
git.wh0rd.org - tt-rss.git/blob - js/PrefFilterTree.js
2 define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare
, domConstruct
) {
4 return declare("fox.PrefFilterTree", lib
.CheckBoxTree
, {
5 _createTreeNode: function(args
) {
6 const tnode
= this.inherited(arguments
);
8 const enabled
= this.model
.store
.getValue(args
.item
, 'enabled');
9 let param
= this.model
.store
.getValue(args
.item
, 'param');
10 const rules
= this.model
.store
.getValue(args
.item
, 'rules');
13 param
= dojo
.doc
.createElement('span');
14 param
.className
= (enabled
!= false) ? 'labelParam' : 'labelParam filterDisabled';
15 param
.innerHTML
= args
.item
.param
[0];
16 domConstruct
.place(param
, tnode
.rowNode
, 'first');
20 param
= dojo
.doc
.createElement('span');
21 param
.className
= 'filterRules';
22 param
.innerHTML
= rules
;
23 domConstruct
.place(param
, tnode
.rowNode
, 'next');
26 if (this.model
.store
.getValue(args
.item
, 'id') != 'root') {
27 const img
= dojo
.doc
.createElement('img');
28 img
.src
='images/filter.png';
29 img
.className
= 'markedPic';
30 tnode
._filterIconNode
= img
;
31 domConstruct
.place(tnode
._filterIconNode
, tnode
.labelNode
, 'before');
37 getLabel: function(item
) {
38 let label
= item
.name
;
40 const feed
= this.model
.store
.getValue(item
, 'feed');
41 const inverse
= this.model
.store
.getValue(item
, 'inverse');
44 label
+= " (" + __("in") + " " + feed
+ ")";
47 label
+= " (" + __("Inverse") + ")";
50 label = "<span class=\"labelFixedLength\">" + label +
51 "</span>" + item.param[0]; */
55 getIconClass: function (item, opened) {
56 return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "invisible";
58 getLabelClass: function (item, opened) {
59 const enabled = this.model.store.getValue(item, 'enabled');
60 return (enabled != false) ? "dijitTreeLabel labelFixedLength" : "dijitTreeLabel labelFixedLength filterDisabled";
62 getRowClass: function (item, opened) {
63 return (!item.error || item.error == '') ? "dijitTreeRow" :
66 checkItemAcceptance: function(target, source, position) {
67 const item = dijit.getEnclosingWidget(target).item;
69 // disable copying items
70 source.copyState = function() { return false; };
72 return position != 'over';
74 onDndDrop: function() {
75 this.inherited(arguments);
76 this.tree.model.store.save();