app/views/posts/_form.html.slim
= form_for(@post) do |f|
- if @post.errors.any?
.alert.alert-danger
button.close type="button" data-dismiss="alert" ×
ul.list-unstyled
- @post.errors.full_messages.each do |message|
li= message
.row
.col-sm-6
.form-group
= f.text_field :title, class: 'form-control', autofocus: @post.title.blank?, placeholder: t('activerecord.attributes.post.title'), required: Rails.env.production?
.col-sm-6
h1.post-title.preview-title.js_preview_title
.row
.col-sm-12
= render 'toolbar'
.row
.col-sm-6
.form-group.js_post_content_group
= f.text_area :content, class: 'form-control', autofocus: @post.title.present?, placeholder: t('activerecord.attributes.post.content'), required: Rails.env.production?
= render 'toolbar'
.checkbox
.pull-right
span.js_preview_count
=> f.label :published do
= f.check_box :published
= t('activerecord.attributes.post.published')
= f.label :template
= f.check_box :template
= t('activerecord.attributes.post.template')
- if @post.persisted?
p= f.datetime_select :created_at
div
.pull-right
= select_tag :template_id, options_for_select([nil] + @templates.map { |t| [t.title, t.id] }), class: 'form-control js_post_template'
= f.submit class: 'btn btn-primary js_submit_post', data: { disable_with: t('shared.please_wait') }, title: '⌘S'
.col-sm-6
.post-content.js_preview_content