From cc0dabcd1e1b4f8117768f5ade55a88dcdc6a7b1 Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Tue, 17 Sep 2019 17:10:21 +0100 Subject: [PATCH] Convert spree/admin/tax_rates from erb to haml --- .../spree/admin/tax_rates/_form.html.erb | 42 ------------- .../spree/admin/tax_rates/_form.html.haml | 28 +++++++++ app/views/spree/admin/tax_rates/edit.html.erb | 21 ------- .../spree/admin/tax_rates/edit.html.haml | 16 +++++ .../spree/admin/tax_rates/index.html.erb | 59 ------------------- .../spree/admin/tax_rates/index.html.haml | 48 +++++++++++++++ app/views/spree/admin/tax_rates/new.html.erb | 25 -------- app/views/spree/admin/tax_rates/new.html.haml | 16 +++++ 8 files changed, 108 insertions(+), 147 deletions(-) delete mode 100644 app/views/spree/admin/tax_rates/_form.html.erb create mode 100644 app/views/spree/admin/tax_rates/_form.html.haml delete mode 100644 app/views/spree/admin/tax_rates/edit.html.erb create mode 100644 app/views/spree/admin/tax_rates/edit.html.haml delete mode 100644 app/views/spree/admin/tax_rates/index.html.erb create mode 100644 app/views/spree/admin/tax_rates/index.html.haml delete mode 100644 app/views/spree/admin/tax_rates/new.html.erb create mode 100644 app/views/spree/admin/tax_rates/new.html.haml diff --git a/app/views/spree/admin/tax_rates/_form.html.erb b/app/views/spree/admin/tax_rates/_form.html.erb deleted file mode 100644 index dec5a210c7..0000000000 --- a/app/views/spree/admin/tax_rates/_form.html.erb +++ /dev/null @@ -1,42 +0,0 @@ -
-
-
- <%= Spree.t(:general_settings) %> - -
-
- <%= f.label :name, Spree.t(:name) %> - <%= f.text_field :name, :class => 'fullwidth' %> -
-
- <%= f.label :amount, Spree.t(:rate) %> - <%= f.text_field :amount, :class => 'fullwidth' %> -

<%= Spree.t(:tax_rate_amount_explanation) %>

-
-
- <%= f.check_box :included_in_price %> - <%= f.label :included_in_price, Spree.t(:included_in_price) %> -
-
- -
-
- <%= f.label :zone, Spree.t(:zone) %> - <%= f.collection_select(:zone_id, @available_zones, :id, :name, {}, {:class => 'select2 fullwidth'}) %> -
-
- <%= f.label :tax_category_id, Spree.t(:tax_category) %> - <%= f.collection_select(:tax_category_id, @available_categories,:id, :name, {}, {:class => 'select2 fullwidth'}) %> -
-
- <%= f.check_box :show_rate_in_label %> - <%= f.label :show_rate_in_label, Spree.t(:show_rate_in_label) %> -
-
-
-
- -
- - <%= render :partial => 'spree/admin/shared/calculator_fields', :locals => { :f => f } %> -
diff --git a/app/views/spree/admin/tax_rates/_form.html.haml b/app/views/spree/admin/tax_rates/_form.html.haml new file mode 100644 index 0000000000..20dd74ca71 --- /dev/null +++ b/app/views/spree/admin/tax_rates/_form.html.haml @@ -0,0 +1,28 @@ +%div + .alpha.twelve.columns + %fieldset.no-border-bottom + %legend{align: "center"}= t("spree.general_settings") + .alpha.six.columns + .field + = f.label :name, t("spree.name") + = f.text_field :name, class: 'fullwidth' + .field + = f.label :amount, t("spree.rate") + = f.text_field :amount, class: 'fullwidth' + %p + %em= t("spree.tax_rate_amount_explanation") + .field + = f.check_box :included_in_price + = f.label :included_in_price, t("spree.included_in_price") + .omega.six.columns + .field + = f.label :zone, t("spree.zone") + = f.collection_select(:zone_id, @available_zones, :id, :name, {}, {class: 'select2 fullwidth'}) + .field + = f.label :tax_category_id, t("spree.tax_category") + = f.collection_select(:tax_category_id, @available_categories,:id, :name, {}, {class: 'select2 fullwidth'}) + .field + = f.check_box :show_rate_in_label + = f.label :show_rate_in_label, t("spree.show_rate_in_label") + .clear + = render partial: 'spree/admin/shared/calculator_fields', locals: { f: f } diff --git a/app/views/spree/admin/tax_rates/edit.html.erb b/app/views/spree/admin/tax_rates/edit.html.erb deleted file mode 100644 index 8308a1c802..0000000000 --- a/app/views/spree/admin/tax_rates/edit.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -<%= render :partial => 'spree/admin/shared/configuration_menu' %> - -<% content_for :page_title do %> - <%= Spree.t(:editing_tax_rate) %> -<% end %> - -<% content_for :page_actions do %> -
  • - <%= button_link_to Spree.t(:back_to_tax_rates_list), spree.admin_tax_rates_path, :icon => 'icon-arrow-left' %> -
  • -<% end %> - -<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @tax_rate } %> - -<%= form_for [:admin, @tax_rate] do |f| %> -
    - <%= render :partial => 'form', :locals => { :f => f } %> -
    - <%= render :partial => 'spree/admin/shared/edit_resource_links' %> -
    -<% end %> diff --git a/app/views/spree/admin/tax_rates/edit.html.haml b/app/views/spree/admin/tax_rates/edit.html.haml new file mode 100644 index 0000000000..191f93b9cb --- /dev/null +++ b/app/views/spree/admin/tax_rates/edit.html.haml @@ -0,0 +1,16 @@ += render partial: 'spree/admin/shared/configuration_menu' + +- content_for :page_title do + = t("spree.editing_tax_rate") + +- content_for :page_actions do + %li + = button_link_to t("spree.back_to_tax_rates_list"), spree.admin_tax_rates_path, icon: 'icon-arrow-left' + += render partial: 'spree/shared/error_messages', locals: { target: @tax_rate } + += form_for [:admin, @tax_rate] do |f| + %fieldset.no-border-top + = render partial: 'form', locals: { f: f } + .clear + = render partial: 'spree/admin/shared/edit_resource_links' diff --git a/app/views/spree/admin/tax_rates/index.html.erb b/app/views/spree/admin/tax_rates/index.html.erb deleted file mode 100644 index 90e404788c..0000000000 --- a/app/views/spree/admin/tax_rates/index.html.erb +++ /dev/null @@ -1,59 +0,0 @@ -<%= render :partial => 'spree/admin/shared/configuration_menu' %> - -<% content_for :page_title do %> - <%= Spree.t(:tax_rates) %> -<% end %> - -<% content_for :page_actions do %> -
  • - <%= button_link_to Spree.t(:new_tax_rate), new_object_url, :icon => 'icon-plus' %> -
  • -<% end %> - -<% unless @tax_rates.any? %> -
    - <%= Spree.t(:no_results) %> -
    -<% else %> - - - - - - - - - - - - - - - - - - - - - - - - - <% @tax_rates.each do |tax_rate|%> - - - - - - - - - - - <% end %> - -
    <%= Spree.t(:zone) %><%= Spree.t(:name) %><%= Spree.t(:category) %><%= Spree.t(:amount) %><%= Spree.t(:included_in_price) %><%= Spree.t(:show_rate_in_label) %><%= Spree.t(:calculator) %>
    <%=tax_rate.zone.try(:name) || Spree.t(:not_available) %><%=tax_rate.name %><%=tax_rate.tax_category.try(:name) || Spree.t(:not_available) %><%=tax_rate.amount %><%=tax_rate.included_in_price %><%=tax_rate.show_rate_in_label %><%=tax_rate.calculator.to_s %> - <%= link_to_edit tax_rate, :no_text => true %> - <%= link_to_delete tax_rate, :no_text => true %> -
    -<% end %> diff --git a/app/views/spree/admin/tax_rates/index.html.haml b/app/views/spree/admin/tax_rates/index.html.haml new file mode 100644 index 0000000000..7217e99277 --- /dev/null +++ b/app/views/spree/admin/tax_rates/index.html.haml @@ -0,0 +1,48 @@ += render partial: 'spree/admin/shared/configuration_menu' + +- content_for :page_title do + = t("spree.tax_rates") + +- content_for :page_actions do + %li + = button_link_to t("spree.new_tax_rate"), new_object_url, icon: 'icon-plus' + +- unless @tax_rates.any? + .no-objects-found + = t("spree.no_results") +- else + %table.index + %colgroup + %col{style: "width: 15%"}/ + %col{style: "width: 15%"}/ + %col{style: "width: 10%"}/ + %col{style: "width: 10%"}/ + %col{style: "width: 10%"}/ + %col{style: "width: 10%"}/ + %col{style: "width: 15%"}/ + %col{style: "width: 15%"}/ + %thead + %tr + %th= t("spree.zone") + %th= t("spree.name") + %th= t("spree.category") + %th= t("spree.amount") + %th= t("spree.included_in_price") + %th= t("spree.show_rate_in_label") + %th= t("spree.calculator") + %th.actions + %tbody + - @tax_rates.each do |tax_rate| + - tr_class = cycle('odd', 'even') + - tr_id = spree_dom_id(tax_rate) + %tr{class: tr_class, id: tr_id} + %td= tax_rate.zone.try(:name) || t("spree.not_available") + %td= tax_rate.name + %td= tax_rate.tax_category.try(:name) || t("spree.not_available") + %td.align-center= tax_rate.amount + %td.align-center= tax_rate.included_in_price + %td.align-center= tax_rate.show_rate_in_label + %td.align-center= tax_rate.calculator.to_s + %td.actions + = link_to_edit tax_rate, no_text: true + = link_to_delete tax_rate, no_text: true diff --git a/app/views/spree/admin/tax_rates/new.html.erb b/app/views/spree/admin/tax_rates/new.html.erb deleted file mode 100644 index c3720fcb59..0000000000 --- a/app/views/spree/admin/tax_rates/new.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -<%= render :partial => 'spree/admin/shared/configuration_menu' %> - -<% content_for :page_title do %> - <%= Spree.t(:new_tax_rate) %> -<% end %> - -<% content_for :page_actions do %> -
  • - <%= button_link_to Spree.t(:back_to_tax_rates_list), spree.admin_tax_rates_path, :icon => 'icon-arrow-left' %> -
  • -<% end %> - -<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @tax_rate } %> - -<%= form_for [:admin, @tax_rate] do |f| %> -
    - - <%= render :partial => 'form', :locals => { :f => f } %> - -
    - - <%= render :partial => 'spree/admin/shared/new_resource_links' %> - -
    -<% end %> diff --git a/app/views/spree/admin/tax_rates/new.html.haml b/app/views/spree/admin/tax_rates/new.html.haml new file mode 100644 index 0000000000..cbf5986a99 --- /dev/null +++ b/app/views/spree/admin/tax_rates/new.html.haml @@ -0,0 +1,16 @@ += render partial: 'spree/admin/shared/configuration_menu' + +- content_for :page_title do + = t("spree.new_tax_rate") + +- content_for :page_actions do + %li + = button_link_to t("spree.back_to_tax_rates_list"), spree.admin_tax_rates_path, icon: 'icon-arrow-left' + += render partial: 'spree/shared/error_messages', locals: { target: @tax_rate } + += form_for [:admin, @tax_rate] do |f| + %fieldset.no-border-top + = render partial: 'form', locals: { f: f } + .clear + = render partial: 'spree/admin/shared/new_resource_links'