tt-rss/js/PrefLabelTree.js

44 lines
1.2 KiB
JavaScript
Raw Normal View History

require(["dojo/_base/declare", "lib/CheckBoxTree", "dijit/form/DropDownButton"], function (declare) {
2010-11-18 18:04:57 +01:00
return declare("fox.PrefLabelTree", lib.CheckBoxTree, {
setNameById: function (id, name) {
var item = this.model.store._itemsByIdentity['LABEL:' + id];
2010-11-18 18:04:57 +01:00
if (item)
this.model.store.setValue(item, 'name', name);
2010-11-18 18:04:57 +01:00
},
_createTreeNode: function(args) {
var tnode = this.inherited(arguments);
2010-11-18 18:04:57 +01:00
var fg_color = this.model.store.getValue(args.item, 'fg_color');
var bg_color = this.model.store.getValue(args.item, 'bg_color');
var type = this.model.store.getValue(args.item, 'type');
var bare_id = this.model.store.getValue(args.item, 'bare_id');
2010-11-18 18:04:57 +01:00
if (type == 'label') {
var span = dojo.doc.createElement('span');
span.innerHTML = 'α';
span.className = 'labelColorIndicator';
span.id = 'LICID-' + bare_id;
2010-11-18 18:04:57 +01:00
span.setStyle({
color: fg_color,
backgroundColor: bg_color});
2010-11-18 18:04:57 +01:00
tnode._labelIconNode = span;
2010-11-18 18:04:57 +01:00
dojo.place(tnode._labelIconNode, tnode.labelNode, 'before');
}
2010-11-18 18:04:57 +01:00
return tnode;
},
getIconClass: function (item, opened) {
return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "invisible";
},
});
2010-11-18 18:04:57 +01:00
});