made showcard into a non-partial view, in desperation
This commit is contained in:
parent
5d552a5d00
commit
8d1171c2c8
3 changed files with 46 additions and 34 deletions
|
@ -33,19 +33,29 @@ class ItemsController < ApplicationController
|
||||||
# GET items/:id
|
# GET items/:id
|
||||||
def show
|
def show
|
||||||
@current = current_user
|
@current = current_user
|
||||||
@item = Item.find(params[:id]).authorize_to_show(@current)
|
@item = Item.find(params[:id]).authorize_to_show(@current)
|
||||||
|
|
||||||
if @item
|
if @item
|
||||||
@relatives = @item.network_as_json(@current).html_safe
|
@relatives = @item.network_as_json(@current).html_safe
|
||||||
else
|
else
|
||||||
redirect_to root_url and return
|
redirect_to root_url and return
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { respond_with(@item, @user) }
|
format.html { respond_with(@item, @user) }
|
||||||
format.json { respond_with(@relatives) }
|
format.json { respond_with(@relatives) }
|
||||||
end
|
end
|
||||||
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
|
# POST items
|
||||||
def create
|
def create
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
<div class="showcard item_<%= node.id %>">
|
|
||||||
<div class="CardOnGraph" title="Click to Hide" id="item_' + node.id + '">
|
|
||||||
<p class="type">
|
|
||||||
<%= node.getData("itemcatname") %>
|
|
||||||
</p>
|
|
||||||
<img alt="<%= node.getData("itemcatname") %>" class="icon" height="50" src="<%= imgArray[node.getData("itemcatname")].src %>" width="50" />
|
|
||||||
<div class="scroll">
|
|
||||||
<a href="/items/<%=node.id%>" class="title">
|
|
||||||
<%= node.name %>
|
|
||||||
</a>
|
|
||||||
<div class="contributor">
|
|
||||||
Added by:
|
|
||||||
<a href="/users/<%= node.getData('userid')%>">
|
|
||||||
<%= node.getData('username') %>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="desc">
|
|
||||||
<p>
|
|
||||||
<%= node.getData('desc') %>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div><!-- div.scroll -->
|
|
||||||
<a href="<%= node.getData('link') %>" class="link" target="_blank">
|
|
||||||
<%= node.getData('link') %>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
29
app/views/items/showcard.html.erb
Normal file
29
app/views/items/showcard.html.erb
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<div class="showcard item_<%= @item.id %>">
|
||||||
|
<div class="CardOnGraph" title="Click to Hide" id="item_' + node.id + '">
|
||||||
|
<p class="type">
|
||||||
|
<%= @item.item_category.name %>
|
||||||
|
</p>
|
||||||
|
<img alt="<%= @item.item_category.name %>"
|
||||||
|
src="/assets/<%= @item.item_category.name %>.png"
|
||||||
|
class="icon" height="50" width="50" />
|
||||||
|
<div class="scroll">
|
||||||
|
<a href="/items/<%=@item.id%>" class="title">
|
||||||
|
<%= node.name %>
|
||||||
|
</a>
|
||||||
|
<div class="contributor">
|
||||||
|
Added by:
|
||||||
|
<a href="/users/<%= @item.user_id%>">
|
||||||
|
<%= User.all.find(@item.user_id).name %>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="desc">
|
||||||
|
<p>
|
||||||
|
<%= @item.desc %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div><!-- div.scroll -->
|
||||||
|
<a href="<%= @item.link %>" class="link" target="_blank">
|
||||||
|
<%= @item.link %>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
Loading…
Reference in a new issue