Sha256: c24c5b25abad7042c183413183fc91ab473bd0776af5760c9e3bb819d3f56e84

Contents?: true

Size: 1.38 KB

Versions: 3

Compression:

Stored size: 1.38 KB

Contents

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

  %dl.controls
<% wui.model.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 :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 :markdown -%>
      = form.text_area <%= attribute.name(:symbol) %>, rows: 15
    <%- when :flag -%>
      = form.check_box <%= attribute.name(:symbol) %>
    <%- when :datetime -%>
      = form.datetime_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

3 entries across 3 versions & 1 rubygems

Version Path
katapult-0.1.2 lib/generators/katapult/haml/templates/_form.html.haml
katapult-0.1.1 lib/generators/katapult/haml/templates/_form.html.haml
katapult-0.1.0 lib/generators/katapult/haml/templates/_form.html.haml