diff --git a/app/controllers/spree/admin/view_events_controller.rb b/app/controllers/spree/admin/view_events_controller.rb new file mode 100644 index 000000000..754689e62 --- /dev/null +++ b/app/controllers/spree/admin/view_events_controller.rb @@ -0,0 +1,23 @@ +module Spree + module Admin + class ViewEventsController < Spree::Admin::ResourceController + before_action :load_taxonomy_taxon + + def index + # Fetch the specific taxon associated with the taxonomy + @taxon = @taxonomy.taxons.find(params[:taxon_id]) + end + + private + + def model_class + Spree::Taxon + end + + def load_taxonomy_taxon + @taxonomy = Spree::Taxonomy.find(params[:taxonomy_id]) + @taxon = @taxonomy.taxons.find(params[:taxon_id]) + end + end + end +end diff --git a/app/models/spree_cm_commissioner/view_event.rb b/app/models/spree_cm_commissioner/view_event.rb new file mode 100644 index 000000000..70de2b9fc --- /dev/null +++ b/app/models/spree_cm_commissioner/view_event.rb @@ -0,0 +1,4 @@ +module SpreeCmCommissioner + class ViewEvent < ApplicationRecord + end +end diff --git a/app/views/spree/admin/guest_card_classes/_form.html.erb b/app/views/spree/admin/guest_card_classes/_form.html.erb index b4843298f..3a3baacbb 100644 --- a/app/views/spree/admin/guest_card_classes/_form.html.erb +++ b/app/views/spree/admin/guest_card_classes/_form.html.erb @@ -1,5 +1,5 @@ <% content_for :page_title do %> - <%= link_to Spree.t(:taxonomies), spree.admin_taxonomies_url %> / + <%= link_to @taxonomy.root.name, spree.edit_admin_taxonomy_url(@taxonomy) %> <% unless @taxon.root? %> / <%= link_to @taxon.name %> diff --git a/app/views/spree/admin/shared/_taxon_tabs.html.erb b/app/views/spree/admin/shared/_taxon_tabs.html.erb index ff5ca8f0c..db5c43a85 100644 --- a/app/views/spree/admin/shared/_taxon_tabs.html.erb +++ b/app/views/spree/admin/shared/_taxon_tabs.html.erb @@ -12,6 +12,7 @@ admin_taxonomy_taxon_taxon_vendors_url(@taxonomy.id, @taxon.id), class: "nav-link #{'active' if current == :vendors}" %> <% end if can?(:admin,SpreeCmCommissioner::TaxonVendor)%> + <% if @taxon.depth != 1 %> <%= content_tag :li, class: 'nav-item' do %> <%= link_to_with_icon 'inbox.svg', @@ -19,6 +20,14 @@ admin_taxonomy_taxon_classifications_url(@taxonomy.id, @taxon.id), class: "nav-link #{'active' if current == :products}" %> <% end if can?(:admin, Spree::Classification)%> + <%else%> + <%= content_tag :li, class: 'nav-item' do %> + <%= link_to_with_icon 'store.svg', + Spree.t(:sections), + admin_taxonomy_taxon_view_events_url(@taxonomy.id, @taxon.id), + class: "nav-link #{'active' if current == :view_events}" %> + <% end if can?(:admin,Spree::Taxon)%> + <%end%> <%= content_tag :li, class: 'nav-item' do %> <%= link_to_with_icon 'user.svg', @@ -33,5 +42,11 @@ Spree.t(:guest_card_classes), admin_taxonomy_taxon_guest_card_classes_url(@taxonomy.id, @taxon.id), class: "nav-link #{'active' if current == :guest_card_classes}" %> - <% end if can?(:admin,SpreeCmCommissioner::GuestCardClasses)%> + <% end if can?(:admin,SpreeCmCommissioner::GuestCardClasses)%> <% end %> + +<%if(@taxon.depth != 1) && current == :details %> + <%content_for(:page_actions) do%> + <%= button_link_to Spree.t(:back_to_parent_taxon), edit_admin_taxonomy_taxon_url(@taxonomy.id, @taxon.parent.id), class: "btn-success"%> + <%end%> +<%end%> \ No newline at end of file diff --git a/app/views/spree/admin/view_events/index.html.erb b/app/views/spree/admin/view_events/index.html.erb new file mode 100644 index 000000000..6dc362dca --- /dev/null +++ b/app/views/spree/admin/view_events/index.html.erb @@ -0,0 +1,36 @@ +<% content_for :page_title do %> + <%= link_to Spree.t(:taxonomies), spree.admin_taxonomies_url %>/ + + <%= link_to @taxonomy.root.name, spree.edit_admin_taxonomy_url(@taxonomy) %>/ + <% unless @taxon.root? %> + <%= @taxon.name %> + <% end %> +<% end %> + +<%= render partial: 'spree/admin/shared/taxon_tabs', locals: { current: :view_events } %> + + +