padrino/padrino-framework — pull request #1054 by dariocravero (2013-02-12 03:24:44+00:00)
Title: Implemented disabled attribute for select_tag form helper

This implements the requested functionality in #872.

You can now tell an option is disabled by setting its third value in the array that describes it as follows:

```options = [['Green', 'green1', true], ['Blue', 'blue1'], ['Black', "black1"]]```

In the example, ```Green``` will be disabled.

I also implemented this for optgroups [since they're subject to being disabled too](https://developer.mozilla.org/en-US/docs/HTML/Element/optgroup).

If you're using optgroups as arrays, then again, set set the third item on the array:

```
opts = [
["Friends",["Yoda",["Obiwan",2]]],
["Enemies", ["Palpatine",['Darth Vader',3]], true]
]
```

The group ```Enemies``` will be disabled.

For the hash, this was a bit trickier since there wasn't an easy way to tell if the last option was meant to be a boolean value or a directive to tell if you were trying to disable or not the option. Therefore, I decided to force you to use a hash ```{:disabled => true}```:

```
opts = {
"Friends" => ["Yoda",["Obiwan",2]],
"Enemies" => ["Palpatine",['Darth Vader',3], {:disabled => true}]
}
```

Once again, ```Enemies``` will be disabled on the example.

Thoughts? If you decide to merge this in, let me know and I'll update the docs accordingly. :)