Please forgive me. I am definitely a beginner at Haml and Ruby on Rails. Anyway, I have a web application, where at the top of the page, I am keeping track of the various elements on the page. The code that renders this page is as follows:
- if @item_collection.is_a?(Feature)
= render 'edit_fields', :f => f
- else
= render 'fields', :f => f
For my page, the else clause would be executed. The code behind my page is:
.field.large
= f.label :name, nil, 'data-help-id' => 'page_name'
= f.text_field :name, disabled_if_unauthorized(@item_collection, :maxlength => 255, :title => "Edit Page")
= f.error_message_on(:name, :css_class => 'error_message')
.field
= f.label :path, nil, 'data-help-id' => 'page_path'
= f.text_field :path, disabled_if_unauthorized(@item_collection, { :maxlength => 255, :class => 'extra_margin', :title => "Edit Page" })
= f.error_message_on(:path, :css_class => 'error_message')
.field.info
= f.label 'Info'
%ul.elements_count
%li.elements_in_use{ :id => 'elements_in_use'}
%li.unused_elements{ :id => 'unused_elements'}
%li.undefined_elements{ :id => 'undefined_elements'}
When the “Save” button is clicked, the unordered list (elements_count) disappears. I know it’s because I don’t have “f.” in front of those elements. The thing is, and again, forgive me because I’m just a beginner, putting “f.” in front of the list elements won’t work because %ul and %li are not Rails field helpers. Does anyone know what I can do to get these list elements to quit disappearing? Thanks!
You’re correct in that you don’t need ‘f’ in front of non rails form helpers.
Tried a similar setup to yours and I see the unordered list show up (with no content), do you see the list if you view source? Maybe a CSS file is hiding the bullets?