Files
growstuff/app/views/posts/_form.html.haml
Brenda Wallace 9ecf210ffb More form tidy up
2019-04-27 19:19:42 +12:00

38 lines
1.3 KiB
Plaintext

.card.col-md-8.col-lg-7.mx-auto.float-none.white.z-depth-1.py-2.px-2
.card-body
- if content_for? :title
%h1.h2-responsive.text-center
%strong=yield :title
= form_for(@post, html: { role: "form" }) do |f|
- if @post.errors.any?
#error_explanation
%h2
= pluralize(@post.errors.size, "error")
prohibited this post from being saved:
%ul
- @post.errors.full_messages.each do |msg|
%li= msg
.form-group
= label_tag :post, "Subject", class: 'control-label'
= f.text_field :subject, class: 'form-control', autofocus: 'autofocus', maxlength: 255
.form-group
- if @post.forum || @forum
= label_tag :body, "What's up?", class: 'control-label'
- else
= label_tag :body, "What's going on in your food garden?"
= f.text_area :body, rows: 12, class: 'form-control'
%span.help-block
= render partial: "shared/markdown_help"
- if @post.forum || @forum
- forum = @post.forum || @forum
%p
This post will be posted in the forum
= link_to forum.name, forum
.field
= f.hidden_field :forum_id, value: forum.id
= f.submit "Post", class: 'btn btn-primary'