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

85 lines
3.1 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" : "" %>">
2012-12-09 05:38:36 +01:00
<div class="voters">
<% if @user %>
<a class="upvoter"></a>
<% else %>
<%= link_to "", login_url, :class => "upvoter" %>
<% end %>
2013-03-17 21:39:48 +01:00
<div class="score"><%= story.upvotes - story.downvotes %></div>
<% if @user %>
<a class="downvoter"></a>
<% else %>
<%= link_to "", login_url, :class => "downvoter" %>
<% end %>
2012-12-09 05:38:36 +01:00
</div>
<div class="details">
<span class="link">
<% if story.can_be_seen_by_user?(@user) %>
<a href="<%= story.url_or_comments_url %>"><%= story.title %></a>
<% end %>
<% if story.is_gone? %>
[Story removed by <%= story.is_moderated? ? "moderator" :
"original submitter" %>]
<% end %>
2012-12-09 05:38:36 +01:00
</span>
<% if story.can_be_seen_by_user?(@user) %>
<span class="tags">
<% story.taggings.sort_by{|t| t.tag.tag }.sort_by{|t|
t.tag.tag == "pdf" ? -1 : 0 }.each do |tagging| %>
<a href="<%= tag_url(tagging.tag.tag) %>"
class="<%= tagging.tag.css_class %>"
title="<%= tagging.tag.description %>"><%= tagging.tag.tag %></a>
<% end %>
</span>
2013-03-17 21:39:48 +01:00
<span class="domain"><%= story.domain %></span>
<% end %>
2012-12-09 05:38:36 +01:00
<div class="byline">
2012-07-12 01:28:27 +02:00
<% if story.previewing %>
by <a><%= story.user.username %></a>
just now
<% else %>
by <a href="/u/<%= story.user.username %>"><%= story.user.username
%></a> <%= raw(time_ago_in_words_label(story.created_at).
gsub(/^about /, "")) %> ago
2012-07-12 01:28:27 +02:00
<% if story.is_editable_by_user?(@user) %>
|
2012-07-12 01:28:27 +02:00
<a href="<%= edit_story_url(story.short_id) %>">edit</a>
<% if story.is_gone? && story.is_undeletable_by_user?(@user) %>
|
<%= link_to "undelete", story_undelete_url(story.short_id),
:method => :post, :data => {
:confirm => "Are you sure you want to undelete this story?" } %>
<% elsif !story.is_gone? %>
|
<% if story.user_id != @user.try(:id) &&
@user.try(:is_moderator?) %>
<%= link_to "delete", story_url(story.short_id),
:method => :delete, :class => "mod_story_link" %>
<% else %>
<%= link_to "delete", story_url(story.short_id),
:method => :delete, :data => {
:confirm => "Are you sure you want to delete this story?" } %>
<% end %>
2012-07-12 01:28:27 +02:00
<% end %>
<% end %>
<% if !story.is_gone? %>
|
2012-07-12 01:28:27 +02:00
<a href="<%= story.comments_url %>"><%=
(c = story.comments_count) == 0 ? "discuss" :
2012-07-12 01:28:27 +02:00
"#{c} comment#{c == 1 ? "" : "s"}" %></a>
<% end %>
<% if defined?(single_story) && single_story %>
<% if story.downvotes > 0 %>
| <%= story.vote_summary.downcase %>
<% end %>
<% end %>
<% end %>
2012-12-09 05:38:36 +01:00
</div>
</div>
</li>