From 52667b6ab0ac04b8f90b09d1485cf27dfbd73f06 Mon Sep 17 00:00:00 2001 From: Krzysztof Kalisz Date: Tue, 25 Sep 2018 14:26:48 +0200 Subject: [PATCH 1/3] Migrate to bootstrap 4 --- .../add_pages_to_admin_sidebar_menu.rb | 4 +- app/views/spree/admin/pages/_form.html.erb | 46 +++++++++---------- app/views/spree/admin/pages/index.html.erb | 2 +- .../admin/shared/_pages_sidebar_menu.html.erb | 2 +- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/app/overrides/add_pages_to_admin_sidebar_menu.rb b/app/overrides/add_pages_to_admin_sidebar_menu.rb index 182e79d2..4e2a19a2 100644 --- a/app/overrides/add_pages_to_admin_sidebar_menu.rb +++ b/app/overrides/add_pages_to_admin_sidebar_menu.rb @@ -1,6 +1,6 @@ Deface::Override.new( - virtual_path: 'spree/layouts/admin', + virtual_path: 'spree/admin/shared/_main_menu', name: 'pages_admin_sidebar_menu', - insert_bottom: '#main-sidebar', + insert_bottom: 'nav', partial: 'spree/admin/shared/pages_sidebar_menu' ) diff --git a/app/views/spree/admin/pages/_form.html.erb b/app/views/spree/admin/pages/_form.html.erb index ec603c46..115e741f 100644 --- a/app/views/spree/admin/pages/_form.html.erb +++ b/app/views/spree/admin/pages/_form.html.erb @@ -4,7 +4,7 @@ <%= form_for [:admin, resource] do |f| %>
-
+
<%= f.label :title %> * <%= f.text_field :title, class: 'form-control' %> @@ -24,7 +24,7 @@
-
+
<%= f.label :layout %> <%= f.text_field :layout, class: 'form-control' %> @@ -40,47 +40,47 @@ <%= f.number_field :position, min: 0, class: 'form-control' %>
-
- <%= f.label :show_in_sidebar do %> - <%= f.check_box :show_in_sidebar %> +
+ <%= f.label :show_in_sidebar, { class: 'form-check-label' } do %> + <%= f.check_box :show_in_sidebar, { class: 'form-check-input' } %> <%= Spree::Page.human_attribute_name(:show_in_sidebar) %> <% end %>
-
- <%= f.label :show_in_header do %> - <%= f.check_box :show_in_header %> +
+ <%= f.label :show_in_header, { class: 'form-check-label' } do %> + <%= f.check_box :show_in_header, { class: 'form-check-input' } %> <%= Spree::Page.human_attribute_name(:show_in_header) %> <% end %>
-
- <%= f.label :show_in_footer do %> - <%= f.check_box :show_in_footer %> +
+ <%= f.label :show_in_footer, { class: 'form-check-label' } do %> + <%= f.check_box :show_in_footer, { class: 'form-check-input' } %> <%= Spree::Page.human_attribute_name(:show_in_footer) %> <% end %>
-
- <%= f.label :visible do %> - <%= f.check_box :visible %> +
+ <%= f.label :visible, { class: 'form-check-label' } do %> + <%= f.check_box :visible, { class: 'form-check-input' }%> <%= Spree::Page.human_attribute_name(:visible) %> <% end %>
-
- <%= f.label :render_layout_as_partial do %> - <%= f.check_box :render_layout_as_partial %> +
+ <%= f.label :render_layout_as_partial, { class: 'form-check-label' } do %> + <%= f.check_box :render_layout_as_partial, { class: 'form-check-input' } %> <%= Spree::Page.human_attribute_name(:render_layout_as_partial) %> <% end %>
-
+
<%= f.label :stores, plural_resource_name(Spree::Store) %> <% Spree::Store.all.each do |store| %> -
- <%= f.label store.name.downcase.to_sym do %> - <%= check_box_tag 'page[store_ids][]', store.id, @page.stores.include?(store) %> +
+ <%= f.label store.name.downcase.to_sym, { class: 'form-check-label' } do %> + <%= check_box_tag 'page[store_ids][]', store.id, @page.stores.include?(store), { class: 'form-check-input' } %> <%= store.name %> <% end %>
@@ -90,7 +90,7 @@
-
+
<%= f.label :meta_title %> <%= f.text_field :meta_title, class: 'form-control' %> @@ -112,7 +112,7 @@
-
+
<%= render "spree/admin/shared/#{resource.new_record? ? 'new' : 'edit'}_resource_links" %> diff --git a/app/views/spree/admin/pages/index.html.erb b/app/views/spree/admin/pages/index.html.erb index 30da5638..666089bd 100644 --- a/app/views/spree/admin/pages/index.html.erb +++ b/app/views/spree/admin/pages/index.html.erb @@ -31,7 +31,7 @@ <%= link_to_edit page, no_text: true %> <% if defined?(SpreeGlobalize) %> - <%= link_to '', spree.admin_translations_path('page', page.id), class: 'btn btn-primary btn-sm icon icon-translate with-tip', data: { 'original-title' => Spree.t(:'i18n.translations') } %> + <%= link_to content_tag(:span, '', class: 'icon icon-translate'), spree.admin_translations_path('page', page.id), class: 'btn btn-primary btn-sm icon-link with-tip', data: { 'original-title' => Spree.t(:'i18n.translations') } %> <% end %> <%= link_to_delete page, no_text: true %> diff --git a/app/views/spree/admin/shared/_pages_sidebar_menu.html.erb b/app/views/spree/admin/shared/_pages_sidebar_menu.html.erb index 865efc7e..b8532e3d 100644 --- a/app/views/spree/admin/shared/_pages_sidebar_menu.html.erb +++ b/app/views/spree/admin/shared/_pages_sidebar_menu.html.erb @@ -1,5 +1,5 @@ <% if can? :admin, Spree::Page %> -