journalduhacker/app/views/stories/_listdetail.html.erb

58 lines
1.9 KiB
Plaintext
Raw Normal View History

<li id="story_<%= story.short_id %>" data-shortid="<%= story.short_id %>"
class="story <%= story.vote == 1 ? "upvoted" : (story.vote == -1 ?
"downvoted" : "") %> <%= story.is_expired? ? "expired" : "" %>">
<div class="voters">
<% if @user %>
<a class="upvoter"></a>
<% else %>
<%= link_to "", login_url, :class => "upvoter" %>
<% end %>
<div class="score">
<%= story.upvotes - story.downvotes %>
</div>
<% if @user %>
<a class="downvoter"></a>
<% else %>
<%= link_to "", login_url, :class => "downvoter" %>
<% end %>
</div>
<div class="details">
<span class="link">
<a href="<%= story.url_or_comments_url %>"><%= story.title %></a>
</span>
<span class="tags">
<% story.taggings.each do |tagging| %>
<a href="<%= tag_url(tagging.tag.tag) %>" class="tag tag_<%=
tagging.tag.tag %>"><%= tagging.tag.tag %></a>
<% end %>
</span>
<span class="domain">
<%= story.domain %>
</span>
<div class="byline">
by <a href="/u/<%= story.user.username %>"><%= story.user.username %></a>
<%= time_ago_in_words(story.created_at).gsub(/^about /, "") %> ago
<% if story.is_editable_by_user? @user %>
|
<a href="<%= edit_story_url(story.short_id) %>">edit</a>
|
<% if story.is_expired? %>
<%= link_to "undelete", story_undelete_url(story.short_id),
:method => :post,
:confirm => "Are you sure you want to undelete this story?" %>
<% else %>
<%= link_to "delete", story_url(story.short_id), :method => :delete,
:confirm => "Are you sure you want to delete this story?" %>
<% end %>
<% end %>
<% if !story.is_expired? %>
|
<a href="<%= story.comments_url %>"><%=
(c = story.comment_count) == 0 ? "discuss" :
"#{c} comment#{c == 1 ? "" : "s"}" %></a>
<% end %>
</div>
</div>
</li>