From 2a68d34fb0332bb6a115e4a30debac189f655b4a Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Tue, 17 Sep 2019 17:18:25 +0100 Subject: [PATCH] Convert spree/admin/taxonomies from erb to haml --- .../spree/admin/taxonomies/_form.html.erb | 7 ---- .../spree/admin/taxonomies/_form.html.haml | 7 ++++ .../spree/admin/taxonomies/_js_head.html.erb | 8 ++-- .../spree/admin/taxonomies/_list.html.erb | 26 ------------ .../spree/admin/taxonomies/_list.html.haml | 19 +++++++++ .../spree/admin/taxonomies/_taxon.html.erb | 12 ------ .../spree/admin/taxonomies/_taxon.html.haml | 7 ++++ app/views/spree/admin/taxonomies/edit.erb | 42 ------------------- app/views/spree/admin/taxonomies/edit.haml | 32 ++++++++++++++ .../spree/admin/taxonomies/index.html.erb | 15 ------- .../spree/admin/taxonomies/index.html.haml | 11 +++++ app/views/spree/admin/taxonomies/new.html.erb | 22 ---------- .../spree/admin/taxonomies/new.html.haml | 15 +++++++ 13 files changed, 95 insertions(+), 128 deletions(-) delete mode 100644 app/views/spree/admin/taxonomies/_form.html.erb create mode 100644 app/views/spree/admin/taxonomies/_form.html.haml delete mode 100644 app/views/spree/admin/taxonomies/_list.html.erb create mode 100644 app/views/spree/admin/taxonomies/_list.html.haml delete mode 100644 app/views/spree/admin/taxonomies/_taxon.html.erb create mode 100644 app/views/spree/admin/taxonomies/_taxon.html.haml delete mode 100755 app/views/spree/admin/taxonomies/edit.erb create mode 100755 app/views/spree/admin/taxonomies/edit.haml delete mode 100644 app/views/spree/admin/taxonomies/index.html.erb create mode 100644 app/views/spree/admin/taxonomies/index.html.haml delete mode 100644 app/views/spree/admin/taxonomies/new.html.erb create mode 100644 app/views/spree/admin/taxonomies/new.html.haml diff --git a/app/views/spree/admin/taxonomies/_form.html.erb b/app/views/spree/admin/taxonomies/_form.html.erb deleted file mode 100644 index 1166e84a2e..0000000000 --- a/app/views/spree/admin/taxonomies/_form.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -
- <%= f.field_container :name do %> - <%= f.label :name, Spree.t(:name) %> *
- <%= error_message_on :taxonomy, :name, :class => 'fullwidth title' %> - <%= text_field :taxonomy, :name %> - <% end %> -
diff --git a/app/views/spree/admin/taxonomies/_form.html.haml b/app/views/spree/admin/taxonomies/_form.html.haml new file mode 100644 index 0000000000..81927c7c1a --- /dev/null +++ b/app/views/spree/admin/taxonomies/_form.html.haml @@ -0,0 +1,7 @@ +.field.align-center + = f.field_container :name do + = f.label :name, t("spree.name") + %span.required * + %br/ + = error_message_on :taxonomy, :name, class: 'fullwidth title' + = text_field :taxonomy, :name diff --git a/app/views/spree/admin/taxonomies/_js_head.html.erb b/app/views/spree/admin/taxonomies/_js_head.html.erb index 0b73bbbfb0..e95f4bdeff 100755 --- a/app/views/spree/admin/taxonomies/_js_head.html.erb +++ b/app/views/spree/admin/taxonomies/_js_head.html.erb @@ -1,9 +1,9 @@ <% content_for :head do %> <%= javascript_tag "var taxonomy_id = #{@taxonomy.id}; - var loading = '#{escape_javascript Spree.t(:loading)}'; - var new_taxon = '#{escape_javascript Spree.t(:new_taxon)}'; - var server_error = '#{escape_javascript Spree.t(:server_error)}'; - var taxonomy_tree_error = '#{escape_javascript Spree.t(:taxonomy_tree_error)}'; + var loading = '#{escape_javascript t("spree.loading")}'; + var new_taxon = '#{escape_javascript t("spree.new_taxon")}'; + var server_error = '#{escape_javascript t("spree.server_error")}'; + var taxonomy_tree_error = '#{escape_javascript t("spree.taxonomy_tree_error")}'; $(document).ready(function(){ setup_taxonomy_tree(taxonomy_id); diff --git a/app/views/spree/admin/taxonomies/_list.html.erb b/app/views/spree/admin/taxonomies/_list.html.erb deleted file mode 100644 index 88a9ddc049..0000000000 --- a/app/views/spree/admin/taxonomies/_list.html.erb +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - <% @taxonomies.each do |taxonomy| %> - - - - - <% end %> - -
<%= Spree.t(:name) %>
- - <%= taxonomy.name %> - - <%= link_to_edit taxonomy.id, :no_text => true %> - <%= link_to_delete taxonomy, :no_text => true %> -
diff --git a/app/views/spree/admin/taxonomies/_list.html.haml b/app/views/spree/admin/taxonomies/_list.html.haml new file mode 100644 index 0000000000..1574e8b718 --- /dev/null +++ b/app/views/spree/admin/taxonomies/_list.html.haml @@ -0,0 +1,19 @@ +%table#listing_taxonomies.index.sortable{"data-sortable-link" => update_positions_admin_taxonomies_url} + %colgroup + %col{style: "width: 85%"}/ + %col{style: "width: 15%"}/ + %thead + %tr + %th= t("spree.name") + %th.actions + %tbody + - @taxonomies.each do |taxonomy| + - tr_class = cycle('odd', 'even') + - tr_id = spree_dom_id(taxonomy) + %tr{class: tr_class, id: tr_id} + %td + %span.handle + = taxonomy.name + %td.actions + = link_to_edit taxonomy.id, no_text: true + = link_to_delete taxonomy, no_text: true diff --git a/app/views/spree/admin/taxonomies/_taxon.html.erb b/app/views/spree/admin/taxonomies/_taxon.html.erb deleted file mode 100644 index d5eb39190c..0000000000 --- a/app/views/spree/admin/taxonomies/_taxon.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<% if taxon.children.length != 0 %> - -<% end %> diff --git a/app/views/spree/admin/taxonomies/_taxon.html.haml b/app/views/spree/admin/taxonomies/_taxon.html.haml new file mode 100644 index 0000000000..6c5e5273b9 --- /dev/null +++ b/app/views/spree/admin/taxonomies/_taxon.html.haml @@ -0,0 +1,7 @@ +- if taxon.children.length != 0 + %ul + - taxon.children.each do |child| + %li{id: "#{child.id}", rel: "taxon"} + %a{href: "#", style: "background-image: url(#{child.icon.url});"}= child.name + - if child.children.length > 0 + = render partial: 'taxon', locals: { taxon: child } diff --git a/app/views/spree/admin/taxonomies/edit.erb b/app/views/spree/admin/taxonomies/edit.erb deleted file mode 100755 index e5f2dcc2b1..0000000000 --- a/app/views/spree/admin/taxonomies/edit.erb +++ /dev/null @@ -1,42 +0,0 @@ -<%= render :partial => 'spree/admin/shared/configuration_menu' %> - -<%= render :partial => 'js_head' %> - -<% content_for :page_title do %> - <%= Spree.t(:taxonomy_edit) %> -<% end %> - -<% content_for :page_actions do %> -
  • - <%= button_link_to Spree.t(:back_to_taxonomies_list), spree.admin_taxonomies_path, :icon => 'icon-arrow-left' %> -
  • -<% end %> - - - -<%= form_for [:admin, @taxonomy] do |f| %> -
    - <%= render :partial => 'form', :locals => { :f => f } %> -
    - <%= label_tag nil, Spree.t(:tree) %>
    - -
    -
    - - -
    <%= Spree.t(:taxonomy_tree_instruction) %>
    - -
    - -
    - <%= button Spree.t('actions.update'), 'icon-refresh' %> - <%= Spree.t(:or) %> - <%= button_link_to Spree.t('actions.cancel'), admin_taxonomies_path, :icon => 'icon-remove' %> -
    -
    -<% end %> diff --git a/app/views/spree/admin/taxonomies/edit.haml b/app/views/spree/admin/taxonomies/edit.haml new file mode 100755 index 0000000000..3deb328999 --- /dev/null +++ b/app/views/spree/admin/taxonomies/edit.haml @@ -0,0 +1,32 @@ += render partial: 'spree/admin/shared/configuration_menu' + += render partial: 'js_head' + +- content_for :page_title do + = t("spree.taxonomy_edit") + +- content_for :page_actions do + %li + = button_link_to t("spree.back_to_taxonomies_list"), spree.admin_taxonomies_path, icon: 'icon-arrow-left' + +#ajax_error.errorExplanation{style: "display:none;"} += form_for [:admin, @taxonomy] do |f| + %fieldset.no-border-top + = render partial: 'form', locals: { f: f } + %div + = label_tag nil, t("spree.tree") + %br/ + :javascript + Spree.routes.taxonomy_taxons_path = "#{spree.api_taxonomy_taxons_path(@taxonomy)}"; + Spree.routes.admin_taxonomy_taxons_path = "#{spree.admin_taxonomy_taxons_path(@taxonomy)}"; + #taxonomy_tree.tree + #progress{style: "display:none;"} + = image_tag 'select2-spinner.gif', title: 'Spinner', style: "vertical-align:bottom;" + = t("spree.updating") + \.. + .info= t("spree.taxonomy_tree_instruction") + %br/ + .filter-actions.actions + = button t('spree.actions.update'), 'icon-refresh' + %span.or= t("spree.or") + = button_link_to t('spree.actions.cancel'), admin_taxonomies_path, icon: 'icon-remove' diff --git a/app/views/spree/admin/taxonomies/index.html.erb b/app/views/spree/admin/taxonomies/index.html.erb deleted file mode 100644 index 57c886272d..0000000000 --- a/app/views/spree/admin/taxonomies/index.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<%= render :partial => 'spree/admin/shared/configuration_menu' %> - -<% content_for :page_title do %> - <%= Spree.t(:taxonomies) %> -<% end %> - -<% content_for :page_actions do %> -
  • - <%= button_link_to Spree.t(:new_taxonomy), spree.new_admin_taxonomy_url, :icon => 'icon-plus', :id => 'admin_new_taxonomy_link' %>

    -
  • -<% end %> - -
    - <%= render :partial => 'list' %> -
    diff --git a/app/views/spree/admin/taxonomies/index.html.haml b/app/views/spree/admin/taxonomies/index.html.haml new file mode 100644 index 0000000000..63041138d1 --- /dev/null +++ b/app/views/spree/admin/taxonomies/index.html.haml @@ -0,0 +1,11 @@ += render partial: 'spree/admin/shared/configuration_menu' + +- content_for :page_title do + = t("spree.taxonomies") + +- content_for :page_actions do + %li + = button_link_to t("spree.new_taxonomy"), spree.new_admin_taxonomy_url, icon: 'icon-plus', id: 'admin_new_taxonomy_link' + +#list-taxonomies + = render partial: 'list' diff --git a/app/views/spree/admin/taxonomies/new.html.erb b/app/views/spree/admin/taxonomies/new.html.erb deleted file mode 100644 index a46166b973..0000000000 --- a/app/views/spree/admin/taxonomies/new.html.erb +++ /dev/null @@ -1,22 +0,0 @@ -<%= render :partial => 'spree/admin/shared/configuration_menu' %> - -<% content_for :page_title do %> - <%= Spree.t(:new_taxonomy) %> -<% end %> - -<% content_for :page_actions do %> -
  • - <%= button_link_to Spree.t(:back_to_taxonomies_list), spree.admin_taxonomies_path, :icon => 'icon-arrow-left' %> -
  • -<% end %> - -<%= form_for [:admin, @taxonomy] do |f| %> - - <%= render :partial => 'form', :locals => { :f => f } %> -
    -
    -
    - <%= button Spree.t(:create), 'icon-ok' %> -
    -
    -<% end %> diff --git a/app/views/spree/admin/taxonomies/new.html.haml b/app/views/spree/admin/taxonomies/new.html.haml new file mode 100644 index 0000000000..a84338ddf1 --- /dev/null +++ b/app/views/spree/admin/taxonomies/new.html.haml @@ -0,0 +1,15 @@ += render partial: 'spree/admin/shared/configuration_menu' + +- content_for :page_title do + = t("spree.new_taxonomy") + +- content_for :page_actions do + %li + = button_link_to t("spree.back_to_taxonomies_list"), spree.admin_taxonomies_path, icon: 'icon-arrow-left' + += form_for [:admin, @taxonomy] do |f| + = render partial: 'form', locals: { f: f } + %fieldset.no-border-top + %br/ + .filter-actions.actions + = button t("spree.create"), 'icon-ok'