Files
tsemple/app/views/admin/comments/show.html.slim
2014-04-04 21:54:42 +08:00

51 lines
1.7 KiB
Plaintext

- @page_title = t '.comments'
.main
.container
.row
.col-md-8.col-md-push-2
.panel
.panel-heading
h3.panel-title = t '.comments'
.panel-body
= form_for [:admin, @comment], html: { class: 'comment-form' } do |f|
= render 'share/flash_messages'
= render 'share/form_error_messages', form: f
.form-group
= f.label :commentable
p
= link_to_commentable @comment.commentable
.form-group
= f.label :user
p
a href=admin_user_path(@comment.user)
= @comment.user.name
.form-group
= markdown_area f, :body, tabIndex: 1
.form-group
= f.label :created_at
= f.text_field :created_at, class: 'form-control', disabled: true
.clearfix
= f.submit t('.save_changes'), class: 'btn btn-success', tabIndex: 2
.pull-right
- if @comment.trashed?
a.btn.btn-default href=restore_admin_comment_path(@comment) data-method="patch"
= t '.restore'
- else
a.btn.btn-default href=trash_admin_comment_path(@comment) data-method="delete" data-confirm=t('.delete_confirm')
= t '.delete'
javascript:
$('form.comment-form').validate({
rules: {
'comment[body]': {
required: true
}
},
messages: {
'comment[body]': {
required: '#{@comment.errors.generate_message :body, :blank}'
}
}
});