lib/rbbt/rest/common/forms.rb in rbbt-rest-1.8.70 vs lib/rbbt/rest/common/forms.rb in rbbt-rest-1.8.71

- old
+ new

@@ -21,10 +21,17 @@ html_tag("input", nil, :type => "file", :id => (id.nil? ? nil : id + "__" + "param_file"), :name => name.to_s + "__" + "param_file") + html_tag("span", text_area_string, :class => "file_or_text_area") + html_tag("textarea", value || "" , :name => name, :id => id ) end + def tar_file(id, name, value) + tar_msg = "File in tar.gz format with directory as only first level entry" + + html_tag("input", nil, :type => "file", :id => (id.nil? ? nil : id + "__" + "param_file"), :name => name.to_s + "__" + "param_file") + + html_tag("span", tar_msg, :class => "file_or_text_area") + end + def form_input(name, type, default = nil, current = nil, description = nil, id = nil, extra = {}) html_options = consume_parameter(:html_options, extra) || {} no_file = extra[:no_file] if extra @@ -136,10 +143,15 @@ options.unshift html_tag('option', 'none', :value => 'none', :selected => value.to_s == 'none') if allow_empty input_label(id, name, description, default, extra) + html_tag('select', options * "\n", html_options.merge(:name => name, :id => id, "attr-selected" => (value ? value.to_s : ""))) + when :directory + value = current.nil? ? default : current + + input_label(id, name, description, nil, extra) + + tar_file(id, name, value) else - "<span> Unsupported input #{name} #{type} </span>" + "<span> Unsupported input '#{name}' type: #{type} </span>" end end end