This file contains 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
Post = require("models/post") | |
class Posts extends Spine.Controller | |
elements: | |
"#post_list" : "post_list" | |
events: | |
"click #post_list" : "on_post_click" |
This file contains 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
-app | |
-assets | |
-javascripts | |
-app | |
-controllers | |
-models | |
-views | |
-lib | |
-vendor |
This file contains 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
!!!Strict | |
%html{ } | |
%head | |
%title RubyConfBr2011SimpleApplication | |
%meta{'http-equiv'=>"Content-Type", :content=>"text/html; charset=utf-8"}/ | |
%meta{'http-equiv'=>"Content-Language", :content=>"en-us"}/ | |
= stylesheet_link_tag :scaffolds | |
%body |
This file contains 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
class Post extends Spine.Model | |
@configure "Post", "name" | |
@extend Spine.Model.Ajax | |
module.exports = Post |
This file contains 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
require("spine") | |
require("ajax") | |
require("tmpl") | |
Posts = require("controllers/posts") | |
class App extends Spine.Controller | |
elements: | |
"#posts" : "postsEl" |
This file contains 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
class PagesController < ApplicationController | |
def home | |
render 'home' ,:layout => 'js' | |
end | |
end |
This file contains 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
source 'http://rubygems.org' | |
gem 'rails', '3.1.0' | |
# Bundle edge Rails instead: | |
# gem 'rails', :git => 'git://github.com/rails/rails.git' | |
# Gems used only for assets and not required | |
# in production environments by default. | |
group :assets do |
This file contains 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
[APP_NAME]::Application.routes.draw do | |
resources :posts | |
root :to => "pages#home" | |
match 'home' => "pages#home" | |
match 'apps/app.js' => Stitch::Server.new(:paths => ["app/assets/javascripts/app", "app/assets/javascripts/lib"]) | |
This file contains 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
class TmplCompiler < Stitch::Compiler | |
extensions :tmpl | |
def compile(path) | |
content = File.read(path) | |
%{var template = jQuery.template(#{content.to_json}); | |
module.exports = (function(data){ return jQuery.tmpl(template, data); });} | |
end | |
end |
This file contains 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
MongoMapper.config = { | |
Rails.env => { 'uri' => ENV['MONGOHQ_URL'] || | |
"mongodb://localhost/rubyconf_simple_app-#{Rails.env}-1" } } | |
MongoMapper.connect(Rails.env) | |
if defined?(PhusionPassenger) | |
PhusionPassenger.on_event(:starting_worker_process) do |forked| | |
MongoMapper.connection.connect if forked | |
end |