Sha256: 3605b2c094808430175d7226826f10b1c471d47ca58d451e38f3ac1ab8c6aa39

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

= form_for <%= model_name(:ivar) %> do |form|

  %dl.controls
<% wui.model.editable_attrs.each do |attribute| -%>
    %dt
      = form.label <%= attribute.name(:symbol) %>
    %dd
  <%- if attribute.assignable_values -%>
      = form.select <%= attribute.name(:symbol) %>, form.object.assignable_<%= attribute.name(:variables) %>
  <%- else -%>
    <%- case attribute.type -%>
    <%- when :string -%>
      = form.text_field <%= attribute.name(:symbol) %>
    <%- when :email -%>
      = form.email_field <%= attribute.name(:symbol) %>
    <%- when :password -%>
      = form.password_field <%= attribute.name(:symbol) %>
    <%- when :url -%>
      = form.url_field <%= attribute.name(:symbol) %>
    <%- when :integer -%>
      = form.number_field <%= attribute.name(:symbol) %>
    <%- when :money -%>
      = form.number_field <%= attribute.name(:symbol) %>
      €
    <%- when :text -%>
      = form.text_area <%= attribute.name(:symbol) %>, rows: 5
    <%- when :flag -%>
      = form.check_box <%= attribute.name(:symbol) %>
    <%- when :datetime -%>
      = form.date_field <%= attribute.name(:symbol) %>
    <%- end -%>
  <%- end -%>
<% end -%>

  .tools
    = form.submit 'Save', class: 'tools__button is_primary'
    - cancel_path = <%= model_name(:ivar) %>.new_record? ? <%= wui.path(:index) %> : <%= wui.path(:show, model_name(:ivar)) %>
    = link_to 'Cancel', cancel_path, class: 'tools__button'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
katapult-0.2.0 lib/generators/katapult/haml/templates/_form.html.haml