ivanzotov/constructor

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

Summary

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

  .b-form__row
    = f.label :active, class: 'b-form__label'
    = f.check_box :active

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

  .b-form__row.auto_url
    = f.label :auto_url, class: 'b-form__label'
    = f.check_box :auto_url

  .b-form__row.url
    = f.label :url, class: 'b-form__label'
    .b-inline.b-full-url
      span.b-full-url__path
        = @page.parent.full_url if @page.parent
      | /
      span.b-full-url__url= @page.url
      = f.text_field :url, class: 'b-form__field'
      i.fa.fa-pencil.b-full-url__icon

  = render partial: 'field', collection: @page.fields

  - if @page.new_record?
    .b-form__row
      = f.label :template_id, class: 'b-form__label'
      = f.select :template_id,  options_for_select(templates_tree(@templates), selected: @page.template_id)

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

  .b-form__row
    label.b-form__label
      =t :display_in

    label for='in_menu'
    = f.check_box :in_menu
    =t :menu

    label for='in_map'
    = f.check_box :in_map
    =t :sitemap

    label for='in_nav'
    = f.check_box :in_nav
    =t :breadcrumbs

    label for='in_url'
    = f.check_box :in_url
    =t :url

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


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

  .b-form__row
    = f.label :description, class: 'b-form__label'
    = f.text_area :description, class: 'b-form__field', rows: 8

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