Skip to content

Instantly share code, notes, and snippets.

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" />');
},
// ==========================================================================
// 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');
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'"});
/* 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'));
// 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);
//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]
SC.MyCouchdbDataSource = SC.DataSource.extend( {
database: "",
design: "",
cancelStoreKeys: {},
fetchRequest: SC.Request.getUrl("").set('isJSON', YES),
// ==========================================================================
// 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
// ==========================================================================
// 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
_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];