Skip to content

Instantly share code, notes, and snippets.


Lionel Chan chaoszcat

Block or report user

Report or block chaoszcat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
hekevintran / title.js
Created Nov 6, 2012
SelectWithOptgroups: a subclass of Ember.Select
View title.js
App.SelectWithOptgroups = Ember.Select.extend({
// A version of Ember.Select that supports optgroup tags.
// content can contain objects that represent the options or the optgroups
// Example of an optgroup object:
// Ember.Object.create({
// optgroup_label: 'foo',
// content: [Ember.Object.create({label: 'First Name', value: 'first_name'}), Ember.Object.create({label: 'Last Name', value: 'last_name'})]
// })
defaultTemplate: Ember.Handlebars.compile('{{#if view.prompt}}<option>{{view.prompt}}</option>{{/if}}{{#each view.content}}{{#if optgroup_label}}<optgroup {{bindAttr label="optgroup_label"}}>{{#each content}}{{view Ember.SelectOption contentBinding="this"}}{{/each}}</optgroup>{{else}}{{view Ember.SelectOption contentBinding="this"}}{{/if}}{{/each}}'),
options: function() {
You can’t perform that action at this time.