journalduhacker/app/views/stories/_form.html.erb
2012-06-16 20:15:46 -05:00

85 lines
2.5 KiB
Plaintext

<%= error_messages_for f.object %>
<div class="box">
<div class="boxline">
<% if !f.object.new_record? && !f.object.url.blank? %>
<label>URL:</label>
<span class="d">
<%= f.object.url %>
</span>
<% elsif !f.object.id %>
<%= f.label :url, "URL:", :class => "required" %>
<%= f.text_field :url, :style => "width: 475px;" %>
<%= button_to_function "Fetch Title",
"Lobsters.fetchURLTitle($(this), $('#story_url'), $('#story_title'));" %>
<% end %>
</div>
<div class="boxline">
<%= f.label :title, "Title:", :class => "required" %>
<%= f.text_field :title, :maxlength => 100, :style => "width: 475px;" %>
</div>
<div class="boxline" style="margin-bottom: 2px;">
<%= f.label :tags_a, "Tags:", :class => "required" %>
<%= f.select "tags_a", options_for_select(Tag.order(:tag).map{|t|
[ "#{t.tag} - #{t.description}", t.tag ] }), {},
{ :multiple => true, :style => "width: 487px;" } %>
</div>
<div class="boxline">
<%= f.label :description, "Text:", :class => "required" %>
<%= f.text_area :description, :size => "100x10",
:placeholder => "optional, not recommended when submitting a link" %>
</div>
<div class="hintblock" style="padding-bottom: 1em; font-style: normal;">
<a href="#" style="color: gray;"
onclick="$('#markdown_help').toggle(); return false;">
Limited Markdown formatting available
</a>
<div id="markdown_help"
style="display: none; padding-top: 0.5em;">
<table>
<tr>
<td width="125"><em>emphasized text</em></td>
<td>surround text with *asterisks*</td>
</tr>
<tr>
<td><u>underlined text</u></td>
<td>surround text with _underline_</td>
</tr>
<tr>
<td><strike>struck-through</strike></td>
<td>surround text with ~~two tildes~~</td>
</tr>
<tr>
<td><a href="http://example.com/"
style="color: inherit;">linked text</a></td>
<td>[linked text](http://example.com/) or just a bare URL
to create without a title</td>
</tr>
<tr>
<td><blockquote> quoted text</blockquote></td>
<td>prefix text with &gt;</td>
</tr>
<tr>
<td><pre style="margin: 0px;">pre
text</pre></td>
<td>prefix text with at least 3 spaces</td>
</tr>
</table>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#story_tags_a").select2({
formatSelection: function(what) {
return what.id;
}
});
});
</script>