Created
December 12, 2012 00:26
-
-
Save pjkelly/4263740 to your computer and use it in GitHub Desktop.
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
window.AppName = | |
Models: {} | |
Colls: {} | |
Views: {} | |
Routers: {} | |
Data: {} | |
Pages: | |
Home: | |
init: -> | |
new AppName.Views.HomePage el: $("body") | |
About: | |
init: -> | |
new AppName.Views.AboutPage el: $("body") | |
initialize: (page) -> | |
# call any initial setup code | |
# initialize the page view component | |
@.Pages[page].init() |
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
<!doctype html> | |
... | |
<body> | |
<%= yield %> | |
... | |
<%= javascript_include_tag("application") %> | |
<%= yield :javascripts %> | |
<% if jspage? %> | |
<!-- initialize the application --> | |
<%= javascript_tag do -%> | |
OTG.initialize("<%= jspage %>"); | |
<% end -%> | |
<% end %> | |
</body> | |
</html> |
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 ApplicationController < ActionController::Base | |
before_filter :set_jspage | |
helper_method :jspage, :jspage? | |
protected | |
def jspage_data | |
@jspage_data ||= YAML.load_file(File.join("jspages.yml")) | |
end | |
def set_jspage | |
@jspage = jspage_data[[controller_name, action_name].join('-')] | |
end | |
def jspage | |
@jspage | |
end | |
def jspage? | |
@jspage.present? | |
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
class HomeController < ApplicationController | |
def index | |
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
home-index: Home | |
pages-about: About |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment