Convert spree/admin/countries from erb to haml

This commit is contained in:
luisramos0
2019-09-17 16:35:25 +01:00
parent 3df65d0463
commit e1c3d2442a
6 changed files with 57 additions and 77 deletions

View File

@@ -1,22 +0,0 @@
<div data-hook="admin_country_form_fields" class="row">
<div class="alpha four columns">
<div data-hook="name" class="field">
<%= f.label :name, Spree.t(:name) %>
<%= f.text_field :name, :class => 'fullwidth' %>
</div>
</div>
<div class="four columns">
<div data-hook="iso_name" class="field">
<%= f.label :iso_name, Spree.t(:iso_name) %>
<%= f.text_field :iso_name, :class => 'fullwidth' %>
</div>
</div>
<div class="omega four columns">
<div data-hook="states_required" class="field checkbox">
<label>
<%= f.check_box :states_required %>
<%= Spree.t(:states_required) %>
</label>
</div>
</div>
</div>

View File

@@ -0,0 +1,14 @@
.row
.alpha.four.columns
.field
= f.label :name, t("spree.name")
= f.text_field :name, class: 'fullwidth'
.four.columns
.field
= f.label :iso_name, t("spree.iso_name")
= f.text_field :iso_name, class: 'fullwidth'
.omega.four.columns
.field.checkbox
%label
= f.check_box :states_required
= t("spree.states_required")

View File

@@ -1,21 +0,0 @@
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
<% content_for :page_title do %>
<%= Spree.t(:editing_country) %>
<% end %>
<% content_for :page_actions do %>
<li>
<%= button_link_to Spree.t(:back_to_countries_list), spree.admin_countries_path, :icon => 'icon-arrow-left' %>
</li>
<% end %>
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @country } %>
<%= form_for [:admin, @country] 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_country")
- content_for :page_actions do
%li
= button_link_to t("spree.back_to_countries_list"), spree.admin_countries_path, icon: 'icon-arrow-left'
= render partial: 'spree/shared/error_messages', locals: { target: @country }
= form_for [:admin, @country] do |f|
%fieldset.no-border-top
= render partial: 'form', locals: { f: f }
.clear
= render partial: 'spree/admin/shared/edit_resource_links'

View File

@@ -1,34 +0,0 @@
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
<% content_for :page_title do %>
<%= Spree.t(:listing_countries) %>
<% end %>
<table class="index" id='listing_countries' data-hook>
<colgroup>
<col style="width: 35%" />
<col style="width: 35%" />
<col style="width: 20%" />
<col style="width: 10%" />
</colgroup>
<thead>
<tr data-hook="tax_header">
<th><%= Spree.t(:country_name) %></th>
<th><%= Spree.t(:iso_name) %></th>
<th><%= Spree.t(:states_required) %></th>
<th class="actions"></th>
</tr>
</thead>
<tbody>
<% @countries.each do |country| %>
<tr id="<%= spree_dom_id country %>" data-hook="country_row" class="<%= cycle('odd', 'even')%>">
<td><%= country.name %></td>
<td><%= country.iso_name %></td>
<td class="align-center"><%= country.states_required.to_s.titleize %></td>
<td class="actions">
<%= link_to_edit country, :no_text => true %>
</td>
</tr>
<% end %>
</tbody>
</table>

View File

@@ -0,0 +1,27 @@
= render partial: 'spree/admin/shared/configuration_menu'
- content_for :page_title do
= t("spree.listing_countries")
%table#listing_countries.index
%colgroup
%col{:style => "width: 35%"}/
%col{:style => "width: 35%"}/
%col{:style => "width: 20%"}/
%col{:style => "width: 10%"}/
%thead
%tr
%th= t("spree.country_name")
%th= t("spree.iso_name")
%th= t("spree.states_required")
%th.actions
%tbody
- @countries.each do |country|
- tr_class = cycle('odd', 'even')
- tr_id = spree_dom_id(country)
%tr{class: tr_class, id: tr_id}
%td= country.name
%td= country.iso_name
%td.align-center= country.states_required.to_s.titleize
%td.actions
= link_to_edit country, no_text: true