From 733e2024aa5bb03e6d88b17a8c574c2edca76b6f Mon Sep 17 00:00:00 2001 From: Gray Gilmore Date: Thu, 7 Jan 2016 11:13:10 -0500 Subject: [PATCH] Remove all remaining references to JSTree Now that we're editing our taxonomies with jQuery UI Sortable we no longer need to have these hanging around. We've actually already completely removed the JSTree library. --- api/app/controllers/spree/api/taxonomies_controller.rb | 5 ----- api/app/controllers/spree/api/taxons_controller.rb | 4 ---- api/app/views/spree/api/taxonomies/jstree.rabl | 8 -------- api/app/views/spree/api/taxons/jstree.rabl | 8 -------- api/config/routes.rb | 9 +-------- .../controllers/spree/api/taxonomies_controller_spec.rb | 7 ------- api/spec/controllers/spree/api/taxons_controller_spec.rb | 8 -------- 7 files changed, 1 insertion(+), 48 deletions(-) delete mode 100644 api/app/views/spree/api/taxonomies/jstree.rabl delete mode 100644 api/app/views/spree/api/taxons/jstree.rabl diff --git a/api/app/controllers/spree/api/taxonomies_controller.rb b/api/app/controllers/spree/api/taxonomies_controller.rb index 8e2e1643015..1ecf791e7b8 100644 --- a/api/app/controllers/spree/api/taxonomies_controller.rb +++ b/api/app/controllers/spree/api/taxonomies_controller.rb @@ -10,11 +10,6 @@ def show respond_with(taxonomy) end - # Because JSTree wants parameters in a *slightly* different format - def jstree - show - end - def create authorize! :create, Taxonomy @taxonomy = Taxonomy.new(taxonomy_params) diff --git a/api/app/controllers/spree/api/taxons_controller.rb b/api/app/controllers/spree/api/taxons_controller.rb index 02e03678df8..dcb4b1b32fd 100644 --- a/api/app/controllers/spree/api/taxons_controller.rb +++ b/api/app/controllers/spree/api/taxons_controller.rb @@ -21,10 +21,6 @@ def show respond_with(@taxon) end - def jstree - show - end - def create authorize! :create, Taxon @taxon = Spree::Taxon.new(taxon_params) diff --git a/api/app/views/spree/api/taxonomies/jstree.rabl b/api/app/views/spree/api/taxonomies/jstree.rabl deleted file mode 100644 index 01b25aa4ccd..00000000000 --- a/api/app/views/spree/api/taxonomies/jstree.rabl +++ /dev/null @@ -1,8 +0,0 @@ -object false -node(:data) { @taxonomy.root.name } -node(:attr) do - { :id => @taxonomy.root.id, - :name => @taxonomy.root.name - } -end -node(:state) { "closed" } diff --git a/api/app/views/spree/api/taxons/jstree.rabl b/api/app/views/spree/api/taxons/jstree.rabl deleted file mode 100644 index aed500e0f36..00000000000 --- a/api/app/views/spree/api/taxons/jstree.rabl +++ /dev/null @@ -1,8 +0,0 @@ -collection @taxon.children, :object_root => false -node(:data) { |taxon| taxon.name } -node(:attr) do |taxon| - { :id => taxon.id, - :name => taxon.name - } -end -node(:state) { "closed" } diff --git a/api/config/routes.rb b/api/config/routes.rb index 3fa61ed7d31..c88d981cfe8 100644 --- a/api/config/routes.rb +++ b/api/config/routes.rb @@ -91,14 +91,7 @@ resources :states, only: [:index, :show] resources :taxonomies do - member do - get :jstree - end - resources :taxons do - member do - get :jstree - end - end + resources :taxons end resources :taxons, only: [:index] diff --git a/api/spec/controllers/spree/api/taxonomies_controller_spec.rb b/api/spec/controllers/spree/api/taxonomies_controller_spec.rb index 19f75cf1ebf..44f681f2103 100644 --- a/api/spec/controllers/spree/api/taxonomies_controller_spec.rb +++ b/api/spec/controllers/spree/api/taxonomies_controller_spec.rb @@ -59,13 +59,6 @@ module Spree expect(children.first.key?('taxons')).to be true end - it "gets the jstree-friendly version of a taxonomy" do - api_get :jstree, :id => taxonomy.id - expect(json_response["data"]).to eq(taxonomy.root.name) - expect(json_response["attr"]).to eq({ "id" => taxonomy.root.id, "name" => taxonomy.root.name}) - expect(json_response["state"]).to eq("closed") - end - it "can learn how to create a new taxonomy" do api_get :new expect(json_response["attributes"]).to eq(attributes.map(&:to_s)) diff --git a/api/spec/controllers/spree/api/taxons_controller_spec.rb b/api/spec/controllers/spree/api/taxons_controller_spec.rb index a53968f46c7..6b64afff3f0 100644 --- a/api/spec/controllers/spree/api/taxons_controller_spec.rb +++ b/api/spec/controllers/spree/api/taxons_controller_spec.rb @@ -92,14 +92,6 @@ module Spree expect(json_response['taxons'].count).to eq 1 end - it "gets all taxons in JSTree form" do - api_get :jstree, :taxonomy_id => taxonomy.id, :id => taxon.id - response = json_response.first - expect(response["data"]).to eq(taxon2.name) - expect(response["attr"]).to eq({ "name" => taxon2.name, "id" => taxon2.id}) - expect(response["state"]).to eq("closed") - end - it "can learn how to create a new taxon" do api_get :new, :taxonomy_id => taxonomy.id expect(json_response["attributes"]).to eq(attributes.map(&:to_s))