somawater/deckhand — pull request #25 by elvanja (2014-03-25 21:48:51+00:00)
Title: Inline editing with dropdown select

Changelog:
* added model configuration option for choices
* choices can be a method or directly configured as array, hash etc.
* presenter adds choices as a new field
* field formatter respects these choices and renders the value of the field accordingly, even for non editable field
* added support to apply selected value immediately

Fields with choices can be configured in various way:
```ruby
model Album do
show :record_label, choices: :get_record_labels_enum, editable: true
show :genre, choices: ['Jazz', 'Rock', 'Dance'], editable: true
show :type, choices: [['Long Play', 'lp'], ['Extended play', 'ep']], editable: true
show :media, choices: [{key: 1, value: 'CD'}, {key: 2, value: 'DVD'}], editable: true
end
```

There is an issue I can't seem to resolve.
When opening the select and choosing an option, the value gets saved, but the select (from dh-field-editor directive) remains visible. Only after hitting Enter or Escape or Tab does it close up and show updated value. Isn't much of a concern, but still...

Resource for troubles with select:
* http://stackoverflow.com/questions/2048213/open-select-using-javascript-jquery
* http://stackoverflow.com/questions/16157459/how-to-open-select-element-using-jquery

Another idea is to use https://github.com/angular-ui/ui-select2. It is noted on Angular UI page and supports many other options like multiple selections (e.g. for tagging) etc. Another thing it supports is ```close()``` and ```open()``` right from the code, as noted [here] (http://ivaynberg.github.io/select2/#programmatic). Didn't want to add it without discussion, since it means introducing a new library to the mix.

Open for suggestions.

P.S. This is a fork from ```specs_for_directives``` branch so it waits for #23 and #24 to be merged.