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
<!-- Application ERB --> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Diets</title> | |
<%= stylesheet_link_tag "application" %> | |
<%= csrf_meta_tags %> | |
</head> | |
<body> | |
<%= yield %> |
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
[2011-10-14 20:42:21] ERROR NoMethodError: You have a nil object when you didn't expect it! | |
You might have expected an instance of Array. | |
The error occurred while evaluating nil.split | |
/Users/cory/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.4/lib/rack/handler/webrick.rb:68:in `block in service' | |
/Users/cory/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.4/lib/rack/utils.rb:356:in `block in each' | |
/Users/cory/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.4/lib/rack/utils.rb:355:in `each' | |
/Users/cory/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.4/lib/rack/utils.rb:355:in `each' | |
/Users/cory/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.4/lib/rack/handler/webrick.rb:62:in `service' | |
/Users/cory/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service' | |
/Users/cory/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run' |
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.my_var}} | |
{{#each content.blah}} | |
... stuff hear that is part of blah | |
{{content.my_var}} | |
{{/each}} |
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
App.MasterView = Em.View.create | |
templateName: 'app/~templates/master_page' | |
SidebarView: Em.View.extend | |
viewName: 'Sidebar' | |
templateName: 'app/~templates/sidebar' | |
contentBinding: 'App.MyController.content' | |
didInsertElement: -> | |
#setup draggable, sortable, blahbable 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
M.Select = Em.Select.extend({ | |
value: Ember.computed(function(key, value){ | |
var content = this.get('content'), | |
selection = this.get('selection'), | |
self = this, | |
optionValuePath = this.get('optionValuePath'); | |
if ( selection ) { | |
this.setPath('bindingContext.type', selection.type) | |
} |
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
M.Paragraph = Em.View.extend(Ember.TextSupport, { | |
viewName: 'paragraph_view', | |
content: null, | |
attributeBindings: ['text'], | |
text: '', | |
editable: false, | |
_editable: (function() { | |
console.log(arguments); | |
return this.set('editable', Em.getPath(arguments[1])); | |
}).observes('M.editable.status'), |
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
PostView: Em.View.extend | |
templateName: 'post_container' | |
postBinding: 'App.appController.selection.post' | |
Displays, but does not update until I click on the text field. | |
{{view Em.TextField valueBinding="post.managing"}} | |
Displays and updates | |
{{view Em.TextField valueBinding="parentView.content.post.managing"}} |
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
{{view M.Select | |
contentBinding="Desires.elementTypeController" | |
valueBinding="this.type" | |
optionLabelPath="content.label" | |
optionValuePath="content.type" | |
classNames="input-xlarge" | |
}} | |
M.Select = Em.Select.extend({ |
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
M.HeadingView = Em.View.extend Ember.TextSupport, | |
viewName: 'heading_view' | |
content: null | |
attributeBindings: ['text'] | |
editable: false | |
template: Ember.Handlebars.compile( | |
'{{#if this.editable}} | |
{{view Em.TextField valueBinding="content"}} | |
{{else}} |
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
Assume you are using a bound array named links that is defined like [{link: 'some link', title: 'my nifty link', active: true}, ...] | |
//in JS file. I will assume you have an app called MyApp that was create with Em.Application.create() | |
MyApp.linksController = Em.ArrayProxy.create({ | |
content: [ { link: 'I am a link', title: 'I am a title', active: true } ] | |
}); | |
<!-- Navbar | |
================================================== --> |
OlderNewer