Files
growstuff/app/views/posts/_form.html.haml
Cjay Billones bb88041fef [Refactoring] Replace .count and .length with .size for collections
Improved program efficiency (in querying in particular) by replacing .count and .length with .size for collections.

Fix error in refactoring

Reverted some .size into .count
2015-06-25 12:09:03 +08:00

31 lines
1007 B
Plaintext

= 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 => true
.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'