app/views/spree/admin/taxons/_form.html.erb in spree_backend-4.3.3 vs app/views/spree/admin/taxons/_form.html.erb in spree_backend-4.4.0.rc1

- old
+ new

@@ -1,59 +1,103 @@ <div data-hook="admin_inside_taxon_form"> - <%= f.field_container :name, class: ['form-group'] do %> - <%= f.label :name, raw(Spree.t(:name) + required_span_tag) %> - <%= text_field :taxon, :name, class: 'form-control' %> - <%= f.error_message_on :name, class: 'error-message' %> - <% end %> + <div class="row"> + <div class="col-12 col-md-8"> + <%= f.field_container :name do %> + <%= f.label :name, raw(Spree.t(:name) + required_span_tag) %> + <%= text_field :taxon, :name, class: 'form-control', required: true %> + <%= f.error_message_on :name, class: 'error-message' %> + <% end %> + </div> - <%= f.field_container :permalink, class: ['form-group'] do %> - <%= label_tag :permalink_part, raw(Spree.t(:permalink) + required_span_tag) %> - <div class="input-group mb-3"> - <div class="input-group-prepend"> - <span class="input-group-text" id="basic-addon3"> - <%= [current_store.formatted_url, 't', @parent_permalink].join('/') %> - </span> - </div> - <%= text_field_tag :permalink_part, @permalink_part, class: 'form-control', required: true %> + <div class="col-12 col-md-4"> + <%= f.field_container :hide_from_nav, class: ['custom-control', 'custom-checkbox', 'my-4'] do %> + <%= f.check_box :hide_from_nav, class: 'custom-control-input' %> + <%= f.label :hide_from_nav, Spree.t(:hide_from_subcategories_nav), class: 'custom-control-label' %> + <%= f.error_message_on :hide_from_nav %> + <% end %> </div> - <% end %> - <%= f.field_container :hide_from_nav, class: ['form-group'] do %> - <%= f.label :hide_from_nav do %> - <%= Spree.t(:hide_from_subcategories_nav) %> - <br> - <%= f.check_box :hide_from_nav, { checked: @taxon.hide_from_nav } %> - <small><%= Spree.t(:say_yes) %></small> - <% end %> - <% end %> + <div class="col-12 col-md-8"> + <% unless @taxon.new_record? %> + <%= f.field_container :permalink do %> + <%= label_tag :permalink_part, raw(Spree.t(:permalink) + required_span_tag) %> + <div class="input-group mb-3"> + <div class="input-group-prepend"> + <span class="input-group-text"> + <%= [Spree::Config[:storefront_taxons_path] , @parent_permalink].join('/') %> + </span> + </div> + <%= text_field_tag :permalink_part, @permalink_part, class: 'form-control', required: true %> + </div> + <% end %> + <% end %> + </div> - <%= f.field_container :icon, class: ['form-group'] do %> - <%= f.label :icon, Spree.t(:header_banner) %> - <%= image_tag(main_app.url_for(@taxon.icon.try(:attachment)), class: 'w-100') if @taxon.icon %> - <%= f.file_field :icon %> - <% if @taxon.icon.present? %> - <%= link_to Spree.t(:remove_image), - remove_icon_admin_taxonomy_taxon_url(@taxonomy.id, @taxon.id), - method: :delete %> - <% end %> - <% end %> + <div class="col-12 col-md-4"> + <% if @taxon.new_record? %> + <% disabled = false %> + <% else %> + <% disabled = @taxon.root? %> + <% end %> + <%= f.field_container :parent_id do %> + <%= f.label :parent_id, Spree.t('admin.navigation.nested_under') %> + <%= f.select :parent_id, nested_set_options(@taxonomy.taxons, @taxon) {|i| "#{'-' * i.level} #{i.name}" }, { include_blank: false }, { class: 'select2', disabled: disabled } %> + <%= f.error_message_on :parent_id %> + <small class="form-text text-muted"> + <%= Spree.t('admin.taxon.nested_under_info') %> + </small> + <% end %> + </div> + </div> +<% unless @taxon.new_record? %> + <div class="row"> + <div class="col-12"> + <hr> + </div> + </div> - <%= f.field_container :description, class: ['form-group'] do %> - <%= f.label :description, Spree.t(:description) %> - <%= f.text_area :description, class: "form-control #{'spree-rte' if taxon_wysiwyg_editor_enabled? }", rows: 20 %> - <% end %> + <div class="row"> + <div class="col-12 col-md-8"> + <%= f.field_container :description do %> + <%= f.label :description, Spree.t(:description) %> + <%= f.text_area :description, class: "form-control #{'spree-rte' if taxon_wysiwyg_editor_enabled? }", rows: 14 %> + <% end %> + </div> - <%= f.field_container :meta_title, class: ['form-group'] do %> - <%= f.label :meta_title, Spree.t(:meta_title) %> - <%= f.text_field :meta_title, class: 'form-control', rows: 6 %> - <% end %> + <div class="col-12 col-md-4"> + <%= f.field_container :icon do %> + <%= f.label :icon, Spree.t(:header_banner), class: 'mb-3' %> + <%= image_tag(main_app.url_for(@taxon.icon.try(:attachment)), class: 'w-100') if @taxon.icon %> + <%= f.file_field :icon, class: 'mt-3' %> + <% if @taxon.icon.present? %> + <%= link_to Spree.t(:remove_image), remove_icon_admin_taxonomy_taxon_url(@taxonomy.id, @taxon.id), method: :delete %> + <% end %> + <% end %> + </div> + </div> - <%= f.field_container :meta_description, class: ['form-group'] do %> - <%= f.label :meta_description, Spree.t(:meta_description) %> - <%= f.text_area :meta_description, class: 'form-control', rows: 6 %> - <% end %> + <div class="row"> + <div class="col-12"> + <hr> + </div> + </div> - <%= f.field_container :meta_keywords, class: ['form-group'] do %> - <%= f.label :meta_keywords, Spree.t(:meta_keywords) %> - <%= f.text_field :meta_keywords, class: 'form-control', rows: 6 %> - <% end %> + <div class="row"> + <div class="col-12"> + <%= f.field_container :meta_title do %> + <%= f.label :meta_title, Spree.t(:meta_title) %> + <%= f.text_field :meta_title, class: 'form-control', rows: 6 %> + <% end %> + + <%= f.field_container :meta_description do %> + <%= f.label :meta_description, Spree.t(:meta_description) %> + <%= f.text_area :meta_description, class: 'form-control', rows: 6 %> + <% end %> + + <%= f.field_container :meta_keywords do %> + <%= f.label :meta_keywords, Spree.t(:meta_keywords) %> + <%= f.text_field :meta_keywords, class: 'form-control', rows: 6 %> + <% end %> + </div> + </div> +<% end %> </div>