17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/sinatra/orthor.rb', line 17
def self.registered(app)
app.helpers ::OrthorHelper
app.helpers Sinatra::OrthorRequestHelpers
::Orthor::Site.resources.each do |resource|
if resource.is_a?(::Orthor::Category) && !resource.page_path.nil?
get resource.page_path do |id|
handle_request(resource)
@orthor_content = orthor_content(id, (resource.page_template || resource.template))
@orthor_page_title = orthor_content(id)["Title"]
erb (resource.view || "orthor_content").to_sym, { :layout => ::Orthor::Site.layout }
end
end
get resource.path do
if resource.is_a?(::Orthor::Feed)
['Cache-Control'] = "public, max-age=#{resource.cache_for}"
resource.content
elsif resource.is_a?(::Orthor::StaticPage)
handle_request(resource)
erb resource.view.to_sym, { :layout => ::Orthor::Site.layout }
else
@orthor_content = resource.content
handle_request(resource)
erb (resource.view || "orthor_content").to_sym, { :layout => ::Orthor::Site.layout }
end
end
end
end
|