commit/galaxy-central: guerler: Ui: Add default color
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/d34fb2d38b99/ Changeset: d34fb2d38b99 User: guerler Date: 2015-02-13 01:02:59+00:00 Summary: Ui: Add default color Affected #: 4 files diff -r bcb29996bd53620fcb724e1ac25c17f01ee568b8 -r d34fb2d38b99ca9f5d4db79edf9a0cd01dc4c7f4 client/galaxy/scripts/mvc/ui/ui-color-picker.js --- a/client/galaxy/scripts/mvc/ui/ui-color-picker.js +++ b/client/galaxy/scripts/mvc/ui/ui-color-picker.js @@ -15,7 +15,6 @@ // default options optionsDefault: { - default_color: '#fdeada' }, // initialize @@ -62,19 +61,17 @@ value : function (new_val) { if (new_val !== undefined) { // set default value - if (new_val === null) { - new_val = this.options.default_color; + if (new_val !== null) { + // update color value + this.$value.css('background-color', new_val); + + // check selected color in panel + this.$('.ui-color-picker-box').empty(); + this.$(this._getValue()).html(this._templateCheck()); + + // trigger custom event + this.options.onchange && this.options.onchange(new_val); } - - // update color value - this.$value.css('background-color', new_val); - - // check selected color in panel - this.$('.ui-color-picker-box').empty(); - this.$(this._getValue()).html(this._templateCheck()); - - // trigger custom event - this.options.onchange && this.options.onchange(new_val); } // return current value diff -r bcb29996bd53620fcb724e1ac25c17f01ee568b8 -r d34fb2d38b99ca9f5d4db79edf9a0cd01dc4c7f4 lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -655,7 +655,7 @@ def __init__( self, tool, input_source ): input_source = ensure_input_source( input_source ) ToolParameter.__init__( self, tool, input_source ) - self.value = input_source.get( 'value' ) + self.value = input_source.get( 'value', '#fdeada' ) def get_html_field( self, trans=None, value=None, other_values={} ): return form_builder.HiddenField( self.name, self.value ) diff -r bcb29996bd53620fcb724e1ac25c17f01ee568b8 -r d34fb2d38b99ca9f5d4db79edf9a0cd01dc4c7f4 static/scripts/mvc/ui/ui-color-picker.js --- a/static/scripts/mvc/ui/ui-color-picker.js +++ b/static/scripts/mvc/ui/ui-color-picker.js @@ -15,7 +15,6 @@ // default options optionsDefault: { - default_color: '#fdeada' }, // initialize @@ -62,19 +61,17 @@ value : function (new_val) { if (new_val !== undefined) { // set default value - if (new_val === null) { - new_val = this.options.default_color; + if (new_val !== null) { + // update color value + this.$value.css('background-color', new_val); + + // check selected color in panel + this.$('.ui-color-picker-box').empty(); + this.$(this._getValue()).html(this._templateCheck()); + + // trigger custom event + this.options.onchange && this.options.onchange(new_val); } - - // update color value - this.$value.css('background-color', new_val); - - // check selected color in panel - this.$('.ui-color-picker-box').empty(); - this.$(this._getValue()).html(this._templateCheck()); - - // trigger custom event - this.options.onchange && this.options.onchange(new_val); } // return current value diff -r bcb29996bd53620fcb724e1ac25c17f01ee568b8 -r d34fb2d38b99ca9f5d4db79edf9a0cd01dc4c7f4 static/scripts/packed/mvc/ui/ui-color-picker.js --- a/static/scripts/packed/mvc/ui/ui-color-picker.js +++ b/static/scripts/packed/mvc/ui/ui-color-picker.js @@ -1,1 +1,1 @@ -define(["utils/utils","mvc/ui/ui-misc"],function(a,b){return Backbone.View.extend({colors:{standard:["c00000","ff0000","ffc000","ffff00","92d050","00b050","00b0f0","0070c0","002060","7030a0"],base:["ffffff","000000","eeece1","1f497d","4f81bd","c0504d","9bbb59","8064a2","4bacc6","f79646"],theme:[["f2f2f2","7f7f7f","ddd9c3","c6d9f0","dbe5f1","f2dcdb","ebf1dd","e5e0ec","dbeef3","fdeada"],["d8d8d8","595959","c4bd97","8db3e2","b8cce4","e5b9b7","d7e3bc","ccc1d9","b7dde8","fbd5b5"],["bfbfbf","3f3f3f","938953","548dd4","95b3d7","d99694","c3d69b","b2a2c7","92cddc","fac08f"],["a5a5a5","262626","494429","17365d","366092","953734","76923c","5f497a","31859b","e36c09"],["7f7f7e","0c0c0c","1d1b10","0f243e","244061","632423","4f6128","3f3151","205867","974806"]]},optionsDefault:{default_color:"#fdeada"},initialize:function(d){this.options=a.merge(d,this.optionsDefault);this.setElement(this._template());this.$panel=this.$(".ui-color-picker-panel");this.$view=this.$(".ui-color-picker-view");this.$value=this.$(".ui-color-picker-value");this.$header=this.$(".ui-color-picker-header");this._build();this.visible=false;this.value(this.options.value);this.$boxes=this.$(".ui-color-picker-box");var c=this;this.$boxes.on("click",function(){c.value($(this).css("background-color"))});this.$header.on("click",function(){c.visible=!c.visible;if(c.visible){c.$view.fadeIn("fast")}else{c.$view.hide()}})},value:function(c){if(c!==undefined){if(c===null){c=this.options.default_color}this.$value.css("background-color",c);this.$(".ui-color-picker-box").empty();this.$(this._getValue()).html(this._templateCheck());this.options.onchange&&this.options.onchange(c)}return this._getValue()},_getValue:function(){var c=this.$value.css("background-color");c=c.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(c){function d(e){return("0"+parseInt(e).toString(16)).slice(-2)}return"#"+d(c[1])+d(c[2])+d(c[3])}else{return null}},_build:function(){var d=this._content({label:"Theme Colors",colors:this.colors.base,padding:10});for(var e in this.colors.theme){var c={};if(e==0){c.bottom=true}else{if(e!=this.colors.theme.length-1){c.top=true;c.bottom=true}else{c.top=true;c.padding=5}}c.colors=this.colors.theme[e];this._content(c)}this._content({label:"Standard Colors",colors:this.colors.standard,padding:5})},_content:function(n){var l=n.label;var d=n.colors;var k=n.padding;var h=n.top;var c=n.bottom;var f=$(this._templateContent());var j=f.find(".label");if(n.label){j.html(n.label)}else{j.hide()}var m=f.find(".line");this.$panel.append(f);for(var g in d){var e=$(this._templateBox(d[g]));if(h){e.css("border-top","none");e.css("border-top-left-radius","0px");e.css("border-top-right-radius","0px")}if(c){e.css("border-bottom","none");e.css("border-bottom-left-radius","0px");e.css("border-bottom-right-radius","0px")}m.append(e)}if(k){m.css("padding-bottom",k)}return f},_templateCheck:function(){return'<div class="ui-color-picker-check fa fa-check"/>'},_templateContent:function(){return'<div class="ui-color-picker-content"><div class="label"/><div class="line"/></div>'},_templateBox:function(c){return'<div id="'+c+'" class="ui-color-picker-box" style="background-color: #'+c+';"/>'},_template:function(){return'<div class="ui-color-picker"><div class="ui-color-picker-header"><div class="ui-color-picker-value"/><div class="ui-color-picker-label">Select a color</div></div><div class="ui-color-picker-view ui-input"><div class="ui-color-picker-panel"/></div>';"</div>"}})}); \ No newline at end of file +define(["utils/utils","mvc/ui/ui-misc"],function(a,b){return Backbone.View.extend({colors:{standard:["c00000","ff0000","ffc000","ffff00","92d050","00b050","00b0f0","0070c0","002060","7030a0"],base:["ffffff","000000","eeece1","1f497d","4f81bd","c0504d","9bbb59","8064a2","4bacc6","f79646"],theme:[["f2f2f2","7f7f7f","ddd9c3","c6d9f0","dbe5f1","f2dcdb","ebf1dd","e5e0ec","dbeef3","fdeada"],["d8d8d8","595959","c4bd97","8db3e2","b8cce4","e5b9b7","d7e3bc","ccc1d9","b7dde8","fbd5b5"],["bfbfbf","3f3f3f","938953","548dd4","95b3d7","d99694","c3d69b","b2a2c7","92cddc","fac08f"],["a5a5a5","262626","494429","17365d","366092","953734","76923c","5f497a","31859b","e36c09"],["7f7f7e","0c0c0c","1d1b10","0f243e","244061","632423","4f6128","3f3151","205867","974806"]]},optionsDefault:{},initialize:function(d){this.options=a.merge(d,this.optionsDefault);this.setElement(this._template());this.$panel=this.$(".ui-color-picker-panel");this.$view=this.$(".ui-color-picker-view");this.$value=this.$(".ui-color-picker-value");this.$header=this.$(".ui-color-picker-header");this._build();this.visible=false;this.value(this.options.value);this.$boxes=this.$(".ui-color-picker-box");var c=this;this.$boxes.on("click",function(){c.value($(this).css("background-color"))});this.$header.on("click",function(){c.visible=!c.visible;if(c.visible){c.$view.fadeIn("fast")}else{c.$view.hide()}})},value:function(c){if(c!==undefined){if(c!==null){this.$value.css("background-color",c);this.$(".ui-color-picker-box").empty();this.$(this._getValue()).html(this._templateCheck());this.options.onchange&&this.options.onchange(c)}}return this._getValue()},_getValue:function(){var c=this.$value.css("background-color");c=c.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(c){function d(e){return("0"+parseInt(e).toString(16)).slice(-2)}return"#"+d(c[1])+d(c[2])+d(c[3])}else{return null}},_build:function(){var d=this._content({label:"Theme Colors",colors:this.colors.base,padding:10});for(var e in this.colors.theme){var c={};if(e==0){c.bottom=true}else{if(e!=this.colors.theme.length-1){c.top=true;c.bottom=true}else{c.top=true;c.padding=5}}c.colors=this.colors.theme[e];this._content(c)}this._content({label:"Standard Colors",colors:this.colors.standard,padding:5})},_content:function(n){var l=n.label;var d=n.colors;var k=n.padding;var h=n.top;var c=n.bottom;var f=$(this._templateContent());var j=f.find(".label");if(n.label){j.html(n.label)}else{j.hide()}var m=f.find(".line");this.$panel.append(f);for(var g in d){var e=$(this._templateBox(d[g]));if(h){e.css("border-top","none");e.css("border-top-left-radius","0px");e.css("border-top-right-radius","0px")}if(c){e.css("border-bottom","none");e.css("border-bottom-left-radius","0px");e.css("border-bottom-right-radius","0px")}m.append(e)}if(k){m.css("padding-bottom",k)}return f},_templateCheck:function(){return'<div class="ui-color-picker-check fa fa-check"/>'},_templateContent:function(){return'<div class="ui-color-picker-content"><div class="label"/><div class="line"/></div>'},_templateBox:function(c){return'<div id="'+c+'" class="ui-color-picker-box" style="background-color: #'+c+';"/>'},_template:function(){return'<div class="ui-color-picker"><div class="ui-color-picker-header"><div class="ui-color-picker-value"/><div class="ui-color-picker-label">Select a color</div></div><div class="ui-color-picker-view ui-input"><div class="ui-color-picker-panel"/></div>';"</div>"}})}); \ 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