Skip to content

Instantly share code, notes, and snippets.

var get = Ember.get;
/**
@extends Ember.Mixin
Implements common pagination management properties for controllers.
*/
Ember.PaginationSupport = Ember.Mixin.create({
/**
*/
$.post('data/Ajax.php', {'class': 'Catalogue', method: 'loadAttributeSelectedItems', params: ['none']}, function(data) {
var splitloads = data.split(',');
$(splitloads).each(function(index,attributetreehierarchy) {
console.log(attributetreehierarchy);
treeattr.loadKeyPath(attributetreehierarchy, function(node, status){
if(status == "loaded") {
node.expand();
}else if(status == "ok") {
node.activateSilently()
@jackkitley
jackkitley / gist:4619021
Created January 24, 2013 09:18
New ember js pre 4 problem
App.DashboardController = Em.ArrayController.extend({
content: [],
contentRecent: Em.ArrayController.create({
content: [],
count: Em.computed(function() {
return this.get('content').length;
}).property('content.@each')
}),
@jackkitley
jackkitley / gist:4620545
Created January 24, 2013 11:48
Ember js controller with computed properties
App.DashboardController = Em.ArrayController.extend({
content: [],
// contentRecent: Em.ArrayController.create({
// content: [],
// count: Em.computed(function() {
// return this.get('content').length;
// }).property('content.@each')
// }),
App.Router.map(function() {
this.route("dashboard");
this.route("accounts");
this.route("activities");
this.route("catalogue", { path: "/catalogue" });
this.route("opportunities", { path: "/opportunities" });
this.route("incidents", { path: "/incidents" });
// this.resource('processes');
// this.resource('process', { path: '/processes/:processguid' });
//TEMPLATE
{{#linkTo account account}}View{{/linkTo}}
//ROUTER
App.Router.map(function() {
this.resource('accounts', function() {
//this.route('account', { path: ':accountguid' });
});
this.resource('account', { path: '/accounts/:accountguid' });
});
{"total":"8","results":[{"accountguid":"bcfa845bb694d4221fd898e1c81b4f1d56085f75","accountnumber":"","accountname":"Kashif","accounttype":"LEAD","accounttypestatus":"Lead","accountuser":"Clevva Support","accountnumberinline":""},{"accountguid":"1b65fcabc86565260c4439e67d62573b677686f7","accountnumber":"","accountname":"John Smith","accounttype":"LEAD","accounttypestatus":"Lead","accountuser":"Clevva Support","accountnumberinline":""},{"accountguid":"c50c61b9c221c7019073fed36b46d32e4c35232f","accountnumber":"BRE393","accountname":"Peter Bredenkamp","accounttype":"CUSTOMER","accounttypestatus":"Customer","accountuser":"Clevva Support","accountnumberinline":"(BRE393)"},{"accountguid":"97bb7890844082a5c2da49e2ca6c4f17f506c516","accountnumber":"MAV003","accountname":"Admire Mavuto","accounttype":"CUSTOMER","accounttypestatus":"Customer","accountuser":"Clevva Support","accountnumberinline":"(MAV003)"},{"accountguid":"b8395eaf5e5be85208b2f033ea7f9dbb750078f8","accountnumber":"MIC008","accountname":"John Michaels","a
App.Router.map(function() {
this.resource("accounts", { path: '/accounts' });
this.resource("account", { path: "/accounts/:accountguid" });
});
App.AccountsRoute = Ember.Route.extend({
setupController: function(controller, model) {
controller.set('searchfilter','ALL');
controller.search();
}
App.ActivitiesController = Em.ArrayController.extend(Ember.PaginationSupport,{
viewActivity: function(event) {
//console.log("View activity");//.transitionToRoute('accounts');
// console.log(event);
}
});
@jackkitley
jackkitley / gist:4673080
Created January 30, 2013 12:52
old router
// App.RecentItemsRoute = Ember.Route.extend({
// setupController: function(controller, model) {
// console.log('RECENT ITEMS CONTROLLER');
// }
// });
// App.Router = Em.Router.extend({
// enableLogging: false,