<%- 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.type == :foreign_key -%> = form.collection_select <%= attribute.name(:symbol) %>, form.object.assignable_<%= attribute.name(:variables).sub(/_ids$/, 's') %>, :id, <%= attribute.associated_model.label_attr.name(:symbol) %>, { include_blank: true }, class: 'form-control' <% elsif 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'