Created
February 2, 2010 21:16
-
-
Save jdlich/293034 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
require 'home.rb' | |
# | |
# Default | |
# | |
include Nanoc3::Helpers::Rendering | |
include Nanoc3::Helpers::Capturing | |
# | |
# Custom | |
# | |
# grab the current year for the coypright notice | |
def current_year | |
Time.now.year | |
end | |
# branding comes first only on the home page | |
def title | |
if @item[:section] == 'home' | |
"Kathleen Yamauchi Group Real Estate | #{@item[:title]}" | |
else | |
"#{@item[:title]} | Kathleen Yamauchi Group Real Estate" | |
end | |
end | |
# TODO generate navigation that highlights current page | |
def navigation | |
end | |
# create an array of home class instances so you can do cool | |
# stuff like "home.photos" from within the erb templates | |
def homes | |
homes = [] | |
home_items = @items.select { |item| item[:kind] == 'home' } | |
home_items.each do |item| | |
homes << Home.new(item) | |
end | |
homes | |
end | |
# print out required scripts for a given page | |
def javascript scripts | |
scripts = scripts.split(', ') | |
scripts.map do |script| | |
%{<script type="text/javascript" src="/javascript/#{script}.js"></script>} | |
end | |
end | |
# google analytics snippet - having it in here keeps my layout clean! | |
def google_analytics | |
%{<script type="text/javascript"> | |
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); | |
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); | |
</script> | |
<script type="text/javascript"> | |
var pageTracker = _gat._getTracker("UA-5002305-1"); | |
pageTracker._initData(); | |
pageTracker._trackPageview(); | |
</script>} | |
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 Home | |
def initialize item | |
@item = item | |
end | |
def address | |
@item[:address] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment