From 8d1171c2c8d294b40f780eb3b74c2d789f5eb994 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sun, 30 Dec 2012 23:30:18 -0500 Subject: [PATCH] made showcard into a non-partial view, in desperation --- app/controllers/items_controller.rb | 24 +++++++++++++++++------- app/views/items/_showcard.html.erb | 27 --------------------------- app/views/items/showcard.html.erb | 29 +++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 34 deletions(-) delete mode 100644 app/views/items/_showcard.html.erb create mode 100644 app/views/items/showcard.html.erb 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(" class="icon" height="50" src="<%= imgArray[node.getData("itemcatname")].src %>" width="50" /> -
- - <%= node.name %> - - -
-

- <%= node.getData('desc') %> -

-
-
- - <%= node.getData('link') %> - -
-
diff --git a/app/views/items/showcard.html.erb b/app/views/items/showcard.html.erb new file mode 100644 index 00000000..a1d0c508 --- /dev/null +++ b/app/views/items/showcard.html.erb @@ -0,0 +1,29 @@ +
+
+

+ <%= @item.item_category.name %> +

+ <%= @item.item_category.name %> +
+ + <%= node.name %> + + +
+

+ <%= @item.desc %> +

+
+
+ + <%= @item.link %> + +
+