resthub/resthub-backbone-stack — pull request #108 by bmeurant (2013-03-13 10:43:12+00:00)
Title: update populate model checkbox management for single valued checkoxes

For now, populate model function parses any checkboxes by storing only checked values in model :

- if only one value is defined, model will store a string with the checked value if any, null otherwise
- if multiple values are defined, model will store an array containing anly checked values, array will be empty is no value is checked

This is very convenient to manage lists : user interests, etc.

But this is not really convenient to manage a single valued checkbox : acceptance of a condition, etc.

In this case, it would be more intuitive to have always a single value in model containing, if not selected the "false" value : most of these single valued checboxes manage boolean choices.

This PR implements this behaviour :

- if only one value is defined, model will store a string with the checked value if any, "false" string value otherwise
- if multiple values are defined, model will store an array containing anly checked values, array will be empty is no value is checked (no change)