Skip to content
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

Remove awesome nested set gem and dependencies [OFN-11636] #12749

Merged
merged 6 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ gem "image_processing"

gem 'activemerchant', '>= 1.78.0'
gem 'angular-rails-templates', '>= 0.3.0'
gem 'awesome_nested_set'
gem 'ransack', '~> 4.1.0'
gem 'responders'
gem 'webpacker', '~> 5'
Expand Down
3 changes: 0 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ GEM
activerecord (>= 3.1.0, < 8)
ast (2.4.2)
attr_required (1.0.2)
awesome_nested_set (3.6.0)
activerecord (>= 4.0.0, < 7.2)
aws-eventstream (1.3.0)
aws-partitions (1.929.0)
aws-sdk-core (3.196.1)
Expand Down Expand Up @@ -863,7 +861,6 @@ DEPENDENCIES
angularjs-file-upload-rails (~> 2.4.1)
angularjs-rails (= 1.8.0)
arel-helpers (~> 2.12)
awesome_nested_set
aws-sdk-s3
bigdecimal (= 3.0.2)
bootsnap
Expand Down
1 change: 0 additions & 1 deletion app/assets/javascripts/admin/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
//= require jquery.ui.all
//= require jquery.powertip
//= require jquery.cookie
//= require jquery.jstree/jquery.jstree
//= require jquery.vAlign
//= require angular
//= require angular-resource
Expand Down

This file was deleted.

139 changes: 0 additions & 139 deletions app/assets/javascripts/admin/spree/taxons/taxonomy.js.coffee

This file was deleted.

16 changes: 0 additions & 16 deletions app/controllers/api/v0/taxonomies_controller.rb

This file was deleted.

30 changes: 4 additions & 26 deletions app/controllers/api/v0/taxons_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,20 @@ module V0
class TaxonsController < Api::V0::BaseController
respond_to :json

skip_authorization_check only: [:index, :show, :jstree]
skip_authorization_check only: [:index, :show]

def index
@taxons = if taxonomy
taxonomy.root.children
elsif params[:ids]
@taxons = if params[:ids]
Spree::Taxon.where(id: raw_params[:ids].split(","))
else
Spree::Taxon.ransack(raw_params[:q]).result
end
render json: @taxons, each_serializer: Api::TaxonSerializer
end

def jstree
@taxon = taxon
render json: @taxon.children, each_serializer: Api::TaxonJstreeSerializer
end

def create
authorize! :create, Spree::Taxon
@taxon = Spree::Taxon.new(taxon_params)
@taxon.taxonomy_id = params[:taxonomy_id]
taxonomy = Spree::Taxonomy.find_by(id: params[:taxonomy_id])

if taxonomy.nil?
@taxon.errors.add(:taxonomy_id, I18n.t(:invalid_taxonomy_id, scope: 'spree.api'))
invalid_resource!(@taxon) && return
end

@taxon.parent_id = taxonomy.root.id unless params.dig(:taxon, :parent_id)

if @taxon.save
render json: @taxon, serializer: Api::TaxonSerializer, status: :created
Expand All @@ -60,20 +44,14 @@ def destroy

private

def taxonomy
return if params[:taxonomy_id].blank?

@taxonomy ||= Spree::Taxonomy.find(params[:taxonomy_id])
end

def taxon
@taxon ||= taxonomy.taxons.find(params[:id])
@taxon = Spree::Taxon.find(params[:id])
end

def taxon_params
return if params[:taxon].blank?

params.require(:taxon).permit([:name, :parent_id, :position])
params.require(:taxon).permit([:name, :position])
end
end
end
Expand Down
27 changes: 0 additions & 27 deletions app/controllers/spree/admin/taxonomies_controller.rb

This file was deleted.

Loading
Loading