mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Convert spree/admin/taxons from erb to haml
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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>
|
||||
20
app/views/spree/admin/taxons/_taxon_table.html.haml
Normal file
20
app/views/spree/admin/taxons/_taxon_table.html.haml
Normal 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")
|
||||
\.
|
||||
@@ -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 %>
|
||||
17
app/views/spree/admin/taxons/edit.html.haml
Normal file
17
app/views/spree/admin/taxons/edit.html.haml
Normal 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"
|
||||
@@ -2,4 +2,3 @@ object false
|
||||
child(@taxons => :taxons) do
|
||||
attributes :name, :pretty_name, :id
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user