2012-06-30 18:18:36 +02:00
|
|
|
<li id="story_<%= story.short_id %>" data-shortid="<%= story.short_id %>"
|
2015-02-11 18:37:03 +01:00
|
|
|
class="story <%= story.vote && story.vote[:vote] == 1 ? "upvoted" : "" %>
|
|
|
|
<%= story.vote && story.vote[:vote] == -1 ? "downvoted" : "" %>
|
2015-07-24 07:33:42 +02:00
|
|
|
<%= story.score <= -1 ? "negative_1" : "" %>
|
|
|
|
<%= story.score <= -3 ? "negative_3" : "" %>
|
|
|
|
<%= story.score <= -5 ? "negative_5" : "" %>
|
2015-02-11 18:37:03 +01:00
|
|
|
<%= story.is_hidden_by_cur_user ? "hidden" : "" %>
|
|
|
|
<%= story.is_expired? ? "expired" : "" %>">
|
2014-02-08 21:28:27 +01:00
|
|
|
<div class="story_liner">
|
2012-12-09 05:38:36 +01:00
|
|
|
<div class="voters">
|
2012-06-17 03:15:46 +02:00
|
|
|
<% if @user %>
|
2012-06-30 18:18:36 +02:00
|
|
|
<a class="upvoter"></a>
|
2012-06-17 03:15:46 +02:00
|
|
|
<% else %>
|
2015-01-03 00:02:55 +01:00
|
|
|
<%= link_to "", login_path, :class => "upvoter" %>
|
2012-06-17 03:15:46 +02:00
|
|
|
<% end %>
|
2014-03-04 00:14:33 +01:00
|
|
|
<div class="score"><%= story.score %></div>
|
2012-12-09 05:38:36 +01:00
|
|
|
</div>
|
|
|
|
<div class="details">
|
|
|
|
<span class="link">
|
2012-07-05 02:33:12 +02:00
|
|
|
<% if story.can_be_seen_by_user?(@user) %>
|
2015-03-22 03:56:34 +01:00
|
|
|
<a href="<%= story.url_or_comments_path %>"><%=
|
|
|
|
break_long_words(story.title) %></a>
|
2012-07-05 02:33:12 +02:00
|
|
|
<% end %>
|
|
|
|
<% if story.is_gone? %>
|
2016-11-10 11:16:52 +01:00
|
|
|
<%= t('.storyremovedby', :user => story.is_moderated? ? t('.moderator') : t('.originalsubmitter')) %>
|
2012-07-05 02:33:12 +02:00
|
|
|
<% end %>
|
2012-12-09 05:38:36 +01:00
|
|
|
</span>
|
2015-11-04 17:52:27 +01:00
|
|
|
<% if story.markeddown_description.present? %>
|
2017-05-20 14:48:33 +02:00
|
|
|
<a class="description_present" title="<%= truncate(story.description,
|
|
|
|
:length => 500) %>" href="<%= story.comments_path %>">☶</a>
|
2015-11-04 17:52:27 +01:00
|
|
|
<% end %>
|
2012-07-05 02:33:12 +02:00
|
|
|
<% if story.can_be_seen_by_user?(@user) %>
|
|
|
|
<span class="tags">
|
2015-01-05 19:06:24 +01:00
|
|
|
<% story.sorted_taggings.each do |tagging| %>
|
2015-01-03 00:02:55 +01:00
|
|
|
<a href="<%= tag_path(tagging.tag.tag) %>"
|
2013-08-05 08:02:48 +02:00
|
|
|
class="<%= tagging.tag.css_class %>"
|
|
|
|
title="<%= tagging.tag.description %>"><%= tagging.tag.tag %></a>
|
2012-07-05 02:33:12 +02:00
|
|
|
<% end %>
|
|
|
|
</span>
|
2015-01-29 17:04:02 +01:00
|
|
|
<% if story.domain.present? %>
|
|
|
|
<a class="domain" href="<%= story.domain_search_url %>"><%=
|
2015-03-22 03:56:34 +01:00
|
|
|
break_long_words(story.domain) %></a>
|
2015-01-29 17:04:02 +01:00
|
|
|
<% end %>
|
2014-04-09 00:51:12 +02:00
|
|
|
|
|
|
|
<% if defined?(single_story) && single_story %>
|
|
|
|
<% story.merged_stories.each do |ms| %>
|
|
|
|
<br>
|
|
|
|
<span class="merge"></span>
|
|
|
|
<span class="link">
|
2015-03-22 03:56:34 +01:00
|
|
|
<a href="<%= ms.url_or_comments_path %>"><%=
|
|
|
|
break_long_words(ms.title) %></a>
|
2014-04-09 00:51:12 +02:00
|
|
|
</span>
|
|
|
|
<span class="tags">
|
2015-01-05 19:06:24 +01:00
|
|
|
<% ms.sorted_taggings.each do |tagging| %>
|
2015-01-03 00:02:55 +01:00
|
|
|
<a href="<%= tag_path(tagging.tag.tag) %>"
|
2014-04-09 00:51:12 +02:00
|
|
|
class="<%= tagging.tag.css_class %>"
|
|
|
|
title="<%= tagging.tag.description %>"><%= tagging.tag.tag %></a>
|
|
|
|
<% end %>
|
|
|
|
</span>
|
2015-01-29 17:04:02 +01:00
|
|
|
<% if ms.domain.present? %>
|
|
|
|
<a class="domain" href="<%= ms.domain_search_url %>"><%=
|
2015-03-22 03:56:34 +01:00
|
|
|
break_long_words(ms.domain) %></a>
|
2015-01-29 17:04:02 +01:00
|
|
|
<% end %>
|
2015-01-02 01:54:26 +01:00
|
|
|
<span class="byline">
|
2016-01-21 18:58:26 +01:00
|
|
|
<% if (@user && @user.show_avatars?) || !@user %>
|
2017-05-19 14:06:09 +02:00
|
|
|
<a href="/u/<%= ms.user.username %>"><%=
|
|
|
|
avatar_img(ms.user, 16) %></a>
|
2015-07-31 17:51:33 +02:00
|
|
|
<% end %>
|
2015-07-31 00:15:48 +02:00
|
|
|
<% if story.user_is_author? %>
|
2016-11-10 11:16:52 +01:00
|
|
|
<%= t('.authoredby') %>
|
2015-11-13 10:28:32 +01:00
|
|
|
<% else %>
|
2016-11-10 11:16:52 +01:00
|
|
|
<%= t('.via') %>
|
2015-07-31 00:15:48 +02:00
|
|
|
<% end %>
|
2015-07-31 20:10:44 +02:00
|
|
|
<a href="/u/<%= ms.user.username %>" class="<%=
|
2015-10-16 20:08:05 +02:00
|
|
|
ms.html_class_for_user %>"><%= ms.user.username %></a>
|
2015-01-02 01:54:26 +01:00
|
|
|
|
2016-11-10 11:16:52 +01:00
|
|
|
<%= distance_of_time_in_words(ms.created_at, Time.now, :strip_about => true) %>
|
2017-05-23 13:42:02 +02:00
|
|
|
<% if ms.is_editable_by_user?(@user) %>
|
|
|
|
|
|
|
|
|
<a href="<%= edit_story_path(ms.short_id) %>"><%= t('.edit') %></a>
|
|
|
|
<% end %>
|
2015-01-02 01:54:26 +01:00
|
|
|
</span>
|
2014-04-09 00:51:12 +02:00
|
|
|
<% end %>
|
|
|
|
<% end %>
|
2012-07-05 02:33:12 +02:00
|
|
|
<% end %>
|
2015-07-31 00:56:09 +02:00
|
|
|
|
|
|
|
<% if !(defined?(single_story) && single_story) && @user &&
|
|
|
|
@user.show_story_previews? %>
|
2015-07-31 01:12:57 +02:00
|
|
|
<% if (sc = story.description_or_story_cache(500)).present? %>
|
2015-07-31 00:56:09 +02:00
|
|
|
<div class="story_content">
|
2015-07-31 01:12:57 +02:00
|
|
|
<%= break_long_words(sc) %>
|
2015-07-31 00:56:09 +02:00
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
|
2012-12-09 05:38:36 +01:00
|
|
|
<div class="byline">
|
2016-01-21 18:58:26 +01:00
|
|
|
<% if (@user && @user.show_avatars?) || !@user %>
|
2017-05-19 14:06:09 +02:00
|
|
|
<a href="/u/<%= story.user.username %>"><%=
|
|
|
|
avatar_img(story.user, 16) %></a>
|
2015-07-31 17:51:33 +02:00
|
|
|
<% end %>
|
2012-07-12 01:28:27 +02:00
|
|
|
<% if story.previewing %>
|
2015-11-13 10:28:32 +01:00
|
|
|
<% if story.user_is_author? %>
|
2016-11-10 11:16:52 +01:00
|
|
|
<%= t('.authoredby') %>
|
2015-11-13 10:28:32 +01:00
|
|
|
<% else %>
|
2016-11-10 11:16:52 +01:00
|
|
|
<%= t('.via') %>
|
2015-11-13 10:28:32 +01:00
|
|
|
<% end %>
|
2015-10-16 20:08:05 +02:00
|
|
|
<a class="<%= story.html_class_for_user %>"><%=
|
2015-07-31 00:15:48 +02:00
|
|
|
story.user.username %></a>
|
2016-11-10 11:16:52 +01:00
|
|
|
<%= t('.justnow') %>
|
2012-07-12 01:28:27 +02:00
|
|
|
<% else %>
|
2015-11-13 10:28:32 +01:00
|
|
|
<% if story.user_is_author? %>
|
2016-11-10 11:16:52 +01:00
|
|
|
<%= t('.authoredby') %>
|
2015-11-13 10:28:32 +01:00
|
|
|
<% else %>
|
2016-11-10 11:16:52 +01:00
|
|
|
<%= t('.via') %>
|
2015-11-13 10:28:32 +01:00
|
|
|
<% end %>
|
2015-07-31 00:15:48 +02:00
|
|
|
<a href="/u/<%= story.user.username %>" class="<%=
|
2015-10-16 20:08:05 +02:00
|
|
|
story.html_class_for_user %>"><%= story.user.username %></a>
|
2014-11-07 20:42:33 +01:00
|
|
|
|
2016-11-10 11:16:52 +01:00
|
|
|
<%= distance_of_time_in_words(story.created_at, Time.now, :strip_about => true) %>
|
2012-06-17 03:15:46 +02:00
|
|
|
|
2012-07-12 01:28:27 +02:00
|
|
|
<% if story.is_editable_by_user?(@user) %>
|
2012-07-05 02:33:12 +02:00
|
|
|
|
|
2017-05-18 19:02:21 +02:00
|
|
|
<a href="<%= edit_story_path(story.short_id) %>" class="<%=
|
|
|
|
story.has_suggestions? ? "story_has_suggestions" : "" %>"><%= t('.edit') %></a>
|
2012-07-12 01:28:27 +02:00
|
|
|
|
|
|
|
<% if story.is_gone? && story.is_undeletable_by_user?(@user) %>
|
|
|
|
|
|
2016-11-10 11:16:52 +01:00
|
|
|
<%= link_to t('.undelete'), story_undelete_path(story.short_id),
|
2012-07-12 01:28:27 +02:00
|
|
|
:method => :post, :data => {
|
2016-11-10 11:16:52 +01:00
|
|
|
:confirm => t('.confirmundelete') } %>
|
2012-07-12 01:28:27 +02:00
|
|
|
<% elsif !story.is_gone? %>
|
|
|
|
|
|
2013-01-08 00:20:41 +01:00
|
|
|
<% if story.user_id != @user.try(:id) &&
|
|
|
|
@user.try(:is_moderator?) %>
|
2016-11-10 11:16:52 +01:00
|
|
|
<%= link_to t('.delete'), story_path(story.short_id),
|
2013-01-08 00:20:41 +01:00
|
|
|
:method => :delete, :class => "mod_story_link" %>
|
|
|
|
<% else %>
|
2016-11-10 11:16:52 +01:00
|
|
|
<%= link_to t('.delete'), story_path(story.short_id),
|
2013-01-08 00:20:41 +01:00
|
|
|
:method => :delete, :data => {
|
2016-11-10 11:16:52 +01:00
|
|
|
:confirm => t('.confirmdelete') } %>
|
2013-01-08 00:20:41 +01:00
|
|
|
<% end %>
|
2012-07-12 01:28:27 +02:00
|
|
|
<% end %>
|
2015-10-17 17:38:48 +02:00
|
|
|
<% end %>
|
|
|
|
<% if story.can_have_suggestions_from_user?(@user) %>
|
2016-11-10 11:16:52 +01:00
|
|
|
| <%= link_to t('.suggest'), story_suggest_path(story.short_id),
|
2015-10-15 03:32:24 +02:00
|
|
|
:class => "suggester" %>
|
2012-07-12 01:28:27 +02:00
|
|
|
<% end %>
|
2014-03-04 00:14:33 +01:00
|
|
|
<% if !story.is_gone? && @user %>
|
2015-02-11 18:37:03 +01:00
|
|
|
<% if @user && story.vote && story.vote[:vote] == -1 %>
|
2016-11-10 11:16:52 +01:00
|
|
|
| <a class="flagger"><%= t('.unflag') %> (<%=
|
2015-02-11 18:37:03 +01:00
|
|
|
Vote::STORY_REASONS[story.vote[:reason]].to_s.downcase %>)</a>
|
|
|
|
<% elsif @user && @user.can_downvote?(story) %>
|
2016-11-10 11:16:52 +01:00
|
|
|
| <a class="flagger"><%= t('.flag') %></a>
|
2014-07-02 17:04:48 +02:00
|
|
|
<% end %>
|
2015-02-11 18:37:03 +01:00
|
|
|
<% if story.is_hidden_by_cur_user %>
|
2016-11-10 11:16:52 +01:00
|
|
|
| <%= link_to t('.unhide'), story_unhide_path(story.short_id),
|
2014-03-04 00:14:33 +01:00
|
|
|
:class => "hider" %>
|
|
|
|
<% else %>
|
2016-11-10 11:16:52 +01:00
|
|
|
| <%= link_to t('.hide'), story_hide_path(story.short_id),
|
2014-03-04 00:14:33 +01:00
|
|
|
:class => "hider" %>
|
|
|
|
<% end %>
|
2014-03-13 16:51:12 +01:00
|
|
|
<% if defined?(single_story) && single_story && story.hider_count > 0 %>
|
|
|
|
(hidden by <%= pluralize(story.hider_count, "user") %>)
|
|
|
|
<% end %>
|
2014-03-04 00:14:33 +01:00
|
|
|
<% end %>
|
2016-02-10 15:39:42 +01:00
|
|
|
<% if story.url.present? %>
|
|
|
|
|
|
2017-05-20 15:18:56 +02:00
|
|
|
<a href="<%= story.archive_url %>" rel="nofollow"
|
2017-05-17 19:21:23 +02:00
|
|
|
target="_new"><%= t('.cached') %></a>
|
2016-02-10 15:39:42 +01:00
|
|
|
<% end %>
|
2016-02-02 18:56:10 +01:00
|
|
|
<% if !story.is_gone? %>
|
2014-02-08 21:28:27 +01:00
|
|
|
<span class="comments_label">
|
|
|
|
|
|
2016-02-02 18:56:10 +01:00
|
|
|
<a href="<%= story.comments_path %>">
|
|
|
|
<% if story.comments_count == 0 %>
|
2016-11-10 11:16:52 +01:00
|
|
|
<%= t('.nocomment') %>
|
2016-02-02 18:56:10 +01:00
|
|
|
<% else %>
|
|
|
|
<%= story.comments_count %>
|
2016-11-10 11:16:52 +01:00
|
|
|
<%= story.comments_count == 1 ? t('.commentsingular') : t('.commentplurial') %>
|
2016-02-02 18:56:10 +01:00
|
|
|
<% end %>
|
|
|
|
</a>
|
2014-02-08 21:28:27 +01:00
|
|
|
</span>
|
2012-06-30 18:18:36 +02:00
|
|
|
<% end %>
|
2014-03-18 06:06:43 +01:00
|
|
|
|
2015-09-03 21:18:25 +02:00
|
|
|
<% if defined?(single_story) && single_story &&
|
|
|
|
((story.downvotes > 0 && @user && @user.is_moderator?) ||
|
2015-10-17 00:03:54 +02:00
|
|
|
(story.downvotes >= 3 || story.score <= 0)) %>
|
2015-08-10 22:36:01 +02:00
|
|
|
| <%= story.vote_summary_for(@user).downcase %>
|
2014-03-18 06:06:43 +01:00
|
|
|
<% end %>
|
2012-06-30 18:18:36 +02:00
|
|
|
<% end %>
|
2012-12-09 05:38:36 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2014-02-08 21:28:27 +01:00
|
|
|
</div>
|
|
|
|
<div class="mobile_comments <%= story.comments_count == 0 ? "zero" : "" %>"
|
|
|
|
style="display: none;">
|
2015-01-03 00:02:55 +01:00
|
|
|
<a href="<%= story.comments_path %>"><%= story.comments_count %></a>
|
2014-02-08 21:28:27 +01:00
|
|
|
</div>
|
2012-06-17 03:15:46 +02:00
|
|
|
</li>
|