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

140 lines
5.1 KiB
Plaintext

<li id="story_<%= story.short_id %>" data-shortid="<%= story.short_id %>"
class="story <%= story.vote == 1 ? "upvoted" : "" %> <%= story.vote == -1 ?
"downvoted" : "" %> <%= story.vote == 0 ? "hidden" : "" %> <%= story.is_expired? ?
"expired" : "" %>">
<div class="story_liner">
<div class="voters">
<% if @user %>
<a class="upvoter"></a>
<% else %>
<%= link_to "", login_path, :class => "upvoter" %>
<% end %>
<div class="score"><%= story.score %></div>
</div>
<div class="details">
<span class="link">
<% if story.can_be_seen_by_user?(@user) %>
<a href="<%= story.url_or_comments_path %>"><%= story.title %></a>
<% end %>
<% if story.is_gone? %>
[Story removed by <%= story.is_moderated? ? "moderator" :
"original submitter" %>]
<% end %>
</span>
<% if story.can_be_seen_by_user?(@user) %>
<span class="tags">
<% story.sorted_taggings.each do |tagging| %>
<a href="<%= tag_path(tagging.tag.tag) %>"
class="<%= tagging.tag.css_class %>"
title="<%= tagging.tag.description %>"><%= tagging.tag.tag %></a>
<% end %>
</span>
<% if story.domain.present? %>
<a class="domain" href="<%= story.domain_search_url %>"><%=
story.domain %></a>
<% end %>
<% if defined?(single_story) && single_story %>
<% story.merged_stories.each do |ms| %>
<br>
<span class="merge"></span>
<span class="link">
<a href="<%= ms.url_or_comments_path %>"><%= ms.title %></a>
</span>
<span class="tags">
<% ms.sorted_taggings.each do |tagging| %>
<a href="<%= tag_path(tagging.tag.tag) %>"
class="<%= tagging.tag.css_class %>"
title="<%= tagging.tag.description %>"><%= tagging.tag.tag %></a>
<% end %>
</span>
<% if ms.domain.present? %>
<a class="domain" href="<%= ms.domain_search_url %>"><%=
ms.domain %></a>
<% end %>
<span class="byline">
by <a href="/u/<%= ms.user.username %>"
<% if ms.user.is_new? %>
class="new_user"
<% end %>><%= ms.user.username %></a>
<%= time_ago_in_words_label(ms.created_at, :strip_about => true) %>
ago
</span>
<% end %>
<% end %>
<% end %>
<div class="byline">
<% if story.previewing %>
by <a><%= story.user.username %></a>
just now
<% else %>
by <a href="/u/<%= story.user.username %>"
<% if story.user.is_new? %>
class="new_user"
<% end %>><%= story.user.username %></a>
<%= time_ago_in_words_label(story.created_at, :strip_about => true) %>
ago
<% if story.is_editable_by_user?(@user) %>
|
<a href="<%= edit_story_path(story.short_id) %>">edit</a>
<% if story.is_gone? && story.is_undeletable_by_user?(@user) %>
|
<%= link_to "undelete", story_undelete_path(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_path(story.short_id),
:method => :delete, :class => "mod_story_link" %>
<% else %>
<%= link_to "delete", story_path(story.short_id),
:method => :delete, :data => {
:confirm => "Are you sure you want to delete this story?" } %>
<% end %>
<% end %>
<% end %>
<% if !story.is_gone? && @user %>
<% if @user && @user.can_downvote?(story) %>
| <a class="flagger">flag</a>
<% end %>
<% if story.vote == 0 %>
| <%= link_to "unhide", story_unhide_path(story.short_id),
:class => "hider" %>
<% else %>
| <%= link_to "hide", story_hide_path(story.short_id),
:class => "hider" %>
<% end %>
<% if defined?(single_story) && single_story && story.hider_count > 0 %>
(hidden by <%= pluralize(story.hider_count, "user") %>)
<% end %>
<% end %>
<% if !story.is_gone? && (@user || story.comments_count > 0) %>
<span class="comments_label">
|
<a href="<%= story.comments_path %>"><%= story.comments_count == 0 ?
"discuss" : "#{story.comments_count} comment" <<
(story.comments_count == 1 ? "" : "s") %></a>
</span>
<% end %>
<% if defined?(single_story) && single_story %>
<% if story.downvotes > 0 %>
| <%= story.vote_summary_for(@user).downcase %>
<% end %>
<% end %>
<% end %>
</div>
</div>
</div>
<div class="mobile_comments <%= story.comments_count == 0 ? "zero" : "" %>"
style="display: none;">
<a href="<%= story.comments_path %>"><%= story.comments_count %></a>
</div>
</li>