commit/galaxy-central: guerler: Ui: Drilldown remove unnecessary index
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/f2267bbdd40a/ Changeset: f2267bbdd40a User: guerler Date: 2015-02-12 05:56:29+00:00 Summary: Ui: Drilldown remove unnecessary index Affected #: 3 files diff -r 63002499f23ea119d19f070876cc1b0a564cb757 -r f2267bbdd40a22d21c0ee5763e68ae3f04c6e702 client/galaxy/scripts/mvc/ui/ui-drilldown.js --- a/client/galaxy/scripts/mvc/ui/ui-drilldown.js +++ b/client/galaxy/scripts/mvc/ui/ui-drilldown.js @@ -57,8 +57,7 @@ // link data this.header_index = {}; - this.header_list = []; - + // attach event handler function attach($el, header_id) { var $button = $el.find('#button-' + header_id); @@ -104,6 +103,9 @@ $group.append($buttongroup); iterate($subgroup, level.options, new_header); $group.append($subgroup); + + // attach expand/collapse events + attach($group, header_id); } else { // append child options $group.append(self._templateOption({ @@ -119,16 +121,6 @@ var $tmpl = $('<div/>'); iterate($tmpl, options); - // merge index to create a non-duplicate list of headers - for (var i in this.header_index) { - this.header_list = _.uniq(this.header_list.concat(this.header_index[i])); - } - - // attach expand/collapse events - for (var i in this.header_list) { - attach($tmpl, this.header_list[i]); - } - // return template return $tmpl; }, diff -r 63002499f23ea119d19f070876cc1b0a564cb757 -r f2267bbdd40a22d21c0ee5763e68ae3f04c6e702 static/scripts/mvc/ui/ui-drilldown.js --- a/static/scripts/mvc/ui/ui-drilldown.js +++ b/static/scripts/mvc/ui/ui-drilldown.js @@ -57,8 +57,7 @@ // link data this.header_index = {}; - this.header_list = []; - + // attach event handler function attach($el, header_id) { var $button = $el.find('#button-' + header_id); @@ -104,6 +103,9 @@ $group.append($buttongroup); iterate($subgroup, level.options, new_header); $group.append($subgroup); + + // attach expand/collapse events + attach($group, header_id); } else { // append child options $group.append(self._templateOption({ @@ -119,16 +121,6 @@ var $tmpl = $('<div/>'); iterate($tmpl, options); - // merge index to create a non-duplicate list of headers - for (var i in this.header_index) { - this.header_list = _.uniq(this.header_list.concat(this.header_index[i])); - } - - // attach expand/collapse events - for (var i in this.header_list) { - attach($tmpl, this.header_list[i]); - } - // return template return $tmpl; }, diff -r 63002499f23ea119d19f070876cc1b0a564cb757 -r f2267bbdd40a22d21c0ee5763e68ae3f04c6e702 static/scripts/packed/mvc/ui/ui-drilldown.js --- a/static/scripts/packed/mvc/ui/ui-drilldown.js +++ b/static/scripts/packed/mvc/ui/ui-drilldown.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/ui/ui-options"],function(b,a){var c=a.BaseIcons.extend({initialize:function(d){d.type=d.display||"checkbox";d.multiple=(d.display=="checkbox");a.BaseIcons.prototype.initialize.call(this,d);this.initial=true},value:function(d){var k=a.BaseIcons.prototype.value.call(this,d);if(this.initial&&k!==null&&this.header_index){this.initial=false;var e=k;if(!$.isArray(e)){e=[e]}for(var g in e){var h=this.header_index[e[g]];for(var f in h){this._setState(h[f],true)}}}return k},_setState:function(d,e){var f=this.$("#button-"+d);var g=this.$("#subgroup-"+d);f.data("is_expanded",e);if(e){g.fadeIn("fast");f.removeClass("toggle-expand");f.addClass("toggle")}else{g.hide();f.removeClass("toggle");f.addClass("toggle-expand")}},_templateOptions:function(g){var f=this;this.header_index={};this.header_list=[];function e(k,i){var l=k.find("#button-"+i);l.on("click",function(){f._setState(i,!l.data("is_expanded"))})}function d(r,t,o){o=o||[];for(h in t){var k=t[h];var l=k.options.length>0;var q=o.slice(0);f.header_index[k.value]=q.slice(0);var s=$("<div/>");if(l){var n=b.uuid();var i=$('<span id="button-'+n+'" class="ui-drilldown-button form-toggle icon-button toggle-expand"/>');var m=$('<div id="subgroup-'+n+'" style="display: none; margin-left: 25px;"/>');q.push(n);var p=$("<div/>");p.append(i);p.append(f._templateOption({label:k.name,value:k.value}));s.append(p);d(m,k.options,q);s.append(m)}else{s.append(f._templateOption({label:k.name,value:k.value}))}r.append(s)}}var j=$("<div/>");d(j,g);for(var h in this.header_index){this.header_list=_.uniq(this.header_list.concat(this.header_index[h]))}for(var h in this.header_list){e(j,this.header_list[h])}return j},_template:function(d){return'<div class="ui-options-list drilldown-container" id="'+d.id+'"/>'}});return{View:c}}); \ No newline at end of file +define(["utils/utils","mvc/ui/ui-options"],function(b,a){var c=a.BaseIcons.extend({initialize:function(d){d.type=d.display||"checkbox";d.multiple=(d.display=="checkbox");a.BaseIcons.prototype.initialize.call(this,d);this.initial=true},value:function(d){var k=a.BaseIcons.prototype.value.call(this,d);if(this.initial&&k!==null&&this.header_index){this.initial=false;var e=k;if(!$.isArray(e)){e=[e]}for(var g in e){var h=this.header_index[e[g]];for(var f in h){this._setState(h[f],true)}}}return k},_setState:function(d,e){var f=this.$("#button-"+d);var g=this.$("#subgroup-"+d);f.data("is_expanded",e);if(e){g.fadeIn("fast");f.removeClass("toggle-expand");f.addClass("toggle")}else{g.hide();f.removeClass("toggle");f.addClass("toggle-expand")}},_templateOptions:function(g){var f=this;this.header_index={};function e(k,j){var l=k.find("#button-"+j);l.on("click",function(){f._setState(j,!l.data("is_expanded"))})}function d(r,t,o){o=o||[];for(i in t){var k=t[i];var l=k.options.length>0;var q=o.slice(0);f.header_index[k.value]=q.slice(0);var s=$("<div/>");if(l){var n=b.uuid();var j=$('<span id="button-'+n+'" class="ui-drilldown-button form-toggle icon-button toggle-expand"/>');var m=$('<div id="subgroup-'+n+'" style="display: none; margin-left: 25px;"/>');q.push(n);var p=$("<div/>");p.append(j);p.append(f._templateOption({label:k.name,value:k.value}));s.append(p);d(m,k.options,q);s.append(m);e(s,n)}else{s.append(f._templateOption({label:k.name,value:k.value}))}r.append(s)}}var h=$("<div/>");d(h,g);return h},_template:function(d){return'<div class="ui-options-list drilldown-container" id="'+d.id+'"/>'}});return{View:c}}); \ No newline at end of file Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org