-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Close #2249 Add section tab in taxon edit screen #2250
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module Spree | ||
module Admin | ||
class ViewEventsController < Spree::Admin::ResourceController | ||
before_action :load_taxonomy_taxon | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. explicitly add which action to apply:
|
||
|
||
def index | ||
# Fetch the specific taxon associated with the taxonomy | ||
@taxon = @taxonomy.taxons.find(params[:taxon_id]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you don't need this because the load_taxonomy_taxon already does just this. |
||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module SpreeCmCommissioner | ||
class ViewEvent < ApplicationRecord | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this, the model is linked to a table in the DB. |
||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 } %> | ||
|
||
|
||
<div id="sortableTreeArea"> | ||
<div class="row"> | ||
<div class="col-12"> | ||
<% if @taxonomy.root.present? %> | ||
<div class="card-body p-0 bg-light" data-controller="sortable-tree" data-sortable-tree-handle-value=".move-handle"> | ||
<div data-sortable-tree-parent-id-value="<%= @taxonomy.root.id %>"> | ||
|
||
<% if @taxonomy.root.children.present? %> | ||
|
||
<%= build_sortable_tree(@taxonomy, @taxon) %> | ||
<% else %> | ||
<div class="text-center no-objects-found m-5 m-5"> | ||
<%= Spree.t('admin.taxonomies.no_taxons') %> | ||
</div> | ||
<% end %> | ||
|
||
</div> | ||
</div> | ||
<% end %> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not decorating the existing TaxonController? Naming a new controller can be challenging, and if the new controller is minimal, the additional effort might not be justified.