1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 22:35:55 +00:00

update label editor

This commit is contained in:
Andrew Dolgov
2010-11-18 20:04:57 +03:00
parent e8c20f9262
commit fb8b2153ac
4 changed files with 241 additions and 291 deletions

51
PrefLabelTree.js Normal file
View File

@@ -0,0 +1,51 @@
dojo.provide("fox.PrefLabelTree");
dojo.require("lib.CheckBoxTree");
dojo.require("dijit.form.DropDownButton");
dojo.declare("fox.PrefLabelTree", lib.CheckBoxTree, {
setNameById: function (id, name) {
var item = this.model.store._itemsByIdentity['LABEL:' + id];
if (item)
this.model.store.setValue(item, 'name', name);
},
_createTreeNode: function(args) {
var tnode = this.inherited(arguments);
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');
if (type == 'label') {
var span = dojo.doc.createElement('span');
span.innerHTML = 'α';
span.className = 'labelColorIndicator2';
span.id = 'LICID-' + bare_id;
span.setStyle({
color: fg_color,
backgroundColor: bg_color});
tnode._labelIconNode = span;
dojo.place(tnode._labelIconNode, tnode.labelNode, 'before');
}
return tnode;
},
getIconClass: function (item, opened) {
return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "invisible";
},
onClick: function (item) {
var id = String(item.id);
var bare_id = id.substr(id.indexOf(':')+1);
if (id.match('LABEL:')) {
editLabel(bare_id, event);
}
},
});