Open robyurkowski opened 12 years ago
A potential alternative to partials: @preferences is defined in the controller as an array of already existing preferences... the preference_field_tag will spit out the appropriate form element (checkbox, text field, etc) based on the type of preference.
<% @preferences.each do |key|
type = Spree::Config.preference_type(key) %>
<div class="field">
<%= label_tag(key) %>
<%= preference_field_tag(key, Spree::Config[key], :type => type) %>
</div>
<% end %>
Thought: when doing a form, instead of generating a long list of label/input pairs, each standard set should have its own partial with passed arguments. The advantage of this is that a user can override a single partial and update all the text / WYSIWYG / select items sitewise in one go.
At the very least, the complex items will need to be partialized, such as the WYSIWYG field (its markup is substantially more complicated).