Skip to content

Instantly share code, notes, and snippets.

View Chandler's full-sized avatar

Chandler Abraham Chandler

View GitHub Profile
@Chandler
Chandler / app.coffee
Created August 10, 2013 07:51 — forked from huafu/app.coffee
App = Em.Application.create()
App.Router.map ->
@resource 'organizations', path: 'orgs', ->
@resource 'organization', path: ':organization_id', ->
@route 'index', path: '/'
@route 'settings'
# the route for all organizations
App.OrganizationsRoute = Em.Route.extend
Router.map ->
@resource 'organizations', path: "/orgs", ->
@resource 'organization', path: ":organization_id", ->
@route 'settings'
@route 'home'
#no OrganizationsRoute, skipping for now don't need the page for all orgs yet
OrganizationsController = Em.ArrayController.extend
selectedModel: null
#scenario 1 /orgs/17/settings
OrganizationRoute = Em.Route.extend
model: (params) ->
model = Organization.find(params.organization_id)
@controllerFor('organizations').set 'selectedModel', model
OrganizationSettingsController = Em.Controller.extend
needs: 'organization'
organization: null
organizationBinding: 'controllers.organization'
OrganizationRoute = Em.Route.extend
model: (params) ->
Organization.find(params.organization_id)
#visiting /orgs/5/settings renders the "organization" template, and the "organziation.settings" template
#in the "organization" template and OrganizationController context, I have access to the model setup above.
#in the "organziations.settings" template and OrganiationSettingsController context I have no model
@resource 'organizations', path: "/orgs", ->
@resource 'show', path: ":organization_id", ->
@route 'settings'
visiting /orgs/17/settings renders 'settings' template into the outlet of the 'application' template.
I want it to render the templates into the outlets of the parents
settings -> show -> organizations -> application
##EDIT possible solution:
OrganizationsNewController = Em.ObjectController.extend
fields: Em.Object.create
name: '',
##Original Question:
#this works, I can bind to name
@Chandler
Chandler / Hello World
Last active December 19, 2015 15:09
The actual very first program I ever wrote, my first week of college. CS112 "Computer Science for non majors"
/* hello.cpp
The Standard "hello world" program
Chandler Abraham August 25th, 2007
*/
# include <iostream>
using namespace std;
void showprogramHeader ();
#This works
grunt.initConfig({
coffee: {
glob_to_multiple: {
options: {
bare: true
},
flatten: true,
expand: true,
cwd: 'client',
define(["ember"], function(Em) {
var Router;
Router = Em.Router.extend({
enableLogging: true,
location: 'history'
});
Router.map(function() {
this.route('discovery');
this.resource('organizations', {
-----
<div id="discovery">
<div class="org-search content-well span6 offset1">
<div class="search-box">
{{view Ember.TextField
type="text"
placeholder="Search for an organization"
id="login-name"
valueBinding="filterString"