This file contains 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
SG.groupsUserFilter = SC.Object.create({ | |
allUsersBinding:"SG.usersController.arrangedObjects", | |
users:function() { | |
var a = this.get('allUsers'); | |
if(!a) return null; | |
return a.filter(function(user) { | |
if(user.get('superAdmin')) return NO; | |
if(user.get('clientAdmin')) return NO; | |
if(user.get('contentAdmin')) return YES; |
This file contains 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
Installing pg (0.10.0) with native extensions /opt/ruby/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) | |
/opt/ruby/bin/ruby extconf.rb | |
Gem files will remain installed in /we/cms/shared/bundle/ruby/1.9.1/gems/pg-0.10.0 for inspection. | |
Results logged to /we/cms/shared/bundle/ruby/1.9.1/gems/pg-0.10.0/ext/gem_make.out | |
from /opt/ruby/lib/ruby/1.9.1/rubygems/installer.rb:486:in `block in build_extensions' | |
from /opt/ruby/lib/ruby/1.9.1/rubygems/installer.rb:446:in `each' | |
from /opt/ruby/lib/ruby/1.9.1/rubygems/installer.rb:446:in `build_extensions' |
This file contains 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
SG.SelectView = SC.View.extend({ | |
displayProperties:['items', 'itemTitleKey', 'itemValueKey'], | |
tagName:"select", | |
render:function(ctx, first) { | |
ctx.addClass('sg-select'); | |
if(!this.get('isEnabled')) { |
This file contains 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
01:18 < KU0N> Now, how can I notify a view from a model? | |
01:18 < KU0N> The thing is, I have a complex view that manage a timeline http://www.simile-widgets.org/timeline/ | |
01:19 < KU0N> now, when a model is deleted, I need to notify that view so it can reload the timeline from the server | |
01:19 < KU0N> I must trigger the reload after the server finished deleting the object | |
01:19 < KU0N> so I have didDestroy called on my model by my datasource | |
01:20 < KU0N> now what would be the best way, from my model didDestroy method, to notify my view? |
This file contains 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
Accounting = SC.Application.create( | |
NAMESPACE: 'Accounting', | |
VERSION: '0.1.0', | |
store: SC.Store.create(), | |
currentPage:'Accounting.invoices.mainView', | |
loadInvoices:function() { |
This file contains 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
list: SC.ScrollView.design({ | |
layout:{width:250}, | |
contentView: SC.ListView.design({ | |
contentBinding:"Accounting.invoicesController.arrangedObjects", | |
selectionBinding:"Accounting.invoicesController.selection", | |
rowHeight:70, | |
exampleView:SC.View.design(SC.Control, { | |
classNames:"invoice-item", | |
displayProperties:'content.contact', | |
render:function (ctx) { |
This file contains 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
list: SC.ScrollView.design({ | |
layout:{width:250}, | |
contentView: SC.ListView.design({ | |
contentBinding:"Accounting.invoicesController.arrangedObjects", | |
selectionBinding:"Accounting.invoicesController.selection", | |
rowHeight:70, | |
exampleView:SC.View.design(SC.Control, SC.ContentDisplay, { | |
contentDisplayProperties:"contact".w(), | |
classNames:"invoice-item", | |
render:function (ctx) { |
This file contains 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
contact: function() { | |
var query = SC.Query.local(AccountingModel.Contact, 'id=%@'.fmt(this.get('contact_id'))); | |
return this.get('store').find(query).firstObject(); | |
}.property().cacheable(), |
This file contains 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
_findRecord: function(recordType, id) { | |
var storeKey ; | |
// if a record instance is passed, simply use the storeKey. This allows | |
// you to pass a record from a chained store to get the same record in the | |
// current store. | |
if (recordType && recordType.get && recordType.get('isRecord')) { | |
storeKey = recordType.get('storeKey'); | |
This file contains 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
contact: function() { | |
var S = this.get('store'); | |
return S.materializeRecord(S.storeKeyFor(AccountingModel.Contact, this.get('contact_id'))); | |
}.property('contact_id'), |