From 196a301133217c0c4b443c5b6dfc88359beab576 Mon Sep 17 00:00:00 2001 From: Hugo Daniel Date: Wed, 24 Jul 2019 14:38:20 +0200 Subject: [PATCH 1/4] Import payment_methods/index.html.erb from spree_backend to ofn --- .../admin/payment_methods/index.html.erb | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 app/views/spree/admin/payment_methods/index.html.erb diff --git a/app/views/spree/admin/payment_methods/index.html.erb b/app/views/spree/admin/payment_methods/index.html.erb new file mode 100644 index 0000000000..ae51e60da5 --- /dev/null +++ b/app/views/spree/admin/payment_methods/index.html.erb @@ -0,0 +1,52 @@ +<%= render :partial => 'spree/admin/shared/configuration_menu' %> + +<% content_for :page_title do %> + <%= Spree.t(:payment_methods) %> +<% end %> + +<% content_for :page_actions do %> +
  • + <%= button_link_to Spree.t(:new_payment_method), new_object_url, :icon => 'icon-plus', :id => 'admin_new_payment_methods_link' %> +
  • +<% end %> + +<% if @payment_methods.any? %> + + + + + + + + + + + + + + + + + + + + + <% @payment_methods.each do |method|%> + + + + + + + + + <% end %> + +
    <%= Spree.t(:name) %><%= Spree.t(:provider) %><%= Spree.t(:environment) %><%= Spree.t(:display) %><%= Spree.t(:active) %>
    <%= method.name %><%= method.type %><%= method.environment.to_s.titleize %><%= method.display_on.blank? ? Spree.t(:both) : Spree.t(method.display_on) %><%= method.active ? Spree.t(:say_yes) : Spree.t(:say_no) %> + <%= link_to_edit method, :no_text => true %> + <%= link_to_delete method, :no_text => true %> +
    +<% else %> +
    <%= Spree.t(:no_payment_methods_found) %>
    +<% end %> + From 4b6a02cb92170cb7627018cdab288f0b741ae6d2 Mon Sep 17 00:00:00 2001 From: Hugo Daniel Date: Wed, 24 Jul 2019 14:39:59 +0200 Subject: [PATCH 2/4] Convert payment_methods/index from ERB to Haml --- .../admin/payment_methods/index.html.erb | 52 ------------------- .../admin/payment_methods/index.html.haml | 39 ++++++++++++++ 2 files changed, 39 insertions(+), 52 deletions(-) delete mode 100644 app/views/spree/admin/payment_methods/index.html.erb create mode 100644 app/views/spree/admin/payment_methods/index.html.haml diff --git a/app/views/spree/admin/payment_methods/index.html.erb b/app/views/spree/admin/payment_methods/index.html.erb deleted file mode 100644 index ae51e60da5..0000000000 --- a/app/views/spree/admin/payment_methods/index.html.erb +++ /dev/null @@ -1,52 +0,0 @@ -<%= render :partial => 'spree/admin/shared/configuration_menu' %> - -<% content_for :page_title do %> - <%= Spree.t(:payment_methods) %> -<% end %> - -<% content_for :page_actions do %> -
  • - <%= button_link_to Spree.t(:new_payment_method), new_object_url, :icon => 'icon-plus', :id => 'admin_new_payment_methods_link' %> -
  • -<% end %> - -<% if @payment_methods.any? %> - - - - - - - - - - - - - - - - - - - - - <% @payment_methods.each do |method|%> - - - - - - - - - <% end %> - -
    <%= Spree.t(:name) %><%= Spree.t(:provider) %><%= Spree.t(:environment) %><%= Spree.t(:display) %><%= Spree.t(:active) %>
    <%= method.name %><%= method.type %><%= method.environment.to_s.titleize %><%= method.display_on.blank? ? Spree.t(:both) : Spree.t(method.display_on) %><%= method.active ? Spree.t(:say_yes) : Spree.t(:say_no) %> - <%= link_to_edit method, :no_text => true %> - <%= link_to_delete method, :no_text => true %> -
    -<% else %> -
    <%= Spree.t(:no_payment_methods_found) %>
    -<% end %> - diff --git a/app/views/spree/admin/payment_methods/index.html.haml b/app/views/spree/admin/payment_methods/index.html.haml new file mode 100644 index 0000000000..fe1350d690 --- /dev/null +++ b/app/views/spree/admin/payment_methods/index.html.haml @@ -0,0 +1,39 @@ += render partial: 'spree/admin/shared/configuration_menu' + +- content_for :page_title do + = Spree.t(:payment_methods) + +- content_for :page_actions do + %li + = button_link_to Spree.t(:new_payment_method), new_object_url, icon: 'icon-plus', id: 'admin_new_payment_methods_link' + +- if @payment_methods.any? + %table#listing_payment_methods.index + %colgroup + %col{style: "width: 15%"}/ + %col{style: "width: 35%"}/ + %col{style: "width: 15%"}/ + %col{style: "width: 10%"}/ + %col{style: "width: 10%"}/ + %col{style: "width: 15%"}/ + %thead + %tr{"data-hook" => "admin_payment_methods_index_headers"} + %th= Spree.t(:name) + %th= Spree.t(:provider) + %th= Spree.t(:environment) + %th= Spree.t(:display) + %th= Spree.t(:active) + %th.actions{"data-hook" => "admin_payment_methods_index_header_actions"} + %tbody + - @payment_methods.each do |method| + %tr{class: "#{cycle('odd', 'even')}", "data-hook" => "admin_payment_methods_index_rows", id: "#{spree_dom_id method}"} + %td.align-center= method.name + %td= method.type + %td.align-center= method.environment.to_s.titleize + %td.align-center= method.display_on.blank? ? Spree.t(:both) : Spree.t(method.display_on) + %td.align-center= method.active ? Spree.t(:say_yes) : Spree.t(:say_no) + %td.actions{"data-hook" => "admin_payment_methods_index_row_actions"} + = link_to_edit method, no_text: true + = link_to_delete method, no_text: true +- else + .alpha.twelve.columns.no-objects-found= Spree.t(:no_payment_methods_found) From 87ef0215b86e78be981cf51410bd7b54365a04db Mon Sep 17 00:00:00 2001 From: Hugo Daniel Date: Wed, 24 Jul 2019 14:49:29 +0200 Subject: [PATCH 3/4] De-deface payment_methods/index --- .../index/add_distributor_td.html.haml.deface | 6 ------ .../index/add_distributor_th.html.haml.deface | 4 ---- .../index/rearrange_cols.html.haml.deface | 9 --------- .../index/remove_configuration_sidebar.deface | 1 - .../admin/payment_methods/index.html.haml | 20 +++++++++++-------- 5 files changed, 12 insertions(+), 28 deletions(-) delete mode 100644 app/overrides/spree/admin/payment_methods/index/add_distributor_td.html.haml.deface delete mode 100644 app/overrides/spree/admin/payment_methods/index/add_distributor_th.html.haml.deface delete mode 100644 app/overrides/spree/admin/payment_methods/index/rearrange_cols.html.haml.deface delete mode 100644 app/overrides/spree/admin/payment_methods/index/remove_configuration_sidebar.deface diff --git a/app/overrides/spree/admin/payment_methods/index/add_distributor_td.html.haml.deface b/app/overrides/spree/admin/payment_methods/index/add_distributor_td.html.haml.deface deleted file mode 100644 index 26124492bc..0000000000 --- a/app/overrides/spree/admin/payment_methods/index/add_distributor_td.html.haml.deface +++ /dev/null @@ -1,6 +0,0 @@ -/ insert_after "[data-hook='admin_payment_methods_index_rows'] td:first-child" - -%td.align-center - - method.distributors.each do |distributor| - = distributor.name - %br/ diff --git a/app/overrides/spree/admin/payment_methods/index/add_distributor_th.html.haml.deface b/app/overrides/spree/admin/payment_methods/index/add_distributor_th.html.haml.deface deleted file mode 100644 index 6a46fe448c..0000000000 --- a/app/overrides/spree/admin/payment_methods/index/add_distributor_th.html.haml.deface +++ /dev/null @@ -1,4 +0,0 @@ -/ insert_after "[data-hook='admin_payment_methods_index_headers'] th:first-child" - -%th - = t(:products_distributor) diff --git a/app/overrides/spree/admin/payment_methods/index/rearrange_cols.html.haml.deface b/app/overrides/spree/admin/payment_methods/index/rearrange_cols.html.haml.deface deleted file mode 100644 index 1a60e082f6..0000000000 --- a/app/overrides/spree/admin/payment_methods/index/rearrange_cols.html.haml.deface +++ /dev/null @@ -1,9 +0,0 @@ -/ replace_contents "table#listing_payment_methods colgroup" - -%col{style: "width: 13%"} -%col{style: "width: 14%"} -%col{style: "width: 32%"} -%col{style: "width: 14%"} -%col{style: "width: 8%"} -%col{style: "width: 8%"} -%col{style: "width: 11%"} \ No newline at end of file diff --git a/app/overrides/spree/admin/payment_methods/index/remove_configuration_sidebar.deface b/app/overrides/spree/admin/payment_methods/index/remove_configuration_sidebar.deface deleted file mode 100644 index 502e7191a2..0000000000 --- a/app/overrides/spree/admin/payment_methods/index/remove_configuration_sidebar.deface +++ /dev/null @@ -1 +0,0 @@ -remove "erb[loud]:contains(\"render :partial => 'spree/admin/shared/configuration_menu'\")" diff --git a/app/views/spree/admin/payment_methods/index.html.haml b/app/views/spree/admin/payment_methods/index.html.haml index fe1350d690..98d5dcb767 100644 --- a/app/views/spree/admin/payment_methods/index.html.haml +++ b/app/views/spree/admin/payment_methods/index.html.haml @@ -1,5 +1,3 @@ -= render partial: 'spree/admin/shared/configuration_menu' - - content_for :page_title do = Spree.t(:payment_methods) @@ -10,15 +8,17 @@ - if @payment_methods.any? %table#listing_payment_methods.index %colgroup - %col{style: "width: 15%"}/ - %col{style: "width: 35%"}/ - %col{style: "width: 15%"}/ - %col{style: "width: 10%"}/ - %col{style: "width: 10%"}/ - %col{style: "width: 15%"}/ + %col{style: "width: 13%"} + %col{style: "width: 14%"} + %col{style: "width: 32%"} + %col{style: "width: 14%"} + %col{style: "width: 8%"} + %col{style: "width: 8%"} + %col{style: "width: 11%"} %thead %tr{"data-hook" => "admin_payment_methods_index_headers"} %th= Spree.t(:name) + %th= t(:products_distributor) %th= Spree.t(:provider) %th= Spree.t(:environment) %th= Spree.t(:display) @@ -28,6 +28,10 @@ - @payment_methods.each do |method| %tr{class: "#{cycle('odd', 'even')}", "data-hook" => "admin_payment_methods_index_rows", id: "#{spree_dom_id method}"} %td.align-center= method.name + %td.align-center + - method.distributors.each do |distributor| + = distributor.name + %br/ %td= method.type %td.align-center= method.environment.to_s.titleize %td.align-center= method.display_on.blank? ? Spree.t(:both) : Spree.t(method.display_on) From 6a621f47aa237acfd45f9fcd8b9df0b1f850f85c Mon Sep 17 00:00:00 2001 From: Hugo Daniel Date: Thu, 25 Jul 2019 14:31:07 +0200 Subject: [PATCH 4/4] Remove data-hooks --- app/views/spree/admin/payment_methods/index.html.haml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/spree/admin/payment_methods/index.html.haml b/app/views/spree/admin/payment_methods/index.html.haml index 98d5dcb767..4e79bf1c9d 100644 --- a/app/views/spree/admin/payment_methods/index.html.haml +++ b/app/views/spree/admin/payment_methods/index.html.haml @@ -16,17 +16,17 @@ %col{style: "width: 8%"} %col{style: "width: 11%"} %thead - %tr{"data-hook" => "admin_payment_methods_index_headers"} + %tr %th= Spree.t(:name) %th= t(:products_distributor) %th= Spree.t(:provider) %th= Spree.t(:environment) %th= Spree.t(:display) %th= Spree.t(:active) - %th.actions{"data-hook" => "admin_payment_methods_index_header_actions"} + %th.actions %tbody - @payment_methods.each do |method| - %tr{class: "#{cycle('odd', 'even')}", "data-hook" => "admin_payment_methods_index_rows", id: "#{spree_dom_id method}"} + %tr{class: "#{cycle('odd', 'even')}", id: "#{spree_dom_id method}"} %td.align-center= method.name %td.align-center - method.distributors.each do |distributor| @@ -36,7 +36,7 @@ %td.align-center= method.environment.to_s.titleize %td.align-center= method.display_on.blank? ? Spree.t(:both) : Spree.t(method.display_on) %td.align-center= method.active ? Spree.t(:say_yes) : Spree.t(:say_no) - %td.actions{"data-hook" => "admin_payment_methods_index_row_actions"} + %td.actions = link_to_edit method, no_text: true = link_to_delete method, no_text: true - else