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
addComment : function(source) { | |
var body = this.get('body'); | |
if (!body) { | |
return; // no empty comments | |
} | |
var feedItem = this.get('feedItem'); | |
this.invokeLater(function() { | |
var comment = DarkHorse.store.createRecord(DarkHorse.Comment, { | |
body : body, | |
feedItem : feedItem.get('guid'), |
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
destroyComment : function(comment) { | |
this.set('_comment', comment); | |
SC.AlertPane.error("Are you sure you want to delete this comment.", "This action is irreversable, and will permanently remove this comment from the system.", null, "Ok", "Cancel", null, this); | |
}, | |
alertPaneDidDismiss : function(pane, status) { | |
if (status == SC.BUTTON1_STATUS) { | |
var comment = this.get('_comment'); | |
this.get('content').removeObject(comment); | |
this.invokeLater(function(){ |
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
// in feed item | |
comments: SC.Record.toMany("DarkHorse.Comment",{ | |
inverse: "feedItem", | |
isMaster: YES, | |
isEditable: YES | |
}), | |
// in comments |
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
{"content": | |
{"content":"Sed mollis, purus sit amet rutrum mollis, sapien arcu mattis dolor, eu euismod nisl turpis non mi. In diam arcu, tristique sit amet dictum vel, adipiscing vel quam. Praesent ligula risus, tincidunt sed semper non, ullamcorper ac nunc. Proin nibh sapien, euismod sed rutrum non, vestibulum a erat. Vestibulum convallis interdum eros, quis sodales libero scelerisque sed. Phasellus ac purus mauris. Nam mattis nulla vel mi dignissim id ultrices leo tincidunt. Integer euismod, turpis id bibendum facilisis, velit urna ultricies purus, sed consectetur metus felis ut massa. Aliquam varius augue at lectus tristique suscipit. Donec eu dolor ut lectus congue convallis non quis orci. Pellentesque luctus, erat et varius facilisis, massa tortor dictum leo, vel porta eros sem eu ante.", | |
"guid":"5ab44190-b79f-11df-8e72-005056c00008", | |
"sourceType":"Person", | |
"authorGuid":"9b48d037-71b5-40da-9393-e9c8354ab2b8", | |
"subject":"Cras auctor, odio id dictum ultrices, velit dolor dapibus orci, at faucibus augue dui |
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
{"content": | |
{ | |
"guid":"d71b18b0-baad-11df-941a-005056c00008", | |
"body":"sdafdasg", | |
"feedItem":"5ab44190-b79f-11df-8e72-005056c00008", | |
"commentedOn":"2010-09-07T11:29:24.539-0700", | |
"user":"4188d72c-812f-4e7f-9157-731194c6f8a5"}} |
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
createRecord: function(store, storeKey) { | |
var ret = NO; | |
if (SC.kindOf(store.recordTypeFor(storeKey), this.get('baseRecord'))) { | |
SC.Request.postUrl(this.get('createUrl')).header({ | |
'Accept': 'application/json' | |
}).json().notify(this, 'didCreateRecord', store, storeKey).send(store.readDataHash(storeKey)); | |
ret = YES; | |
} | |
return ret; | |
}, |
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: DarkHorse - The PC Browser targeted face of the Matygo Web App | |
// Copyright: ©2010 Matygo Educational Incorporated | |
// ========================================================================== | |
/*globals DarkHorse */ | |
/** @class | |
(Document your Model here) |
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: DarkHorse.Comment | |
// Copyright: ©2010 My Company, Inc. | |
// ========================================================================== | |
/*globals DarkHorse */ | |
/** @class | |
(Document your Model here) |
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
// In some code: | |
var context = SC.Object.create({foreignUrlKey:foreignUrlKey, foreignTypeKey:foreignTypeKey}); | |
console.log(context); | |
object.addObserver('status', this, 'fetchForeignObjectStatusChanged',context); | |
// observer | |
fetchForeignObjectStatusChanged: function(sender, key, value, context, rev){ | |
console.log("Arguments"); | |
console.log("Sender: " + sender); | |
console.log("Key: " + key); |
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
// Collection Template | |
DarkHorse.UserSummaryItemsTemplate = SC.TemplateCollectionView.extend( { | |
contentBinding: 'DarkHorse.profileController.summaryItemsController', | |
templateName: 'summary_items' | |
}); | |
// View | |
contentView: SC.TemplateView.design( { | |
templateName: 'summary_items' | |
}) |