ministryofjustice / govuk_elements_form_builder

Form builder helper methods to develop GOV.UK elements styled applications in Ruby on Rails
https://govuk-elements-rails-guide.herokuapp.com/
MIT License
6 stars 14 forks source link

Allow value and text method options to radio_button_fieldset (#82) #83

Closed misaka closed 7 years ago

misaka commented 7 years ago

NOTE: There are two changes here, one changes the existing radio_buttons_fieldset and the other adds a collection_radio_buttons method. See the discussion happening in issue #82, my proposal is that we just make the change to radio_buttons_fieldset for now and drop collection_radio_buttons until we can do it properly.

When generating a radio-button fieldset, there are times when we want to specify how to get the form value or label text for the choices passed in, the same way collection_radio_buttons does in Rails. For example, when assigning a team to a person we may want to use the team's DB ID as the value and the team's name as the radio button text. This change adds these options to radio_button_fieldset (adding them to other places, such as check_box_fieldset, is an exercise for later).

This addresses issue #82.

misaka commented 7 years ago

@aliuk2012 Just to check, this PR has both changes in it, the addition of value_method and text_method to radio_buttons_fieldset AND the addition of a new method collection_radio_buttons. Are you approving the addition of both of these?

aliuk2012 commented 7 years ago

Could you strip out the collection_radio_button method and move that into its own branch? If we log an issue and reference that branch we can then look at adding that method as part of another feature.

misaka commented 7 years ago

Commit removed, merging.