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
# 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' |
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
(function() { | |
var get = Ember.get, set = Ember.set; | |
/* | |
Holds a stack of key responder views. With this we can neatly handle restoring the previous key responder | |
when some modal UI element is closed. There's a few simple rules that governs the usage of the stack: | |
- mouse click does .replace (this should also be used for programmatically taking focus when not a modal element) | |
- opening a modal UI element does .push | |
- closing a modal element does .pop |
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
var get = Ember.get; | |
/** | |
@extends Ember.Mixin | |
Implements common pagination management properties for controllers. | |
*/ | |
Ember.PaginationSupport = Ember.Mixin.create({ | |
/** | |
*/ |
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
var get = Ember.get, set = Ember.set, getPath = Ember.getPath; | |
Ember.FilePicker = Ember.Button.extend({ | |
tagName: 'span', | |
classNames: ['ember-filepicker'], | |
classNameBindings: ['disabled'], | |
/** | |
* @type {String} | |
*/ |
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
init: function() { | |
var view = this; | |
var resizeHandler = function() { | |
view.rerender(); | |
}; | |
this.set('resizeHandler', resizeHandler); | |
$(window).bind('resize', this.get('resizeHandler')); | |
}, |
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
<?php | |
class Page extends AppModel{ | |
public $useTable = 'objects'; | |
public $actsAs = array( | |
'Tree' => array( 'recursive' => 0 ) | |
); | |
public $virtualFields = array( | |
'lft' => 'Tree.lft', |
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
<?php | |
class Page extends AppModel{ | |
public $actsAs = array( | |
'Tree' | |
); | |
public $hasOne = array( 'Category' ); |
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
Router::connect('/Module/Posts',array('controller' => 'posts','action' => 'index' ); | |
Router::connect('/Module/Posts/:action/*',array('controller' => 'posts' ); | |
class PostsController extends AppController { | |
public $components = array('Paginator'); | |
public function index(){} | |
public function archive(){ |
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
/* | |
{{loop countroller.count}} | |
{{name}} | |
{{/loop}} | |
*/ | |
Ember.Handlebars.registerHelper('loop', function(property, options) { | |
var out = ""; | |
var count = Ember.get(this, property); | |
if(Ember.typeOf(count) === 'number' && count >= 1 ){ | |
while (count--) { |
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
Model Node: | |
----------------------------------------------------------- | |
$belongsTo => array( | |
'Type' => array( | |
'className' => 'RitaType', | |
'foreignKey' => 'type_id', | |
) | |
); | |
$hasOne = array( |