mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Re-add taxons jstree action to make taxonomies config page work again
This commit is contained in:
@@ -21,6 +21,10 @@ module Spree
|
||||
respond_with(@taxon)
|
||||
end
|
||||
|
||||
def jstree
|
||||
show
|
||||
end
|
||||
|
||||
def create
|
||||
authorize! :create, Taxon
|
||||
@taxon = Taxon.new(params[:taxon])
|
||||
|
||||
@@ -92,6 +92,14 @@ Spree::Core::Engine.routes.prepend do
|
||||
end
|
||||
|
||||
resources :taxons, :only => [:index]
|
||||
|
||||
resources :taxonomies do
|
||||
resources :taxons do
|
||||
member do
|
||||
get :jstree
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
namespace :admin do
|
||||
|
||||
@@ -56,6 +56,15 @@ 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
|
||||
response["data"].should eq(taxon2.name)
|
||||
response["attr"].should eq("name" => taxon2.name, "id" => taxon2.id)
|
||||
response["state"].should 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))
|
||||
|
||||
Reference in New Issue
Block a user