journalduhacker/app/views/comments/_commentbox.html.erb
2014-02-12 13:28:53 -06:00

56 lines
1.5 KiB
Plaintext

<div class="comment comment_form_container">
<%= form_for comment,
:html => { :id => "edit_comment_#{comment.short_id}" } do |f| %>
<% if comment.errors.any? %>
<%= errors_for comment %>
<% end %>
<%= hidden_field_tag "story_id",
comment.story.short_id %>
<% if comment.parent_comment %>
<%= hidden_field_tag "parent_comment_short_id",
comment.parent_comment.short_id %>
<% end %>
<div style="width: 100%;">
<%= text_area_tag "comment", comment.comment, :rows => 5,
:style => "width: 100%;", :autocomplete => "off" %>
<p></p>
<div class="markdown_help_toggler">
<div class="markdown_help_label">
Markdown formatting available
</div>
<div class="markdown_help_label markdown_help_label_mobile"
style="display: none;">
[M&darr;]
</div>
<%= button_tag "#{comment.new_record?? "Post" : "Update"}",
:class => "comment-post", :type => "button" %>
&nbsp;
<%= button_tag "Preview", :class => "comment-preview",
:type => "button" %>
<% if local_assigns[:cancellable] %>
&nbsp;
<%= button_tag "Cancel", :class => "comment-cancel",
:type => "button" %>
<% end %>
<div style="clear: both;"></div>
<%= render :partial => "global/markdownhelp" %>
</div>
</div>
<p></p>
<% end %>
<% if defined?(show_comment) && show_comment.valid? %>
<div class="preview">
<%= render "comments/comment", :comment => show_comment %>
</div>
<% end %>
</div>