From b7ed330670a3a0a16698e87d7781f2e558dcf42a Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 6 Jun 2012 04:05:21 +0000 Subject: [PATCH] Handle any set select options --- etemplate/js/et2_widget_selectAccount.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/etemplate/js/et2_widget_selectAccount.js b/etemplate/js/et2_widget_selectAccount.js index eb3ff7820a..d392596200 100644 --- a/etemplate/js/et2_widget_selectAccount.js +++ b/etemplate/js/et2_widget_selectAccount.js @@ -485,20 +485,28 @@ var et2_selectAccount_ro = et2_link_string.extend([et2_IDetachedDOM], { this.list.removeClass("et2_link_string").addClass("et2_selectbox"); }, + transformAttributes: function(_attrs) { + et2_selectbox.prototype.transformAttributes.apply(this, arguments); + }, + set_value: function(_value) { this._super.apply(this, arguments); // Don't make it look like a link though jQuery('li',this.list).removeClass("et2_link et2_link_string"); - // Empty label from selectbox - if(this.options.empty_label) + if(this.options.select_options && this.options.select_options[_value] || this.options.empty_label) { if(!_value) { + // Empty label from selectbox this.list.append("
  • "+this.options.empty_label+"
  • "); } - else + else if (this.options.select_options[_value]) + { + this.list.append("
  • "+this.options.select_options[_value]+"
  • "); + } + else if (typeof _value == 'object') { // An array with 0 / empty in it? for(var i = 0; i < _value.length; i++) @@ -508,6 +516,10 @@ var et2_selectAccount_ro = et2_link_string.extend([et2_IDetachedDOM], { this.list.append("
  • "+this.options.empty_label+"
  • "); return; } + else if (this.options.select_options[_value]) + { + this.list.append("
  • "+this.options.select_options[_value]+"
  • "); + } } } }