Skip to content

Commit

Permalink
revert changes to comment box until I can sort out form errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pushcx committed Dec 24, 2018
1 parent 93440ce commit 3cc6ff7
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions app/views/comments/_commentbox.html.erb
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<div class="comment comment_form_container"
data-shortid="<%= comment.short_id if comment.persisted? %>">
<%= form_with url: comment, :id => "edit_comment_#{comment.short_id}" do |f| %>
<%= form_for comment,
:html => { :id => "edit_comment_#{comment.short_id}" } do |f| %>
<% if comment.errors.any? %>
<%= errors_for comment %>
<% end %>
<%= f.hidden_field "story_id", value: comment.story.short_id %>
<%= hidden_field_tag "story_id", comment.story.short_id %>
<% if comment.parent_comment %>
<%= f.hidden_field "parent_comment_short_id", value: comment.parent_comment.short_id %>
<%= hidden_field_tag "parent_comment_short_id",
comment.parent_comment.short_id %>
<% end %>

<div style="width: 100%;">
<%= f.text_area "comment", :body => comment.comment, :rows => 5,
<%= text_area_tag "comment", comment.comment, :rows => 5,
:disabled => !@user,
:placeholder => (@user ? "" : "You must be logged in to leave a comment.")
%>
Expand All @@ -30,21 +32,21 @@ data-shortid="<%= comment.short_id if comment.persisted? %>">
</div>
<% end %>
<%= f.submit "#{comment.new_record?? "Post" : "Update"}",
<%= submit_tag "#{comment.new_record?? "Post" : "Update"}",
:class => "comment-post", :disabled => !@user %>
&nbsp;
<%= f.button "Preview", :class => "comment-preview",
<%= button_tag "Preview", :class => "comment-preview",
:type => "button", :disabled => !@user %>
<% if comment.persisted? || comment.parent_comment_id %>
&nbsp;
<%= f.button "Cancel", :class => "comment-cancel",
<%= button_tag "Cancel", :class => "comment-cancel",
:type => "button" %>
<% end %>
<% if @user && @user.wearable_hats.any? %>
<div style="display: inline-block; margin-left: 1em;">
Put on hat:
<%= f.select "hat_id",
<%= select_tag "hat_id",
options_from_collection_for_select(@user.wearable_hats, "id", "hat",
comment.hat_id), :include_blank => true %>
</div>
Expand Down

0 comments on commit 3cc6ff7

Please sign in to comment.