appirits/comable

View on GitHub
backend/app/views/comable/admin/navigations/_navigation_item_fields.slim

Summary

Maintainability
Test Coverage
- link_selectable = f.object.linkable_exists?

fieldset.navigation-item class="#{'hidden' if f.object._destroy}"
  .row
    .col-sm-3
      = f.label :name
      = f.text_field :name

    .col-sm-3
      = f.label :linkable_type
      = f.select :linkable_type, linkable_type_options, {}, class: :linkable_type

    .col-sm-3.url class="#{'hidden' if link_selectable}"
      = f.label :url
      = f.text_field :url

    .col-sm-3.linkable_id class="#{'hidden' unless link_selectable}"
      = f.select :linkable_id, f.object.linkable_id_options

    .col-sm-3
      = f.hidden_field :_destroy, class: :destroy
      button.btn.btn-default.pull-right.remove_fields type="button"
        = Comable.t('actions.destroy')