diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb index 90b7231d..b21a21f1 100644 --- a/app/controllers/items_controller.rb +++ b/app/controllers/items_controller.rb @@ -33,19 +33,29 @@ class ItemsController < ApplicationController # GET items/:id def show @current = current_user - @item = Item.find(params[:id]).authorize_to_show(@current) + @item = Item.find(params[:id]).authorize_to_show(@current) - if @item - @relatives = @item.network_as_json(@current).html_safe - else - redirect_to root_url and return - end + if @item + @relatives = @item.network_as_json(@current).html_safe + else + redirect_to root_url and return + end - respond_to do |format| + respond_to do |format| format.html { respond_with(@item, @user) } format.json { respond_with(@relatives) } end end + + # GET showcard/:id + def showcard + @current = current_user + @item = Item.find(params[:id]).authorize_to_show(@current) + + respond_to do |format| + format.json { respond_with(@item) } + end + end # POST items def create diff --git a/app/views/items/_showcard.html.erb b/app/views/items/_showcard.html.erb deleted file mode 100644 index 69eec1de..00000000 --- a/app/views/items/_showcard.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -
- <%= node.getData("itemcatname") %> -
-- <%= node.getData('desc') %> -
-+ <%= @item.item_category.name %> +
++ <%= @item.desc %> +
+