161 lines
5 KiB
Plaintext
161 lines
5 KiB
Plaintext
<% if f.object.errors.count == 1 && f.object.already_posted_story %>
|
|
<div class="flash-error">
|
|
<h2><%= t('.alreadysubmitted') %><%=
|
|
time_ago_in_words(f.object.already_posted_story.created_at) %></h2>
|
|
<p>
|
|
<%= raw(t('.previousdiscussion', :storypath => "#{f.object.already_posted_story.comments_path}")) %>
|
|
</p>
|
|
</div>
|
|
<% elsif f.object.errors.any? %>
|
|
<%= error_messages_for f.object %>
|
|
<% elsif !f.object.errors.any? && f.object.already_posted_story %>
|
|
<div class="flash-notice">
|
|
<h2><%= t('.alreadysubmittedflash', :timeago => "#{time_ago_in_words(f.object.already_posted_story.created_at)}") %></h2>
|
|
<p>
|
|
<%= raw(t('.previousexpireddiscussion', :storypath => "#{f.object.already_posted_story.comments_path}")) %>
|
|
</p>
|
|
</div>
|
|
|
|
<%= f.hidden_field :seen_previous %>
|
|
<% end %>
|
|
|
|
<div class="box">
|
|
<% unless defined?(suggesting) %>
|
|
<div class="boxline">
|
|
<% if f.object.url_is_editable_by_user?(@user) %>
|
|
<%= f.label :url, t('.url'), :class => "required" %>
|
|
<%= f.text_field :url, :autocomplete => "off" %>
|
|
<%= button_tag t('.fetchtitle'), :id => "story_fetch_title",
|
|
:type => "button" %>
|
|
<% elsif !f.object.new_record? && !f.object.url.blank? %>
|
|
<%= f.label :url, t('.url'), :class => "required" %>
|
|
<div class="d">
|
|
<a href="<%= f.object.url %>"><%= f.object.url %></a>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class="boxline">
|
|
<%= f.label :title, t('.title'), :class => "required" %>
|
|
<%= f.text_field :title, :maxlength => 100 %>
|
|
</div>
|
|
|
|
<% 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">
|
|
<%= t('.changetitle') %>
|
|
<br>
|
|
<% title_votes.each do |ti,c| %>
|
|
<%= h(ti) %><%= c == 1 ? "" : " (#{c} votes)" %><br>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<div class="boxline" style="margin-bottom: 2px;">
|
|
<%= f.label :tags_a, t('.tags'), :class => "required",
|
|
:style => "line-height: 2.3em;" %>
|
|
<%= f.select "tags_a", options_for_select(
|
|
Tag.all_with_filtered_counts_for(@user).map{|t|
|
|
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 } %>
|
|
</div>
|
|
|
|
<% 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">
|
|
<%= t('.changetags') %>
|
|
<br>
|
|
<% tag_votes.each do |ts,c| %>
|
|
<%= ts %><%= c == 1 ? "" : " (#{c} votes)" %><br>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% unless defined?(suggesting) %>
|
|
<div class="boxline">
|
|
<%= f.label :description, t('.text'), :class => "required" %>
|
|
<%= f.text_area :description, :rows => 15,
|
|
:placeholder => t('.placeholdertext') %>
|
|
</div>
|
|
|
|
<div class="boxline actions markdown_help_toggler">
|
|
<a href="#" id="story_guidelines_toggler">
|
|
<%= t('.storysubmissionguidelines') %>
|
|
</a>
|
|
<div id="story_guidelines" style="<%= show_guidelines?? "" :
|
|
"display: none;" %>">
|
|
<ul>
|
|
|
|
<li><p>
|
|
<%= raw(t('.guidelinespart1')) %>
|
|
</p></li>
|
|
|
|
<li><p>
|
|
<%= t('.guidelinespart2') %>
|
|
</p></li>
|
|
|
|
<li><p>
|
|
<%= t('.guidelinespart3') %>
|
|
</p></li>
|
|
|
|
<li><p>
|
|
<%= raw(t('.guidelinespart4')) %>
|
|
</p></li>
|
|
|
|
<li><p>
|
|
<%= raw(t('.guidelinespart5', :rooturl => "#{Rails.application.root_url}", :appname => "#{Rails.application.name}")) %>
|
|
</p></li>
|
|
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% unless defined?(suggesting) %>
|
|
<div class="box">
|
|
<div class="boxline">
|
|
<%= f.label :user_is_author, t('.author'), :class => "required" %>
|
|
<%= f.check_box :user_is_author %>
|
|
<%= f.label :user_is_author,
|
|
(f.object.id && f.object.user_id != @user.id ? t('.submitter') : t('.iamauthor')) +
|
|
t('.authorownership'),
|
|
:class => "normal" %>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
$("#story_fetch_title").click(function() {
|
|
Lobsters.fetchURLTitle($(this), $("#story_url"), $("#story_title"));
|
|
return false;
|
|
});
|
|
});
|
|
</script>
|
|
<% end %>
|