I am displaying a collection of expenses in a form

the view in which the fom is displayed :
...
= simple_form_for(@project, :html => {:class => 'form-stacked' })
do |f|
- unless @project.expenses.count > 0
No expenses
- else
#expenses
= f.fields_for :expenses do |f|
= render "backoffice/projects/expense_fields", :f => f
.clearfix

and the expense_fields partial is :

.row
= f.input :label, :wrapper => :nolabel, :input_html => { :class =>
"span3" }

I would like to test when the first expense item is displayed :

.row
- "if first expense.. test
= f.input :label, :input_html => { :class => "span3" }
# use the standard wrapper with labels
- else
= f.input :label, :wrapper => :nolabel, :input_html => { :class
=> "span3" } # no label wrapper

is there any way to do it ?

thanks for your feedback

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedFeb 26, '12 at 6:09p
activeFeb 26, '12 at 6:09p
posts1
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Erwin: 1 post

People

Translate

site design / logo © 2021 Grokbase