# HG changeset patch -- Bitbucket.org # Project galaxy-dist # URL http://bitbucket.org/galaxy/galaxy-dist/overview # User Kanwei Li <kanwei@gmail.com> # Date 1289929775 18000 # Node ID 394d8186f666b506cd0a93aefb7a079e0c9ec59b # Parent 1bf064c8ab88621dd58890f6cd56ad4900d10d6b tool_form: Make radio and select box labels explicitly inline. Workflow: add colons after parameter names where appropriate. Fixes #419 --- a/static/june_2007_style/base.css.tmpl +++ b/static/june_2007_style/base.css.tmpl @@ -210,6 +210,10 @@ div.form-row label { margin-bottom: .2em; } +div.form-row label.inline { + display: inline; +} + div.form-row-input { float: left; } --- a/templates/workflow/editor_tool_form.mako +++ b/templates/workflow/editor_tool_form.mako @@ -7,8 +7,8 @@ from galaxy.util.expressions import Expr <% ctx = ExpressionContext( values, ctx ) %> %for input_index, input in enumerate( inputs.itervalues() ): %if input.type == "repeat": - <div class="repeat-group"> - <div class="form-title-row"><b>${input.title_plural}</b></div> + <div class="repeat-group form-row"> + <label>${input.title_plural}:</label><% repeat_values = values[input.name] %> %for i in range( len( repeat_values ) ): <% @@ -19,7 +19,7 @@ from galaxy.util.expressions import Expr index = repeat_values[i]['__index__'] %><div class="repeat-group-item"> - <div class="form-title-row"><b>${input.title} ${i + 1}</b></div> + <div class="form-title-row"><label>${input.title} ${i + 1}</label></div> ${do_inputs( input.inputs, repeat_values[ i ], rep_errors, prefix + input.name + "_" + str(index) + "|", ctx )} <div class="form-row"><input type="submit" name="${prefix}${input.name}_${index}_remove" value="Remove ${input.title} ${i+1}"></div></div> @@ -63,7 +63,7 @@ from galaxy.util.expressions import Expr %else: %if isinstance( value, RuntimeValue ): <label> - ${param.get_label()} + ${param.get_label()}: <span class="popupmenu"><button type="submit" name="make_buildtime" value="${prefix}${param.name}">Set in advance</button></span> @@ -73,7 +73,7 @@ from galaxy.util.expressions import Expr </div> %else: <label> - ${param.get_label()} + ${param.get_label()}: %if allow_runtime: <span class="popupmenu"><button type="submit" name="make_runtime" value="${prefix}${param.name}">Set at runtime</button> --- a/lib/galaxy/web/form_builder.py +++ b/lib/galaxy/web/form_builder.py @@ -248,16 +248,16 @@ class SelectField(BaseField): >>> t.add_option( "tuti", 1 ) >>> t.add_option( "fruity", "x" ) >>> print t.get_html() - <div><input type="radio" name="foo" value="1" id="foo|1"><label for="foo|1">tuti</label></div> - <div><input type="radio" name="foo" value="x" id="foo|x"><label for="foo|x">fruity</label></div> + <div><input type="radio" name="foo" value="1" id="foo|1"><label class="inline" for="foo|1">tuti</label></div> + <div><input type="radio" name="foo" value="x" id="foo|x"><label class="inline" for="foo|x">fruity</label></div> >>> t = SelectField( "bar", multiple=True, display="checkboxes" ) >>> t.add_option( "automatic", 3 ) >>> t.add_option( "bazooty", 4, selected=True ) >>> print t.get_html() <div class="checkUncheckAllPlaceholder" checkbox_name="bar"></div> - <div><input type="checkbox" name="bar" value="3" id="bar|3"><label for="bar|3">automatic</label></div> - <div><input type="checkbox" name="bar" value="4" id="bar|4" checked='checked'><label for="bar|4">bazooty</label></div> + <div><input type="checkbox" name="bar" value="3" id="bar|3"><label class="inline" for="bar|3">automatic</label></div> + <div><input type="checkbox" name="bar" value="4" id="bar|4" checked='checked'><label class="inline" for="bar|4">bazooty</label></div> """ def __init__( self, name, multiple=None, display=None, refresh_on_change=False, refresh_on_change_values=[], size=None ): self.name = name @@ -302,7 +302,7 @@ class SelectField(BaseField): selected_text = "" if selected: selected_text = " checked='checked'" - rval.append( '<div%s><input type="checkbox" name="%s%s" value="%s" id="%s"%s%s><label for="%s">%s</label></div>' % \ + rval.append( '<div%s><input type="checkbox" name="%s%s" value="%s" id="%s"%s%s><label class="inline" for="%s">%s</label></div>' % \ ( style, prefix, self.name, escaped_value, uniq_id, selected_text, self.get_disabled_str( disabled ), uniq_id, text ) ) ctr += 1 return "\n".join( rval ) @@ -318,7 +318,7 @@ class SelectField(BaseField): selected_text = "" if selected: selected_text = " checked='checked'" - rval.append( '<div%s><input type="radio" name="%s%s"%s value="%s" id="%s"%s%s><label for="%s">%s</label></div>' % \ + rval.append( '<div%s><input type="radio" name="%s%s"%s value="%s" id="%s"%s%s><label class="inline" for="%s">%s</label></div>' % \ ( style, prefix, self.name, --- a/static/june_2007_style/blue/base.css +++ b/static/june_2007_style/blue/base.css @@ -39,6 +39,7 @@ div.form-title-row{padding:5px 10px;} div.repeat-group-item{border-left:solid #d8b365 5px;margin-left:10px;margin-bottom:10px;} div.form-row-error{background:#FFCCCC;} div.form-row label{font-weight:bold;display:block;margin-bottom:.2em;} +div.form-row label.inline{display:inline;} div.form-row-input{float:left;} div.form-row-input label{font-weight:normal;display:inline;} div.form-row-error-message{width:300px;float:left;color:red;font-weight:bold;padding:3px 0 0 1em;} --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -515,14 +515,14 @@ class SelectToolParameter( ToolParameter blah >>> print p.get_html() <div class="checkUncheckAllPlaceholder" checkbox_name="blah"></div> - <div><input type="checkbox" name="blah" value="x" id="blah|x"><label for="blah|x">I am X</label></div> - <div class="odd_row"><input type="checkbox" name="blah" value="y" id="blah|y" checked='checked'><label for="blah|y">I am Y</label></div> - <div><input type="checkbox" name="blah" value="z" id="blah|z" checked='checked'><label for="blah|z">I am Z</label></div> + <div><input type="checkbox" name="blah" value="x" id="blah|x"><label class="inline" for="blah|x">I am X</label></div> + <div class="odd_row"><input type="checkbox" name="blah" value="y" id="blah|y" checked='checked'><label class="inline" for="blah|y">I am Y</label></div> + <div><input type="checkbox" name="blah" value="z" id="blah|z" checked='checked'><label class="inline" for="blah|z">I am Z</label></div> >>> print p.get_html( value=["x","y"]) <div class="checkUncheckAllPlaceholder" checkbox_name="blah"></div> - <div><input type="checkbox" name="blah" value="x" id="blah|x" checked='checked'><label for="blah|x">I am X</label></div> - <div class="odd_row"><input type="checkbox" name="blah" value="y" id="blah|y" checked='checked'><label for="blah|y">I am Y</label></div> - <div><input type="checkbox" name="blah" value="z" id="blah|z"><label for="blah|z">I am Z</label></div> + <div><input type="checkbox" name="blah" value="x" id="blah|x" checked='checked'><label class="inline" for="blah|x">I am X</label></div> + <div class="odd_row"><input type="checkbox" name="blah" value="y" id="blah|y" checked='checked'><label class="inline" for="blah|y">I am Y</label></div> + <div><input type="checkbox" name="blah" value="z" id="blah|z"><label class="inline" for="blah|z">I am Z</label></div> >>> print p.to_param_dict_string( ["y", "z"] ) y,z """