ivanzotov/constructor

View on GitHub
pages/app/views/constructor_pages/templates/_form.html.slim

Summary

Maintainability
Test Coverage
= form_for @template, html: {class: 'b-form'} do |f|
  - if @template.errors.any?
    = link_to '×', '#', class: 'close', 'data-dismiss' => 'alert'
    - @template.errors.full_messages.each do |m|
      = m

  .b-form__row
    = f.label :name, class: 'b-form__label'
    = f.text_field :name, class: 'b-form__field'

  .b-form__row
    = f.label :code_name, class: 'b-form__label'
    = f.text_field :code_name, class: 'b-form__field'

  - unless @template.new_record?
    .b-form__row
      .b-form__label
      = link_to new_template_field_path(@template), class: 'b-button b-button_color_light b-button_size_small' do
        =t :new_field

    = render @template.fields

  .b-form__actions
    = f.submit class: 'b-button'
    = link_to t(:cancel), templates_url, class: 'b-button b-button_color_light'
    = link_to t(:delete_template), @template, method: :delete, data: {confirm: t(:are_you_sure?)},  class: 'b-button b-button_color_light g-float_right' unless @template.new_record?