Skip to content

Instantly share code, notes, and snippets.

View Chandler's full-sized avatar

Chandler Abraham Chandler

View GitHub Profile
$(".encrypted-content").show()
$(".encrypted-content").html(function(index, oldtext){
new_string = ""
/*handle special html characters */
oldtext = oldtext.replace(/>/g,">");
oldtext = oldtext.replace(/&lt;/g,"<");
oldtext = oldtext.replace(/&amp;/g,"&");
var express = require('express')
, http = require('http');
var app = express();
var server = app.listen(8080, '127.0.0.1');
var io = require('socket.io').listen(server);
app.configure(function(){
app.use(express.static(__dirname + '/public'));
})
(function($){
/* router */
var AppRouter = Backbone.Router.extend({
routes: {
"": "home",
}
});
var app_router = new AppRouter;
app_router.on('route:home', function( id ){
# This is the default .slate file.
# If no ~/.slate file exists this is the file that will be used.
#config
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
#resize
bind right:ctrl push right bar-resize:screenSizeX/2
#when I visit /orgs/5, my route's model method isn't called with the dynamic segment.
Broken:
App.Router.map ->
@resource 'organizations', path: "/orgs", ->
@resource 'organization', path: ":id", ->
App.OrganizationIndexRoute = Ember.Route.extend
model: (params) ->
console.log(params)
#config
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
#resize
bind right:ctrl push right bar-resize:screenSizeX/2
bind left:ctrl push left bar-resize:screenSizeX/2
bind up:ctrl push up bar-resize:screenSizeY/2
bind down:ctrl push down bar-resize:screenSizeY/2
when I visit /orgs/17 via a full refresh everything works as expected.
The page shows me some info about org 17 that is loaded from the server.
When I'm on the index page and I link to /org/17 using linkTo, the model isn't loaded..there's no org data on the page.
#index handlebars template
{{#linkTo organizations.show id class="org-name"}} {{name}} {{/linkTo}}
#router
-----
<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"
define(["ember"], function(Em) {
var Router;
Router = Em.Router.extend({
enableLogging: true,
location: 'history'
});
Router.map(function() {
this.route('discovery');
this.resource('organizations', {
#This works
grunt.initConfig({
coffee: {
glob_to_multiple: {
options: {
bare: true
},
flatten: true,
expand: true,
cwd: 'client',