141 lines
4.6 KiB
Plaintext
141 lines
4.6 KiB
Plaintext
<div class="box" id="story_box">
|
|
<div class="legend">
|
|
Submit a Story
|
|
</div>
|
|
|
|
<div id="story_holder">
|
|
<%= form_for @story do |f| %>
|
|
<%= render :partial => "stories/form", :locals => { :story => @story,
|
|
:f => f } %>
|
|
|
|
<p></p>
|
|
|
|
<div class="box">
|
|
<div class="boxline markdown_help_toggler">
|
|
<a href="#" id="story_guidelines_toggler">
|
|
Story submission guidelines
|
|
</a>
|
|
<div id="story_guidelines" style="<%= @user &&
|
|
@user.stories_submitted_count > 2 ? "display: none;" : "" %>">
|
|
<div style="float: right;">
|
|
<a href="javascript:window.location=%22<%= root_url %>stories/new?url=%22+encodeURIComponent(document.location)+%22&title=%22+encodeURIComponent(document.title)"
|
|
style="border: 1px solid #ddd; padding: 0.5em; background-color:
|
|
#f8f8f8; line-height: 1.5em; margin-left: 1em;">Submit to
|
|
<%= Rails.application.name %></a>
|
|
</div>
|
|
<ul>
|
|
|
|
<li>
|
|
<p>
|
|
To be able to easily submit a page you're viewing in your browser
|
|
to <%= Rails.application.name %>, drag the bookmarklet to the right
|
|
to your bookmark bar. You'll be taken to this page with the viewed
|
|
page's URL and title.
|
|
</p>
|
|
|
|
<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>
|
|
|
|
<li><p>
|
|
Do not editorialize story titles, but when the original story's
|
|
title has no context or is unclear, please change it. Please
|
|
remove extraneous components from titles such as the name of the
|
|
site or section.
|
|
</p></li>
|
|
|
|
<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>
|
|
|
|
<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>
|
|
|
|
<li><p>
|
|
If you submit a URL that matches one already posted within the
|
|
past 30 days, your submission will be turned into an upvote on
|
|
the previous story and you will be redirected to it.
|
|
</p>
|
|
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<p></p>
|
|
|
|
<div class="box">
|
|
<div class="boxline markdown_help_toggler">
|
|
<div class="markdown_help_label">
|
|
Markdown formatting available
|
|
</div>
|
|
|
|
<%= submit_tag "Submit" %>
|
|
|
|
|
|
<button type="button" class="story-preview">Preview</button>
|
|
|
|
<div style="clear: both;"></div>
|
|
|
|
<%= render :partial => "global/markdownhelp",
|
|
:locals => { :allow_images => true } %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="story_preview">
|
|
<% if @story.previewing && @story.valid? %>
|
|
<%= render :template => "stories/show" %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
<% if @story.previewing %>
|
|
$("#story_tags_a").select2({
|
|
formatSelection: function(what) {
|
|
return what.id;
|
|
}
|
|
});
|
|
<% else %>
|
|
$("#story_url").focus();
|
|
|
|
$("button.story-preview").unbind().live("click", function() {
|
|
Lobsters.previewStory($(this).parents("form").first());
|
|
});
|
|
|
|
$("#story_url").unbind().live("blur", function() {
|
|
/* if the url looks like a pdf, assign the pdf tag */
|
|
if ($("#story_url").val().match(/\.pdf$/i)) {
|
|
var ta = $("#story_tags_a").data("select2");
|
|
|
|
if (ta.getVal().indexOf("pdf") < 0)
|
|
ta.addSelectedChoice({ id: "pdf" });
|
|
}
|
|
/* if the url looks like a video site url, assign the video tag */
|
|
else if ($("#story_url").val().match(/[\/\.](youtube|vimeo)\.com\//i)) {
|
|
var ta = $("#story_tags_a").data("select2");
|
|
|
|
if (ta.getVal().indexOf("video") < 0)
|
|
ta.addSelectedChoice({ id: "video" });
|
|
}
|
|
});
|
|
<% end %>
|
|
|
|
$("#story_guidelines_toggler").unbind().live("click", function() {
|
|
$("#story_guidelines").toggle();
|
|
return false;
|
|
});
|
|
});
|
|
</script>
|