%def name="render_template_field( field, render_as_hidden=False )"> <% from galaxy.web.form_builder import AddressField, CheckboxField, SelectField, TextArea, TextField, WorkflowField widget = field[ 'widget' ] has_contents = False label = field[ 'label' ] value = '' if isinstance( widget, TextArea ) and widget.value: has_contents = True if render_as_hidden: value = widget.value else: value = '
%s' % widget.value elif isinstance( widget, TextField ) and widget.value: has_contents = True value = widget.value elif isinstance( widget, SelectField ) and widget.options: for option_label, option_value, selected in widget.options: if selected: has_contents = True value = option_value elif isinstance( widget, CheckboxField ) and widget.checked: has_contents = True if render_as_hidden: value = 'true' else: value = 'checked' elif isinstance( widget, WorkflowField ) and str( widget.value ).lower() not in [ 'none' ]: has_contents = True if render_as_hidden: value = widget.value else: workflow_user = widget.user if workflow_user: for workflow in workflow_user.stored_workflows: if not workflow.deleted and str( widget.value ) == str( workflow.id ): value = workflow.name break else: # If we didn't find the selected workflow option above, we'll just print the value value = widget.value elif isinstance( widget, AddressField ) and str( widget.value ).lower() not in [ 'none' ]: has_contents = True if render_as_hidden: value = widget.value else: address = trans.sa_session.query( trans.model.UserAddress ).get( int( widget.value ) ) label = address.desc value = address.get_html() %> %if has_contents: % if render_as_hidden: %else: