2014-02-21 18:56:43 +01:00
|
|
|
<% if f.object.errors.count == 1 && f.object.already_posted_story %>
|
|
|
|
<div class="flash-error">
|
|
|
|
<h2>Error: This story was already submitted <%=
|
2015-12-16 19:35:19 +01:00
|
|
|
time_ago_in_words_label(f.object.already_posted_story.created_at) %></h2>
|
2014-02-21 18:56:43 +01:00
|
|
|
<p>
|
2015-01-03 00:02:55 +01:00
|
|
|
Please view the <a href="<%= f.object.already_posted_story.comments_path %>"
|
2014-02-21 18:56:43 +01:00
|
|
|
target="_blank">previous discussion</a> for this story.
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<% elsif f.object.errors.any? %>
|
|
|
|
<%= error_messages_for f.object %>
|
|
|
|
<% elsif !f.object.errors.any? && f.object.already_posted_story %>
|
2014-01-13 07:10:31 +01:00
|
|
|
<div class="flash-notice">
|
|
|
|
<h2>Note: This story was already submitted <%=
|
2015-12-16 19:35:19 +01:00
|
|
|
time_ago_in_words_label(f.object.already_posted_story.created_at) %>, but
|
|
|
|
may be submitted again.</h2>
|
2014-01-13 07:10:31 +01:00
|
|
|
<p>
|
2015-01-03 00:02:55 +01:00
|
|
|
Please view the <a href="<%= f.object.already_posted_story.comments_path %>"
|
2014-01-13 07:10:31 +01:00
|
|
|
target="_blank">previous discussion</a> for this story first. If the content
|
|
|
|
has changed or warrants new discussion, you may submit it again.
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<%= f.hidden_field :seen_previous %>
|
|
|
|
<% end %>
|
|
|
|
|
2012-06-17 03:15:46 +02:00
|
|
|
<div class="box">
|
2015-10-15 03:32:24 +02:00
|
|
|
<% unless defined?(suggesting) %>
|
|
|
|
<div class="boxline">
|
|
|
|
<% if f.object.url_is_editable_by_user?(@user) %>
|
|
|
|
<%= f.label :url, "URL:", :class => "required" %>
|
|
|
|
<%= f.text_field :url, :autocomplete => "off" %>
|
|
|
|
<%= button_tag "Fetch Title", :id => "story_fetch_title",
|
|
|
|
:type => "button" %>
|
|
|
|
<% elsif !f.object.new_record? && !f.object.url.blank? %>
|
|
|
|
<%= f.label :url, "URL:", :class => "required" %>
|
|
|
|
<div class="d">
|
|
|
|
<a href="<%= f.object.url %>"><%= f.object.url %></a>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2013-03-26 18:22:23 +01:00
|
|
|
</div>
|
|
|
|
<% end %>
|
2012-06-17 03:15:46 +02:00
|
|
|
|
|
|
|
<div class="boxline">
|
|
|
|
<%= f.label :title, "Title:", :class => "required" %>
|
2012-07-05 01:58:58 +02:00
|
|
|
<%= f.text_field :title, :maxlength => 100, :autocomplete => "off" %>
|
2013-03-26 18:22:23 +01:00
|
|
|
</div>
|
2012-06-17 03:15:46 +02:00
|
|
|
|
2015-10-15 17:17:37 +02:00
|
|
|
<% if f.object.id && !defined?(suggesting) %>
|
|
|
|
<% title_votes = {} %>
|
|
|
|
<% f.object.suggested_titles.each do |st| %>
|
|
|
|
<% title_votes[st.title] ||= 0 %>
|
|
|
|
<% title_votes[st.title] += 1 %>
|
|
|
|
<% end %>
|
|
|
|
<% title_votes.delete(f.object.title) %>
|
|
|
|
<% if title_votes.any? %>
|
|
|
|
<div class="boxline actions">
|
|
|
|
Users have suggested changing this story's title to:
|
|
|
|
<br>
|
|
|
|
<% title_votes.each do |ti,c| %>
|
|
|
|
<%= h(ti) %><%= c == 1 ? "" : " (#{c} votes)" %><br>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
|
2012-06-17 03:15:46 +02:00
|
|
|
<div class="boxline" style="margin-bottom: 2px;">
|
2013-03-26 18:22:23 +01:00
|
|
|
<%= f.label :tags_a, "Tags:", :class => "required",
|
2012-06-30 18:18:36 +02:00
|
|
|
:style => "line-height: 2.3em;" %>
|
2012-09-19 19:25:11 +02:00
|
|
|
<%= f.select "tags_a", options_for_select(
|
2012-09-20 02:28:09 +02:00
|
|
|
Tag.all_with_filtered_counts_for(@user).map{|t|
|
2015-01-05 19:18:42 +01:00
|
|
|
html = "<strong>#{h(t.tag)}</strong> - #{h(t.description.to_s)}"
|
|
|
|
|
|
|
|
if t.hotness_mod != 0
|
|
|
|
html << " (hotness mod #{t.hotness_mod > 0 ? "+" : ""}#{t.hotness_mod})"
|
|
|
|
end
|
|
|
|
if t.filtered_count > 0
|
|
|
|
html << " <em>#{t.filtered_count} user" <<
|
|
|
|
(t.filtered_count == 1 ? "" : "s") << " filtering</em>"
|
|
|
|
end
|
|
|
|
|
|
|
|
[ "#{t.tag} - #{t.description}", t.tag, { "data-html" => raw(html) } ]},
|
|
|
|
f.object.tags_a), {}, { :multiple => true } %>
|
2012-06-17 03:15:46 +02:00
|
|
|
</div>
|
|
|
|
|
2015-10-15 17:17:37 +02:00
|
|
|
<% if f.object.id && !defined?(suggesting) %>
|
|
|
|
<% tag_votes = {} %>
|
|
|
|
<% f.object.suggested_taggings.group_by(&:user_id).each do |u,stg| %>
|
|
|
|
<% tl = stg.map{|st| st.tag.tag }.sort.join(", ") %>
|
|
|
|
<% tag_votes[tl] ||= 0 %>
|
|
|
|
<% tag_votes[tl] += 1 %>
|
|
|
|
<% end %>
|
|
|
|
<% tag_votes.delete(f.object.tags_a.sort.join(", ")) %>
|
|
|
|
<% if tag_votes.any? %>
|
|
|
|
<div class="boxline actions">
|
|
|
|
Users have suggested changing this story's tags to:
|
|
|
|
<br>
|
|
|
|
<% tag_votes.each do |ts,c| %>
|
|
|
|
<%= ts %><%= c == 1 ? "" : " (#{c} votes)" %><br>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
|
2015-10-15 03:32:24 +02:00
|
|
|
<% unless defined?(suggesting) %>
|
|
|
|
<div class="boxline">
|
|
|
|
<%= f.label :description, "Text:", :class => "required" %>
|
|
|
|
<%= f.text_area :description, :rows => 15,
|
|
|
|
:placeholder => "Optional when submitting a URL; please see guidelines",
|
|
|
|
:autocomplete => "off" %>
|
|
|
|
</div>
|
2013-07-18 15:49:36 +02:00
|
|
|
|
2015-10-15 03:32:24 +02:00
|
|
|
<div class="boxline actions markdown_help_toggler">
|
|
|
|
<a href="#" id="story_guidelines_toggler">
|
|
|
|
Story submission guidelines
|
|
|
|
</a>
|
|
|
|
<div id="story_guidelines" style="<%= show_guidelines?? "" :
|
|
|
|
"display: none;" %>">
|
|
|
|
<ul>
|
2013-07-18 15:49:36 +02:00
|
|
|
|
2015-10-15 03:32:24 +02:00
|
|
|
<li><p>
|
|
|
|
To be able to easily submit a page you're viewing in your browser
|
2016-06-01 21:33:29 +02:00
|
|
|
to <%= Rails.application.name %>, drag this bookmarklet to your
|
|
|
|
bookmark bar:
|
|
|
|
[<a href="javascript:{window.open(%22<%= Rails.application.root_url
|
|
|
|
%>stories/new?url=%22+encodeURIComponent(document.location)+<%
|
|
|
|
%>%22&title=%22+encodeURIComponent(document.title));%20void(0);}<%
|
|
|
|
%>">Submit to <%= Rails.application.name %></a>].
|
|
|
|
You'll be taken to this page with the viewed page's URL and title.
|
2015-10-15 03:32:24 +02:00
|
|
|
</p></li>
|
2013-07-18 15:49:36 +02:00
|
|
|
|
2015-10-15 03:32:24 +02:00
|
|
|
<li><p>
|
|
|
|
When submitting a URL, the text field is optional and should only
|
|
|
|
be used when additional context or explanation of the URL is
|
|
|
|
needed. Commentary or opinion should be reserved for a comment,
|
|
|
|
so that it can be voted on separately from the story.
|
|
|
|
</p></li>
|
2013-07-18 15:49:36 +02:00
|
|
|
|
2015-10-15 03:32:24 +02:00
|
|
|
<li><p>
|
|
|
|
Do not editorialize story titles, but when the original story's
|
|
|
|
title has no context or is unclear, please change it. <strong>Please
|
|
|
|
remove extraneous components from titles such as the name of the
|
|
|
|
site or section.</strong>
|
|
|
|
</p></li>
|
2013-07-18 15:49:36 +02:00
|
|
|
|
2015-10-15 03:32:24 +02:00
|
|
|
<li><p>
|
|
|
|
If no tags clearly apply to the story you are submitting, chances
|
|
|
|
are it does not belong here. Do not overreach with tags if they
|
|
|
|
are not the primary focus of the story.
|
|
|
|
</p></li>
|
2013-07-18 15:49:36 +02:00
|
|
|
|
2015-10-15 03:32:24 +02:00
|
|
|
<li><p>
|
|
|
|
When the story being submitted is more than a year or so old,
|
|
|
|
please add the year the story was written to the post title in
|
|
|
|
parentheses.
|
|
|
|
</p></li>
|
2013-07-18 15:49:36 +02:00
|
|
|
|
2015-10-15 03:32:24 +02:00
|
|
|
</ul>
|
|
|
|
</div>
|
2013-07-18 15:49:36 +02:00
|
|
|
</div>
|
2015-10-15 03:32:24 +02:00
|
|
|
<% end %>
|
2012-06-17 03:15:46 +02:00
|
|
|
</div>
|
2015-10-15 03:32:24 +02:00
|
|
|
<% unless defined?(suggesting) %>
|
|
|
|
<div class="box">
|
|
|
|
<div class="boxline">
|
|
|
|
<%= f.label :user_is_author, "Author:", :class => "required" %>
|
|
|
|
<%= f.check_box :user_is_author %>
|
|
|
|
<%= f.label :user_is_author,
|
|
|
|
(f.object.id && f.object.user_id != @user.id ? "Submitter is" : "I am") +
|
|
|
|
" the author of the story at this URL (or this text)",
|
|
|
|
:class => "normal" %>
|
|
|
|
</div>
|
2015-07-31 00:15:48 +02:00
|
|
|
</div>
|
2012-09-19 19:37:42 +02:00
|
|
|
|
2015-10-15 03:32:24 +02:00
|
|
|
<script>
|
|
|
|
$(document).ready(function() {
|
|
|
|
$("#story_fetch_title").click(function() {
|
|
|
|
Lobsters.fetchURLTitle($(this), $("#story_url"), $("#story_title"));
|
|
|
|
return false;
|
|
|
|
});
|
2012-09-19 19:37:42 +02:00
|
|
|
});
|
2015-10-15 03:32:24 +02:00
|
|
|
</script>
|
|
|
|
<% end %>
|