Convert spree/admin/tax_rates from erb to haml

This commit is contained in:
luisramos0
2019-09-17 17:10:21 +01:00
parent e79c672263
commit cc0dabcd1e
8 changed files with 108 additions and 147 deletions

View File

@@ -1,42 +0,0 @@
<div data-hook="admin_tax_rate_form_fields">
<div class="alpha twelve columns">
<fieldset data-hook="tax_rates" class=" no-border-bottom">
<legend align="center"><%= Spree.t(:general_settings) %></legend>
<div class="alpha six columns">
<div data-hook="name" class="field">
<%= f.label :name, Spree.t(:name) %>
<%= f.text_field :name, :class => 'fullwidth' %>
</div>
<div data-hook="rate" class="field">
<%= f.label :amount, Spree.t(:rate) %>
<%= f.text_field :amount, :class => 'fullwidth' %>
<p><em><%= Spree.t(:tax_rate_amount_explanation) %></em></p>
</div>
<div data-hook="included" class="field">
<%= f.check_box :included_in_price %>
<%= f.label :included_in_price, Spree.t(:included_in_price) %>
</div>
</div>
<div class="omega six columns">
<div data-hook="zone" class="field">
<%= f.label :zone, Spree.t(:zone) %>
<%= f.collection_select(:zone_id, @available_zones, :id, :name, {}, {:class => 'select2 fullwidth'}) %>
</div>
<div data-hook="category" class="field">
<%= f.label :tax_category_id, Spree.t(:tax_category) %>
<%= f.collection_select(:tax_category_id, @available_categories,:id, :name, {}, {:class => 'select2 fullwidth'}) %>
</div>
<div data-hook="show_rate" class="field">
<%= f.check_box :show_rate_in_label %>
<%= f.label :show_rate_in_label, Spree.t(:show_rate_in_label) %>
</div>
</div>
</fieldset>
</div>
<div class="clear"></div>
<%= render :partial => 'spree/admin/shared/calculator_fields', :locals => { :f => f } %>
</div>

View File

@@ -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 }

View File

@@ -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 %>
<li>
<%= button_link_to Spree.t(:back_to_tax_rates_list), spree.admin_tax_rates_path, :icon => 'icon-arrow-left' %>
</li>
<% end %>
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @tax_rate } %>
<%= form_for [:admin, @tax_rate] do |f| %>
<fieldset class="no-border-top">
<%= render :partial => 'form', :locals => { :f => f } %>
<div class="clear"></div>
<%= render :partial => 'spree/admin/shared/edit_resource_links' %>
</fieldset>
<% end %>

View File

@@ -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'

View File

@@ -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 %>
<li>
<%= button_link_to Spree.t(:new_tax_rate), new_object_url, :icon => 'icon-plus' %>
</li>
<% end %>
<% unless @tax_rates.any? %>
<div class="no-objects-found">
<%= Spree.t(:no_results) %>
</div>
<% else %>
<table class="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%">
</colgroup>
<thead>
<tr data-hook="rate_header">
<th><%= Spree.t(:zone) %></th>
<th><%= Spree.t(:name) %></th>
<th><%= Spree.t(:category) %></th>
<th><%= Spree.t(:amount) %></th>
<th><%= Spree.t(:included_in_price) %></th>
<th><%= Spree.t(:show_rate_in_label) %></th>
<th><%= Spree.t(:calculator) %></th>
<th class="actions"></th>
</tr>
</thead>
<tbody>
<% @tax_rates.each do |tax_rate|%>
<tr id="<%= spree_dom_id tax_rate %>" data-hook="rate_row" class="<%= cycle('odd', 'even')%>">
<td><%=tax_rate.zone.try(:name) || Spree.t(:not_available) %></td>
<td><%=tax_rate.name %></td>
<td><%=tax_rate.tax_category.try(:name) || Spree.t(:not_available) %></td>
<td class="align-center"><%=tax_rate.amount %></td>
<td class="align-center"><%=tax_rate.included_in_price %></td>
<td class="align-center"><%=tax_rate.show_rate_in_label %></td>
<td class="align-center"><%=tax_rate.calculator.to_s %></td>
<td class="actions">
<%= link_to_edit tax_rate, :no_text => true %>
<%= link_to_delete tax_rate, :no_text => true %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>

View File

@@ -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

View File

@@ -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 %>
<li>
<%= button_link_to Spree.t(:back_to_tax_rates_list), spree.admin_tax_rates_path, :icon => 'icon-arrow-left' %>
</li>
<% end %>
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @tax_rate } %>
<%= form_for [:admin, @tax_rate] do |f| %>
<fieldset class="no-border-top">
<%= render :partial => 'form', :locals => { :f => f } %>
<div class="clear"></div>
<%= render :partial => 'spree/admin/shared/new_resource_links' %>
</fieldset>
<% end %>

View File

@@ -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'