- id = nil unless defined? id - action = nil unless defined? action - klass = nil unless defined? klass - method = 'post' unless (defined?(method) and not method.nil?) - enctype = 'multipart/form-data' unless defined? enctype - info = {} unless defined? info - locals = {} unless defined? locals - bundle = false unless defined? bundle - klass = "#{klass} custom" - action = remove_GET_param(action, '__post_hash_id') if action - if defined?(description) and description .form_description =description %hr - info = info.dup %form.ui.form(class=klass action=action method=method id=id enctype=enctype) - inputs = consume_parameter(:inputs, info) || [] - types = consume_parameter(:input_types, info) || {} - defaults = consume_parameter(:input_defaults, info) || {} - descriptions = consume_parameter(:input_descriptions, info) || {} - use = consume_parameter(:input_use, info) || {} - options = consume_parameter(:input_options, info) || {} - values = consume_parameter(:values, info) || {} - workflows = use.values.collect{|i| i.keys}.flatten.collect{|v| v.to_s}.uniq - if workflows.length > 1 && use && use.any? - ws_id = 'workflow_select_' << id .ui.very.basic.segment .header Select workflow inputs to show .description .ui.buttons.workflow_select(id=ws_id) - workflows.each do |wfname| .ui.tiny.button.view_workflow.active= wfname %hr :sass form .ui.buttons.workflow_select margin-bottom: 2em :deferjs $('##{ws_id}').find('.view_workflow').click(function(){ var button = $(this); button.toggleClass('active') active_workflows = button.parent('.workflow_select').find('.view_workflow.active') $('##{id}').find('div.field[attr-use_tags]').hide() active_workflows.each(function(button){ var workflow = $(this).text() $('##{id}').find('div.field[attr-use_tags*=' + workflow + ']').show() }) }) - inputs.each do |input| - uses = use.nil? ? nil : use[input] - use_tags = [] - if uses - uses.each do |workflow, tasks| - tasks.each do |task| - use_tags << [workflow, task] * "#" - input_id = id.nil? ? nil : id + "__" << input.to_s - hide = (options[input] != nil and options[input][:hide]) %div(class="field #{types[input]} #{input} #{hide ? 'hide' : ''}" attr-use_tags='#{use_tags * " "}') - input_options = options[input] - input_options = input_options.dup unless input_options.nil? - description = descriptions[input] - if use[input] && description - description += "\n\nUsed in:\n" - uses.each do |workflow, tasks| - tasks.each do |task| - description << " * " << [workflow.to_s, task] * "#" << "\n" !~ form_input(input, types[input], defaults[input], values[input] || locals[input], description, input_id, input_options) - if bundle && inputs.any? .bundle.ui.very.basic.segment.field Input file bundle in tar.gz (overrides page inputs) %input(type='file' name='__input_file_bundle' id='SINTEF_ROC__input_file_bundle') .input.field.submit %input.ui.submit.button(type="submit") - if klass =~ /workflow_task/ %input.jobname(type='text' name='jobname' placeholder='optional job name' value="#{locals[:jobname]}") %select.format(name="_format") - [:html, :json, :raw, :binary].each do |format| %option(value=format)= format.to_s