grounded / afterburner

A bunch of ideas allowing developers to defer decisions in, and reduce coupling of, an application's technology stack through the provision of design patterns.
MIT License
4 stars 0 forks source link

Back-end field entries should be partialized #6

Open robyurkowski opened 12 years ago

robyurkowski commented 12 years ago

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).

GeekOnCoffee commented 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 %>