From b13c5a97290c04601b8c069413fef584da018928 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Thu, 7 Jun 2012 13:04:50 -0400 Subject: broken commit. started working on editable category tree --- askbot/skins/common/media/js/post.js | 27 ++++++++++++++++++++++++--- askbot/skins/common/media/js/utils.js | 4 +++- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/askbot/skins/common/media/js/post.js b/askbot/skins/common/media/js/post.js index 7a21a46b..40773009 100644 --- a/askbot/skins/common/media/js/post.js +++ b/askbot/skins/common/media/js/post.js @@ -2715,6 +2715,27 @@ TagEditor.prototype.decorate = function(element) { }); }; +var Category = function() { + SelectBoxItem.call(this); + tihs._is_editable = false; +}; +inherits(Category, SelectBoxItem); + +Category.prototype.decorate = function(element) { + this.superClass_.decorate.call(this, element); +}; + +/** + * @constructor + * SelectBox subclass to create/edit/delete + * categories + */ +var CategorySelectBox = function() { + SelectBox.call(this); + this._item_class = Category; +}; +inherits(CategorySelectBox, SelectBox); + var CategorySelector = function() { WrappedElement.call(this); this._data = null; @@ -2810,19 +2831,19 @@ CategorySelector.prototype.decorate = function(element) { this._element = element; this._selectors = []; - var selector0 = new SelectBox(); + var selector0 = new CategorySelectBox(); selector0.decorate(element.find('.cat-col-0')); selector0.setSelectHandler(this.getSelectHandler(0)); this.maybeAddEditButton(selector0); this._selectors.push(selector0); - var selector1 = new SelectBox(); + var selector1 = new CategorySelectBox(); selector1.decorate(element.find('.cat-col-1')); selector1.setSelectHandler(this.getSelectHandler(1)); this.maybeAddEditButton(selector1); this._selectors.push(selector1) - var selector2 = new SelectBox(); + var selector2 = new CategorySelectBox(); selector2.decorate(element.find('.cat-col-2')); selector2.setSelectHandler(this.getSelectHandler(2)); this.maybeAddEditButton(selector2); diff --git a/askbot/skins/common/media/js/utils.js b/askbot/skins/common/media/js/utils.js index fcb22197..b4d08b2c 100644 --- a/askbot/skins/common/media/js/utils.js +++ b/askbot/skins/common/media/js/utils.js @@ -936,7 +936,9 @@ SelectBox.prototype.getItem = function(id){ } return undefined; }; - +/** + * this method sets css class to the item's DOM element + */ SelectBox.prototype.setItemClass = function(id, css_class) { this.getItem(id).getElement().addClass(css_class); }; -- cgit v1.2.3-1-g7c22