Skip to content

Commit

Permalink
Merge pull request #11030 from spree/tidy-up-menu-views
Browse files Browse the repository at this point in the history
Tidy up the view for Menus new / edit form.
  • Loading branch information
damianlegawiec committed May 13, 2021
2 parents e8232b4 + fa11b45 commit 6e44b03
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
8 changes: 4 additions & 4 deletions backend/app/views/spree/admin/menus/_form.html.erb
Expand Up @@ -13,15 +13,15 @@
<% end %>
</div>
<div class="col-12 col-md-6">
<div class="form-group">
<%= f.field_container :menu_stores, class: ['form-group'] do %>
<%= label_tag :menu_stores, Spree.t(:stores) %>
<%= collection_select(:menu, :store_id, @stores, :id, :unique_name, {}, { class: 'select2' }) %>
<%= f.error_message_on :menu_stores %>
</div>
<div class="form-group">
<% end %>
<%= f.field_container :locale, class: ['form-group'] do %>
<%= f.label :locale %>
<%= f.select :locale, options_from_collection_for_select(all_locales_options, :last, :first, @menu.locale || I18n.locale), {}, { class: 'select2' } %>
<%= f.error_message_on :default_locale %>
</div>
<% end %>
</div>
</div>
2 changes: 1 addition & 1 deletion backend/app/views/spree/admin/menus/edit.html.erb
Expand Up @@ -6,7 +6,7 @@
<div class="col-12">
<div class="card mb-3">
<div class="card-header">
<h5>Settings</h5>
<h5 class="mb-0"><%= Spree.t('settings') %></h5>
</div>
<div class="card-body">
<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @menu } %>
Expand Down
24 changes: 18 additions & 6 deletions backend/app/views/spree/admin/menus/new.html.erb
Expand Up @@ -2,9 +2,21 @@
<%= link_to Spree.t('admin.navigation.all_menus'), spree.admin_menus_path %> / <%= Spree.t('admin.navigation.new_menu') %>
<% end %>

<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @menu } %>
<%= form_for [:admin, @menu] do |f| %>
<%= render partial: 'form', locals: { f: f } %>
<%= render partial: 'spree/admin/shared/new_resource_links' %>
<% end %>
<div class="row">
<div class="col-12">
<div class="card mb-3">
<div class="card-header">
<h5 class="mb-0"><%= Spree.t('settings') %></h5>
</div>
<div class="card-body">
<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @menu } %>
<%= form_for [:admin, @menu] do |f| %>
<%= render partial: 'form', locals: { f: f } %>
<div class="d-flex ">
<%= render partial: 'spree/admin/shared/new_resource_links' %>
</div>
<% end %>
</div>
</div>
</div>
</div>

0 comments on commit 6e44b03

Please sign in to comment.