Add spree_backend views related to admin/configuration taxonomies that are missing in ofn

This commit is contained in:
luisramos0
2019-09-17 16:23:39 +01:00
parent 20f965731d
commit 2ce56aef2c
10 changed files with 188 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
<div data-hook="admin_inside_taxonomy_form" class="field align-center">
<%= f.field_container :name do %>
<%= f.label :name, Spree.t(:name) %> <span class="required">*</span><br />
<%= error_message_on :taxonomy, :name, :class => 'fullwidth title' %>
<%= text_field :taxonomy, :name %>
<% end %>
</div>

View File

@@ -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 %>

View File

@@ -0,0 +1,26 @@
<table class="index sortable" id='listing_taxonomies' data-hook data-sortable-link="<%= update_positions_admin_taxonomies_url %>">
<colgroup>
<col style="width: 85%">
<col style="width: 15%">
</colgroup>
<thead>
<tr data-hook="taxonomies_header">
<th><%= Spree.t(:name) %></th>
<th class="actions"></th>
</tr>
</thead>
<tbody>
<% @taxonomies.each do |taxonomy| %>
<tr id="<%= spree_dom_id taxonomy %>" data-hook="taxonomies_row" class="<%= cycle('odd', 'even')%>">
<td>
<span class="handle"></span>
<%= taxonomy.name %>
</td>
<td class="actions">
<%= link_to_edit taxonomy.id, :no_text => true %>
<%= link_to_delete taxonomy, :no_text => true %>
</td>
</tr>
<% end %>
</tbody>
</table>

View File

@@ -0,0 +1,12 @@
<% if taxon.children.length != 0 %>
<ul>
<% taxon.children.each do |child| %>
<li id="<%= child.id %>" rel="taxon">
<a style="background-image: url(<%= child.icon.url %>);" href="#"><%= child.name %></a>
<% if child.children.length > 0 %>
<%= render :partial => 'taxon', :locals => { :taxon => child } %>
<% end %>
</li>
<% end %>
</ul>
<% end %>

View File

@@ -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 %>
<li>
<%= button_link_to Spree.t(:back_to_taxonomies_list), spree.admin_taxonomies_path, :icon => 'icon-arrow-left' %>
</li>
<% end %>
<div id="ajax_error" class="errorExplanation" style="display:none;"></div>
<%= form_for [:admin, @taxonomy] do |f| %>
<fieldset class="no-border-top">
<%= render :partial => 'form', :locals => { :f => f } %>
<div>
<%= label_tag nil, Spree.t(:tree) %><br />
<script>
Spree.routes.taxonomy_taxons_path = "<%= spree.api_taxonomy_taxons_path(@taxonomy) %>";
Spree.routes.admin_taxonomy_taxons_path = "<%= spree.admin_taxonomy_taxons_path(@taxonomy) %>";
</script>
<div id="taxonomy_tree" class="tree"></div>
</div>
<div id="progress" style="display:none;">
<%= image_tag 'select2-spinner.gif', :title => 'Spinner', :style => "vertical-align:bottom;" %> <%= Spree.t(:updating) %>..
</div>
<div class="info"><%= Spree.t(:taxonomy_tree_instruction) %></div>
<br>
<div class="filter-actions actions">
<%= button Spree.t('actions.update'), 'icon-refresh' %>
<span class="or"><%= Spree.t(:or) %></span>
<%= button_link_to Spree.t('actions.cancel'), admin_taxonomies_path, :icon => 'icon-remove' %>
</div>
</fieldset>
<% end %>

View File

@@ -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 %>
<li>
<%= button_link_to Spree.t(:new_taxonomy), spree.new_admin_taxonomy_url, :icon => 'icon-plus', :id => 'admin_new_taxonomy_link' %></p>
</li>
<% end %>
<div id='list-taxonomies' data-hook>
<%= render :partial => 'list' %>
</div>

View File

@@ -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 %>
<li>
<%= button_link_to Spree.t(:back_to_taxonomies_list), spree.admin_taxonomies_path, :icon => 'icon-arrow-left' %>
</li>
<% end %>
<%= form_for [:admin, @taxonomy] do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
<fieldset class="no-border-top">
<br>
<div class="filter-actions actions" data-hook="buttons">
<%= button Spree.t(:create), 'icon-ok' %>
</div>
</fieldset>
<% end %>

View File

@@ -0,0 +1,23 @@
<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,23 @@
<%= 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,5 @@
object false
child(@taxons => :taxons) do
attributes :name, :pretty_name, :id
end