Sha256: 96817fbeff7cb71f9008386a67aab62c8ac0ec6e969f54f513c5c52ff53ec879

Contents?: true

Size: 1.07 KB

Versions: 12

Compression:

Stored size: 1.07 KB

Contents

module ServerHelper

  def property_input(form, p)
    input_type = p.input_type # this must be before all other
    if p.translate
      collection = p.collection.map {|s|[t("collection.#{p.template}.#{s}"), s]}
    else
      collection = p.collection
    end
    return form.simple_fields_for(p) do |f|
      concat f.input  p.has_new_value? ? :new_value : :value,
                      :label  => t("server.key.#{p.key}"),
                      :as     => input_type,
                      :hint   => t("server.help.#{p.key}"),
                      :required => false,
                      :input_html => {
                        :multiple => p.multiple||false,
                        :name  => "property[#{p.id}]",
                        :id    => p.key
                      },
                      :wrapper_html => {
                        :id => "#{p.key}_input",
                        :class => (p.has_new_value? ? 'warning' : nil)
                      },
                      :collection => collection||[],
                      :include_blank => false
    end
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rmails-0.2.5 app/helpers/server_helper.rb
rmails-0.2.4 app/helpers/server_helper.rb
rmails-0.2.3 app/helpers/server_helper.rb
rmails-0.2.2 app/helpers/server_helper.rb
rmails-0.2.1 app/helpers/server_helper.rb
rmails-0.2.0 app/helpers/server_helper.rb
rmails-0.1.6 app/helpers/server_helper.rb
rmails-0.1.5 app/helpers/server_helper.rb
rmails-0.1.4 app/helpers/server_helper.rb
rmails-0.1.3 app/helpers/server_helper.rb
rmails-0.1.2 app/helpers/server_helper.rb
rmails-0.1.1 app/helpers/server_helper.rb