An Ember application starts with its main template. Put your header, footer, and any other decorative content in application.handlebars
.
<header>
<img src="masthead">
</header>
<footer>
uploadFile: function(file) { | |
var self = this, | |
vehicle = this.get('controller.content'), | |
photo = Case.VehiclePhoto.createRecord(); | |
console.log(file.data); | |
photo.set('name', file.name); | |
photo.set('imageData', file.data); | |
photo.set('vehicleId', this.get('controller.content.id')); |
# example view implements a simple dragging for mouse events. | |
Wall.DevView = Ember.View.extend | |
mouseDown: (ev) -> | |
ev.dispatcher.lock @, 'mouseMove', 'mouseUp' | |
@_mouseDown = @$().offset() | |
@_mouseDown.pageX = ev.pageX | |
@_mouseDown.pageY = ev.pageY | |
@_mouseDown.dispatcher = ev.dispatcher | |
console.log 'mouseDown' |
# example view implements a simple dragging for mouse events. | |
Wall.DevView = Ember.View.extend | |
mouseDown: (ev) -> | |
ev.dispatcher.lock @, 'mouseMove', 'mouseUp' | |
@_mouseDown = @$().offset() | |
@_mouseDown.pageX = ev.pageX | |
@_mouseDown.pageY = ev.pageY | |
@_mouseDown.dispatcher = ev.dispatcher | |
console.log 'mouseDown' |
EvEditor = Em.Application.create({ | |
main: { componentList:[{name:'a'},{name:'b'},{name:'c'}] | |
}); | |
EvEditor.ApplicationController = Em.Controller.extend() | |
EvEditor.ApplicationView = Em.View.extend({ | |
templateName: 'application' | |
}); | |
EvEditor.ComponentListController = Ember.ArrayController.extend({ |
The first time I dropped 0.9.8 in, I was immediately struck with the | |
thought: "HOLY ZEBULON PIKE ON A ZEBRA, NONE OF THE ITEMS IN Ember.CollectionViews | |
ARE SHOWING?!" | |
The change has to do with whether views render their templates using | |
themselves as the context, or whether it is inherited from the parent. | |
Alternatively said: | |
"it is trying to look up [...] properties on the view instead of the | |
parent context[TD]." |
JQ.Animate = Ember.Mixin.create({ | |
cssProperties: ['background', 'backgroundAttachment', 'backgroundColor', 'backgroundImage', 'backgroundPosition', | |
'backgroundRepeat', 'border', 'borderBottom', 'borderBottomColor', 'borderBottomStyle', 'borderBottomWidth', | |
'borderColor', 'borderLeft', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', 'borderRight', 'borderRightColor', | |
'borderRightStyle', 'borderRightWidth', 'borderStyle', 'borderTop', 'borderTopColor', 'borderTopStyle', 'borderTopWidth', | |
'borderWidth', 'clear', 'clip', 'color', 'cursor', 'display', 'filter', 'font', 'fontFamily', 'fontSize', | |
'fontVariant', 'fontWeight', 'height', 'left', 'letterSpacing', 'lineHeight', 'listStyle', 'listStyleImage', | |
'listStylePosition', 'listStyleType', 'margin', 'marginBottom', 'marginLeft', 'marginRight', 'marginTop', 'overflow', | |
'padding', 'paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop', 'pageBreakAfter', 'pageBreakBefore', | |
'position', 'styleFloat', 'textAlign', 'textDecoration' |
Inheritance is a key concept in most object-oriented languages, but applying it skillfully can be challenging in practice. Back in 1989, M. Sakkinen wrote a paper called Disciplined inheritance that addresses these problems and offers some useful criteria for working around them. Despite being more than two decades old, this paper is extremely relevant to the modern Ruby programmer.
Sakkinen's central point seems to be that most traditional uses of inheritance lead to poor encapsulation, bloated object contracts, and accidental namespace collisions. He provides two patterns for disciplined inheritance and suggests that by normalizing the way that we model things, we can apply these two patterns to a very wide range of scenarios. He goes on to show that code that conforms to these design rules can easily be modeled as ordinary object composition, exposing a solid alternative to tradi
{{#view Luh.Ui.TabMainView currentView="pane1"}} | |
{{#view Luh.Ui.TabPaneView id="pane1" class="content" viewName="pane1"}} | |
{{/view}} | |
{{#view Luh.Ui.TabPaneView id="pane2" class="content" viewName="pane2"}} | |
{{/view}} |
App.CarouselView = Em.CollectionView.extend(Luh.Ui.ScrollMixin, { | |
scrollOptions: { | |
hScroll: true, | |
vScroll: false, | |
duration: 500, | |
velocity: 0.1, | |
simultaneously: true, | |
initThreshold: 10*ScreenFactor | |
}, |