Skip to content

Instantly share code, notes, and snippets.

Handlebars.registerHelper 'has-permission', (conditional, options) ->
if @get('currentPerson.content.rights').contains conditional
options.fn @
else
options.inverse @
executions: ( ->
ids = @get 'execution_ids'
return unless ids? and ids.length
_ids = @get '_ids'
# Prevent multiple calls to server for no reason.
return @get('_executions') if _ids && ids.toString() == _ids.toString()
@set '_ids', ids
_executions = @get('store').find 'execution',
willTransition: (transition) ->
context = @get 'context'
return false unless context
if context.get('isDirty') && !confirm 'You have unsaved changes are you sure you want to continue?'
transition.abort()
return false
if context.get('isNew')
context.deleteRecord()
{{#link-to "projects.edit" view.content.id class="mal-name"}}
<span>
{{view.content.name}} <--- This renders
{{#if view.content.name}}
{{view.content.name}} <--- We get to this, but it renders nothing.
{{else}}
Missing Project Name
{{/if}}
</span>
{{/link-to}}
@cloke
cloke / gist:6323765
Last active December 21, 2015 14:59
#in template
{{tb-select value=market_po options=controllers.menus.markets}}
#Work in progress
Ember.TEMPLATES['components/tb-select'] = Em.Handlebars.compile '
{{view view.OptionsView}}
'
Binders.TbSelectComponent = Ember.Component.extend
#In template
{{tb-select options=controllers.menus.pods value=pod}}
#Work in progress
Ember.TEMPLATES['components/tb-select'] = Em.Handlebars.compile '
<div class="controls">
{{view view.OptionsView}}
</div>
'
#this must run before application.create.
DS.RESTAdapter.map 'App.ParentModel',
foos: { embedded: 'always' } #has many
bars: { embedded: 'always' } #has one aka belongsTo
App.ParentModel = DS.Model.extend
foos: DS.hasMany App.Foo
bars: DS.belongsTo App.Bar
DS.RESTAdapter = DS.RESTAdapter.extend({
serializer: DS.RESTSerializer.extend({
primaryKey: function(type) {
return '_id';
}
})
})
dogarrhea: out of curiosity, why did ember marketing decide to attach the "MVC" label to ember.js when ember doesn't really have a data solution that's solid yet?
[12:32pm] mixonic joined the chat room.
[12:32pm] dogarrhea: it's pretty deceptive and leaves a bad taste in my mouth when I use it and find out. This is the opposite of what marketing wants right?
[12:32pm] alexd08 left the chat room. (Quit: This computer has gone to sleep)
[12:33pm] dogarrhea: i'll just stop until everything is ready. not provide free QA
<ul>
{{#each song in songs}}
<li>{{song.title}}</li>
{{/each}}
</ul>
MyListView: Em.CollectionView.extend
tagName: 'ul'
itemViewClass: Em.View.extend
template: Em.Handlebars.compile '