From 2ce56aef2cfad9a35d33e05030b179abf0fa77dc Mon Sep 17 00:00:00 2001
From: luisramos0
Date: Tue, 17 Sep 2019 16:23:39 +0100
Subject: [PATCH] Add spree_backend views related to admin/configuration
taxonomies that are missing in ofn
---
.../spree/admin/taxonomies/_form.html.erb | 7 ++++
.../spree/admin/taxonomies/_js_head.html.erb | 13 ++++++
.../spree/admin/taxonomies/_list.html.erb | 26 ++++++++++++
.../spree/admin/taxonomies/_taxon.html.erb | 12 ++++++
app/views/spree/admin/taxonomies/edit.erb | 42 +++++++++++++++++++
.../spree/admin/taxonomies/index.html.erb | 15 +++++++
app/views/spree/admin/taxonomies/new.html.erb | 22 ++++++++++
.../spree/admin/taxons/_taxon_table.html.erb | 23 ++++++++++
app/views/spree/admin/taxons/edit.html.erb | 23 ++++++++++
app/views/spree/admin/taxons/search.rabl | 5 +++
10 files changed, 188 insertions(+)
create mode 100644 app/views/spree/admin/taxonomies/_form.html.erb
create mode 100755 app/views/spree/admin/taxonomies/_js_head.html.erb
create mode 100644 app/views/spree/admin/taxonomies/_list.html.erb
create mode 100644 app/views/spree/admin/taxonomies/_taxon.html.erb
create mode 100755 app/views/spree/admin/taxonomies/edit.erb
create mode 100644 app/views/spree/admin/taxonomies/index.html.erb
create mode 100644 app/views/spree/admin/taxonomies/new.html.erb
create mode 100644 app/views/spree/admin/taxons/_taxon_table.html.erb
create mode 100644 app/views/spree/admin/taxons/edit.html.erb
create mode 100644 app/views/spree/admin/taxons/search.rabl
diff --git a/app/views/spree/admin/taxonomies/_form.html.erb b/app/views/spree/admin/taxonomies/_form.html.erb
new file mode 100644
index 0000000000..1166e84a2e
--- /dev/null
+++ b/app/views/spree/admin/taxonomies/_form.html.erb
@@ -0,0 +1,7 @@
+
+ <%= 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/_js_head.html.erb b/app/views/spree/admin/taxonomies/_js_head.html.erb
new file mode 100755
index 0000000000..0b73bbbfb0
--- /dev/null
+++ b/app/views/spree/admin/taxonomies/_js_head.html.erb
@@ -0,0 +1,13 @@
+<% 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)}';
+
+ $(document).ready(function(){
+ setup_taxonomy_tree(taxonomy_id);
+ });
+ "
+ %>
+<% end %>
diff --git a/app/views/spree/admin/taxonomies/_list.html.erb b/app/views/spree/admin/taxonomies/_list.html.erb
new file mode 100644
index 0000000000..88a9ddc049
--- /dev/null
+++ b/app/views/spree/admin/taxonomies/_list.html.erb
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+ | <%= Spree.t(:name) %> |
+ |
+
+
+
+ <% @taxonomies.each do |taxonomy| %>
+
+ |
+
+ <%= taxonomy.name %>
+ |
+
+ <%= link_to_edit taxonomy.id, :no_text => true %>
+ <%= link_to_delete taxonomy, :no_text => true %>
+ |
+
+ <% end %>
+
+
diff --git a/app/views/spree/admin/taxonomies/_taxon.html.erb b/app/views/spree/admin/taxonomies/_taxon.html.erb
new file mode 100644
index 0000000000..d5eb39190c
--- /dev/null
+++ b/app/views/spree/admin/taxonomies/_taxon.html.erb
@@ -0,0 +1,12 @@
+<% if taxon.children.length != 0 %>
+
+ <% taxon.children.each do |child| %>
+ -
+ <%= child.name %>
+ <% if child.children.length > 0 %>
+ <%= render :partial => 'taxon', :locals => { :taxon => child } %>
+ <% end %>
+
+ <% end %>
+
+<% end %>
diff --git a/app/views/spree/admin/taxonomies/edit.erb b/app/views/spree/admin/taxonomies/edit.erb
new file mode 100755
index 0000000000..e5f2dcc2b1
--- /dev/null
+++ b/app/views/spree/admin/taxonomies/edit.erb
@@ -0,0 +1,42 @@
+<%= 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| %>
+
+<% end %>
diff --git a/app/views/spree/admin/taxonomies/index.html.erb b/app/views/spree/admin/taxonomies/index.html.erb
new file mode 100644
index 0000000000..57c886272d
--- /dev/null
+++ b/app/views/spree/admin/taxonomies/index.html.erb
@@ -0,0 +1,15 @@
+<%= 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/new.html.erb b/app/views/spree/admin/taxonomies/new.html.erb
new file mode 100644
index 0000000000..a46166b973
--- /dev/null
+++ b/app/views/spree/admin/taxonomies/new.html.erb
@@ -0,0 +1,22 @@
+<%= 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 } %>
+
+<% end %>
diff --git a/app/views/spree/admin/taxons/_taxon_table.html.erb b/app/views/spree/admin/taxons/_taxon_table.html.erb
new file mode 100644
index 0000000000..1598bfb470
--- /dev/null
+++ b/app/views/spree/admin/taxons/_taxon_table.html.erb
@@ -0,0 +1,23 @@
+
+
+
+ | <%= Spree.t(:name) %> |
+ <%= Spree.t(:path) %> |
+ |
+
+
+
+ <% taxons.each do |taxon| %>
+
+ | <%= taxon.name %> |
+ <%= taxon_path taxon %> |
+
+ <%= link_to_delete taxon, :url => remove_admin_product_taxon_url(@product, taxon), :name => icon('delete') + ' ' + Spree.t(:remove) %>
+ |
+
+ <% end %>
+ <% if taxons.empty? %>
+ | <%= Spree.t(:none) %>. |
+ <% end %>
+
+
diff --git a/app/views/spree/admin/taxons/edit.html.erb b/app/views/spree/admin/taxons/edit.html.erb
new file mode 100644
index 0000000000..2335bee1c5
--- /dev/null
+++ b/app/views/spree/admin/taxons/edit.html.erb
@@ -0,0 +1,23 @@
+<%= render :partial => 'spree/admin/shared/configuration_menu' %>
+
+<% content_for :page_title do %>
+ <%= Spree.t(:taxon_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 %>
+
+<% # 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 } %>
+
+
+ <%= 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" %>
+
+<% end %>
diff --git a/app/views/spree/admin/taxons/search.rabl b/app/views/spree/admin/taxons/search.rabl
new file mode 100644
index 0000000000..ac5f36f979
--- /dev/null
+++ b/app/views/spree/admin/taxons/search.rabl
@@ -0,0 +1,5 @@
+object false
+child(@taxons => :taxons) do
+ attributes :name, :pretty_name, :id
+end
+