Convert spree/admin/taxons from erb to haml

This commit is contained in:
luisramos0
2019-09-17 17:22:30 +01:00
parent 2a68d34fb0
commit def9ab7c47
6 changed files with 44 additions and 54 deletions

View File

@@ -1,11 +1,11 @@
.row{"data-hook" => "admin_inside_taxon_form"}
.row
.alpha.five.columns
= f.field_container :name do
= f.label :name, t(:name)
%span.required *
%br/
= error_message_on :taxon, :name, :class => 'fullwidth title'
= text_field :taxon, :name, :class => 'fullwidth'
= error_message_on :taxon, :name, class: 'fullwidth title'
= text_field :taxon, :name, class: 'fullwidth'
= f.field_container :permalink_part do
= f.label :permalink_part, t(:permalink)
%span.required *
@@ -20,17 +20,17 @@
= f.field_container :meta_title do
= f.label :meta_title, t(:meta_title)
%br/
= f.text_field :meta_title, :class => 'fullwidth', :rows => 6
= f.text_field :meta_title, class: 'fullwidth', rows: 6
= f.field_container :meta_description do
= f.label :meta_description, t(:meta_description)
%br/
= f.text_field :meta_description, :class => 'fullwidth', :rows => 6
= f.text_field :meta_description, class: 'fullwidth', rows: 6
= f.field_container :meta_description do
= f.label :meta_keywords, t(:meta_keywords)
%br/
= f.text_field :meta_keywords, :class => 'fullwidth', :rows => 6
= f.text_field :meta_keywords, class: 'fullwidth', rows: 6
.omega.seven.columns
= f.field_container :description do
= f.label :description, t(:description)
%br/
= f.text_area :description, :class => 'fullwidth', :rows => 6
= f.text_area :description, class: 'fullwidth', rows: 6

View File

@@ -1,23 +0,0 @@
<table class="index">
<thead>
<tr data-hook="taxons_header">
<th><%= Spree.t(:name) %></th>
<th><%= Spree.t(:path) %></th>
<th></th>
</tr>
</thead>
<tbody>
<% taxons.each do |taxon| %>
<tr id="<%= spree_dom_id(taxon) %>" data-hook="taxons_row" class="<%= cycle('odd', 'even')%>">
<td><%= taxon.name %></td>
<td><%= taxon_path taxon %></td>
<td class="actions">
<%= link_to_delete taxon, :url => remove_admin_product_taxon_url(@product, taxon), :name => icon('delete') + ' ' + Spree.t(:remove) %>
</td>
</tr>
<% end %>
<% if taxons.empty? %>
<tr data-hook="taxons_none"><td colspan="3"><%= Spree.t(:none) %>.</td></tr>
<% end %>
</tbody>
</table>

View File

@@ -0,0 +1,20 @@
%table.index
%thead
%tr
%th= t("spree.name")
%th= t("spree.path")
%th
%tbody
- taxons.each do |taxon|
- tr_class = cycle('odd', 'even')
- tr_id = spree_dom_id(taxon)
%tr{class: tr_class, id: tr_id}
%td= taxon.name
%td= taxon_path taxon
%td.actions
= link_to_delete taxon, url: remove_admin_product_taxon_url(@product, taxon), name: icon('delete') + ' ' + t("spree.remove")
- if taxons.empty?
%tr
%td{colspan: "3"}
= t("spree.none")
\.

View File

@@ -1,23 +0,0 @@
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
<% content_for :page_title do %>
<%= Spree.t(:taxon_edit) %>
<% end %>
<% content_for :page_actions do %>
<li>
<%= button_link_to Spree.t(:back_to_taxonomies_list), spree.admin_taxonomies_path, :icon => 'icon-arrow-left' %>
</li>
<% end %>
<% # Because otherwise the form would attempt to use to_param of @taxon %>
<% form_url = admin_taxonomy_taxon_path(@taxonomy.id, @taxon.id) %>
<%= form_for [:admin, @taxonomy, @taxon], :method => :put, :url => form_url, :html => { :multipart => true } do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
<div class="form-buttons" data-hook="buttons">
<%= button Spree.t('actions.update'), 'icon-refresh' %>
<%= Spree.t(:or) %>
<%= button_link_to Spree.t('actions.cancel'), edit_admin_taxonomy_url(@taxonomy), :icon => "icon-remove" %>
</div>
<% end %>

View File

@@ -0,0 +1,17 @@
= render partial: 'spree/admin/shared/configuration_menu'
- content_for :page_title do
= t("spree.taxon_edit")
- content_for :page_actions do
%li
= button_link_to t("spree.back_to_taxonomies_list"), spree.admin_taxonomies_path, icon: 'icon-arrow-left'
- # Because otherwise the form would attempt to use to_param of @taxon
- form_url = admin_taxonomy_taxon_path(@taxonomy.id, @taxon.id)
= form_for [:admin, @taxonomy, @taxon], method: :put, url: form_url, html: { multipart: true } do |f|
= render partial: 'form', locals: { f: f }
.form-buttons
= button t('spree.actions.update'), 'icon-refresh'
= t("spree.or")
= button_link_to t('spree.actions.cancel'), edit_admin_taxonomy_url(@taxonomy), icon: "icon-remove"

View File

@@ -2,4 +2,3 @@ object false
child(@taxons => :taxons) do
attributes :name, :pretty_name, :id
end