Sha256: 60e3bb16b6a41dfc95ea93621461d47cb93a26a0b4b4c3251c84a5fdceff2537

Contents?: true

Size: 1.44 KB

Versions: 15

Compression:

Stored size: 1.44 KB

Contents

- options = {wrapper_html: {class: "col-md-#{field.size}"}}
- current_type = presenter.field_type(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.to_s =~ /^date(time)?$/
- 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] = 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
    $("select.field-#{field.depends_on}").change(function(event, element){
      var field = $(this).attr("name").match( /\[([A-Za-z_])*\]/g)[0].replace("[", "").replace("]", "");
      var dependentField = $($("select.field-#{field.name}").first()).attr("name").match( /\[([A-Za-z_])*\]/g)[0].replace("[", "").replace("]", "");
      updateDependentFormSelectHtml("#{presenter.load_dependent_select_options_path}", "#{presenter.class.name}", $(this).val(), field, dependentField);
    });

- options[:label] = translate_field(presenter, field)
- if options[:as] == :partial
  = render field.name.to_s, f: f, record: f.object
- else
  = f.input field.name, options

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
carnival-0.3.0 app/views/carnival/shared/form/_field.html.haml
carnival-0.2.8 app/views/carnival/shared/form/_field.html.haml
carnival-0.2.7 app/views/carnival/shared/form/_field.html.haml
carnival-0.2.6 app/views/carnival/shared/form/_field.html.haml
carnival-0.2.5 app/views/carnival/shared/form/_field.html.haml
carnival-0.2.4 app/views/carnival/shared/form/_field.html.haml
carnival-0.2.3 app/views/carnival/shared/form/_field.html.haml
carnival-0.1.10 app/views/carnival/shared/form/_field.html.haml
carnival-0.2.2 app/views/carnival/shared/form/_field.html.haml
carnival-0.2.1 app/views/carnival/shared/form/_field.html.haml
carnival-0.2.0 app/views/carnival/shared/form/_field.html.haml
carnival-0.1.9 app/views/carnival/shared/form/_field.html.haml
carnival-0.1.8 app/views/carnival/shared/form/_field.html.haml
carnival-0.1.7 app/views/carnival/shared/form/_field.html.haml
carnival-0.1.6 app/views/carnival/shared/form/_field.html.haml