Sha256: 6dca6134bfec0d86961c3eec5c496c52d918d591bdfe98ac0868bf5fcf629919

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

- options = {wrapper_html: {class: "col-md-#{field.size}"}}
- current_type = field_type(model_presenter,field.name)
- options[:as] = :admin_enum if current_type == :enum
- options[:as] = :admin_relationship_select if current_type == :relation
- options[:as] = :admin_date if current_type == :date
- options[:as] = field.as if field.as.present?
- options[:input_html] = {}
- options[:input_html][:class] = "field-#{field.name}"
- options[:input_html][:data] = {}
- options[:input_html][:data][:presenter_name] = model_presenter.presenter_name 

- if options[:as].is_a? Hash
  - options[:input_html][:data][:carnival_options] = options[:as].first[1]
  - options[:as] = options[:as].first[0]


- if field.depends_on.present?
  - options[:input_html][:data][:depends_on] = field.depends_on
  :javascript
    $(".field-#{field.depends_on}").change(function(event, element){
      updateDependentFormSelectHtml(element.selected, $(this).attr("name").match( /\[(.*)\]/)[1], $($(".field-#{field.name}").first()).attr("name").match( /\[(.*)\]/)[1]);
    });
= f.input field.name, options

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
carnival-0.0.59 app/views/carnival/shared/form/_field.html.haml
carnival-0.0.58 app/views/carnival/shared/form/_field.html.haml
carnival-0.0.57 app/views/carnival/shared/form/_field.html.haml