Sha256: c08a954bee4bdf06db6c4984c032542c1ee72427dbdf69d00cffb39de107f6cd

Contents?: true

Size: 1.91 KB

Versions: 1

Compression:

Stored size: 1.91 KB

Contents

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

<% web_ui.model.editable_attrs.each do |attribute| -%>
  .form-group
    = form.label <%= attribute.name(:symbol) %>
  <%- 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) %>, class: 'form-control'
    <%- when :email -%>
    = form.email_field <%= attribute.name(:symbol) %>, class: 'form-control'
    <%- when :password -%>
    = form.password_field <%= attribute.name(:symbol) %>, class: 'form-control',
      autocomplete: 'new-password'
    <%- when :url -%>
    = form.url_field <%= attribute.name(:symbol) %>, class: 'form-control'
    <%- when :integer -%>
    = form.number_field <%= attribute.name(:symbol) %>, class: 'form-control'
    <%- when :money -%>
    .input-group
      = form.number_field <%= attribute.name(:symbol) %>, class: 'form-control'
      .input-group-addon
        €
    <%- when :text -%>
    = form.text_area <%= attribute.name(:symbol) %>, rows: 5, class: 'form-control'
    <%- when :flag -%>
    .checkbox
      = form.label <%= attribute.name(:symbol) %> do
        = form.check_box <%= attribute.name(:symbol) %>
    <%- when :datetime -%>
    = form.date_field <%= attribute.name(:symbol) %>, class: 'form-control'
    <%- end -%>
  <%- end -%>
<% end -%>

  .action-bar
    - cancel_path = <%= object %>.new_record? ? <%= web_ui.path(:index) %> : <%= web_ui.path(:show, object) %>

    .pull-right
      - if <%= object %>.persisted?
        = link_to "Destroy <%= model_name(:human) %>", <%= web_ui.path(:destroy, object) %>, method: :delete,
          class: 'btn btn-danger', data: { confirm: 'Really destroy?' }

    = form.submit 'Save', class: 'btn btn-primary'
    = link_to 'Cancel', cancel_path, class: 'btn btn-link'

Version data entries

1 entries across 1 versions & 1 rubygems

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