Files
galaxy/templates/form.mako
T
Martin Cech 9c89d43875 fix shared mako templates that would not work with TS
by also looking for 'app' within context when 'webapp' is not present
and defaulting to 'galaxy' afterwards
2015-06-04 10:31:44 -04:00

113 lines
3.3 KiB
Mako

<%!
def inherit(context):
if context.get('use_panels'):
if context.get('webapp'):
app_name = context.get('webapp')
elif context.get('app'):
app_name = context.get('app').name
else:
app_name = 'galaxy'
return '/webapps/%s/base_panels.mako' % app_name
else:
return '/base.mako'
%>
<%inherit file="${inherit(context)}"/>
<% _=n_ %>
<%def name="init()">
<%
self.has_left_panel=False
self.has_right_panel=False
self.active_view=active_view
self.message_box_visible=False
%>
</%def>
<%def name="title()">${form.title | h}</%def>
<%def name="javascripts()">
${parent.javascripts()}
${h.js("libs/jquery/jquery.autocomplete")}
<script type="text/javascript">
$(function(){
$("input:text:first").focus();
})
</script>
</%def>
<%def name="stylesheets()">
${parent.stylesheets()}
${h.css("autocomplete_tagging")}
</%def>
<%def name="center_panel()">
${render_form( )}
</%def>
<%def name="body()">
${render_form( )}
</%def>
<%def name="render_form()">
%if header:
${header}
%endif
<div class="form" style="margin: 1em">
<div class="form-title">${util.unicodify( form.title ) | h }</div>
<div class="form-body">
<%
has_file_input = False
for input in form.inputs:
if input.type == 'file':
has_file_input = True
break
%>
<form name="${form.name | h }" action="${form.action}" method="post"
%if has_file_input:
enctype="multipart/form-data"
%endif
>
%for input in form.inputs:
<%
cls = "form-row"
if input.error:
cls += " form-row-error"
%>
<div class="${cls}">
%if input.use_label:
<label>
${_(input.label) | h }:
</label>
%endif
<div class="form-row-input">
%if input.type == 'textarea':
<textarea name="${input.name | h }">${input.value | h }</textarea>
%elif input.type == 'select':
<select name="${input.name | h}">
%for (name, value) in input.options:
<option value="${value | h }">${name | h }</option>
%endfor
</select>
%else:
<input type="${input.type}" name="${input.name | h }" value="${input.value | h }">
%endif
</div>
%if input.error:
<div class="form-row-error-message">${input.error | h }</div>
%endif
%if input.help:
<div class="toolParamHelp" style="clear: both;">
${input.help | h}
</div>
%endif
<div style="clear: both"></div>
</div>
%endfor
<div class="form-row"><input type="submit" value="${form.submit_text}"></div>
</form>
</div>
</div>
</%def>