Skip to content

Instantly share code, notes, and snippets.

@enyo
Created May 28, 2010 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enyo/417046 to your computer and use it in GitHub Desktop.
Save enyo/417046 to your computer and use it in GitHub Desktop.
// The Tag model
isAssignedToSelectedArticle: function(key, value) {
// writing ...
if (value !== undefined) {
if (value === true) {
Inventory.editedArticleController.get('tags').pushObject(this);
}
else {
Inventory.editedArticleController.get('tags').popObject(this);
}
}
// reading
return !!Inventory.editedArticleController.get('tags').findProperty('id', this.get('id'));
}.property('Inventory.editedArticleController.content')
// the list view:
tags: SC.ScrollView.design({
layout: { top: 20, width: 250, bottom: 10, left: 270 },
contentView: SC.ListView.design({
layout: { top: 0, right: 0, bottom: 0, left: 0 },
contentBinding: 'Inventory.editedArticleAvailableTagsController.arrangedObjects',
selectionBinding: 'Inventory.editedArticleAvailableTagsController.selection',
contentValueKey: "name",
contentCheckboxKey: "isAssignedToSelectedArticle"
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment