This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contentView: SC.ListView.design({ | |
listItemActionProperty: 'action', | |
contentValueKey: "title", | |
contentBinding: "BB.associationListController.arrangedObjects", | |
exampleView: SC.ListItemView.extend({ | |
renderAction: function(context, actionClassName){ | |
context.push('<img src="', | |
SC.BLANK_IMAGE_URL, | |
'" class="action sc-mini-icon plus" />'); | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ========================================================================== | |
// Project: SproutCore - JavaScript Application Framework | |
// Copyright: ©2006-2009 Sprout Systems, Inc. and contributors. | |
// Portions ©2008-2009 Apple, Inc. All rights reserved. | |
// License: Licened under MIT license (see license.js) | |
// ========================================================================== | |
//Set these require statements if put into frameworks/datastore/models: | |
//sc_require('models/record'); | |
//sc_require('models/record_attribute'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BB.main = function main() { | |
var usersQuery = SC.Query.create({recordType: BB.User}); | |
BB.set('usersQuery', usersQuery); | |
var users = BB.store.findAll(BB.get('usersQuery')); | |
BB.set('users', users); | |
var conceptsQuery = SC.Query.create({ | |
recordType: BB.Concept, | |
conditions: "type = 'BB.Concept'"}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* private methods */ | |
_addConcept: function() { | |
var concept, description; | |
concept = this.store.createRecord(BB.Concept, | |
{_id: "@id%@".fmt(SC.Store.generateStoreKey())} | |
); | |
concept.set('user', BB.userController); | |
concept.set('date', new Date()); | |
store.commitRecord(BB.Concept, concept.get('_id')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// my main.js --------------------------------- | |
BB.main = function main() { | |
var usersQuery = SC.Query.create({recordType: BB.User}); | |
BB.set('usersQuery', usersQuery); | |
var users = BB.store.findAll(BB.get('usersQuery')); | |
BB.set('users', users); | |
BB.store.dataSource.loadAllDocs(BB.store); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//descriptions: SC.RecordAttribute.create({ | |
// toType: function(record, key, value) { | |
// var cacheKey = '__descriptions__'+ SC.guidFor(record) ; | |
// var query = record[cacheKey] ; | |
// if (!query) { | |
// query = record[cacheKey] = record.get('store').findAll(SC.Query.create({ | |
// recordType: 'BB.Description', | |
// conditions: "concept = %@", | |
// parameters: [record] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SC.MyCouchdbDataSource = SC.DataSource.extend( { | |
database: "", | |
design: "", | |
cancelStoreKeys: {}, | |
fetchRequest: SC.Request.getUrl("").set('isJSON', YES), | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ========================================================================== | |
// Project: SproutCore - JavaScript Application Framework | |
// Copyright: ©2006-2009 Sprout Systems, Inc. and contributors. | |
// Portions ©2008-2009 Apple, Inc. All rights reserved. | |
// License: Licened under MIT license (see license.js) | |
// ========================================================================== | |
/** | |
@class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ========================================================================== | |
// Project: SproutCore - JavaScript Application Framework | |
// Copyright: ©2006-2009 Sprout Systems, Inc. and contributors. | |
// Portions ©2008-2009 Apple, Inc. All rights reserved. | |
// License: Licened under MIT license (see license.js) | |
// ========================================================================== | |
require('core') ; | |
/** | |
@class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_applyChangedOrder: function() { | |
if (!this.queryKey) return; | |
// clear cache | |
this._records = null; | |
// this actually sorts the store keys | |
this.storeKeys.sort(); | |
// setting them manually works as well | |
//this.storeKeys = [key2, key1]; |