Created
April 13, 2011 18:56
-
-
Save airios/918143 to your computer and use it in GitHub Desktop.
sample nesta app.rb
This file contains hidden or 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
# Use the app.rb file to load Ruby code, modify or extend the models, or | |
# do whatever else you fancy when the theme is loaded. | |
require 'rubygems' | |
require 'sinatra' | |
module Nesta | |
class App | |
helpers do | |
# Add new helpers here. | |
def set_common_variables | |
@menu_items = Nesta::Menu.for_path('/') | |
@site_title = Nesta::Config.title | |
set_from_config(:title, :subtitle, :google_analytics_code) | |
@heading = @title | |
end | |
def get_article_categories | |
@page.find_articles_with_categories | |
end | |
end | |
# Add new routes here. | |
end | |
class Page | |
def find_articles_with_categories | |
Page.find_articles.select{ |a| !a.categories.empty? } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment