b14a5e1b18
- add comment_controller/layout - add js to load the comments
37 lines
1.5 KiB
Plaintext
37 lines
1.5 KiB
Plaintext
= form_for @comment, format: :json, remote: true do |f|
|
|
- if @comment.errors.any?
|
|
#error_explanation
|
|
h2 = "#{pluralize(@comment.errors.count, "error")} prohibited this comment from being saved:"
|
|
ul
|
|
- @comment.errors.full_messages.each do |message|
|
|
li = message
|
|
|
|
.form-horizontal
|
|
.form-group
|
|
.field
|
|
= f.label :title, class: "sr-only"
|
|
= f.text_field :title, class: "form-control", placeholder: "Title"
|
|
.form-group
|
|
.field
|
|
= f.label :comment, class: "sr-only"
|
|
= f.text_area :comment, class: "form-control", placeholder: "Content"
|
|
.form-inline
|
|
.field
|
|
= f.label :commentable_id, class: "form-control", class: "sr-only hidden"
|
|
= f.number_field :commentable_id, class: "form-control hidden", placeholder: "Commentable ID"
|
|
.field
|
|
= f.label :commentable_type, class: "sr-only hidden"
|
|
= f.text_field :commentable_type, class: "form-control hidden", placeholder: "Commentable Type"
|
|
.form-inline
|
|
.field
|
|
= f.label :creator_id, class: "sr-only"
|
|
= f.number_field :creator_id, class: "form-control hidden", placeholder: "Creator ID"
|
|
.field
|
|
= f.label :creator_type, class: "sr-only hidden"
|
|
= f.text_field :creator_type, class: "form-control hidden", placeholder: "Creator Type"
|
|
.form-inline
|
|
.field
|
|
= f.label :role, class: "sr-only hidden"
|
|
= f.text_field :role, class: "form-control hidden", placeholder: "Role"
|
|
.actions = f.submit class: "btn btn-success action-comment"
|