Module: Ki::Helpers
Instance Method Summary
collapse
#view_exists?, #view_path
Instance Method Details
#css(url) ⇒ Object
5
6
7
|
# File 'lib/ki/helpers.rb', line 5
def css(url)
haml "%link{:href => '#{url}', :rel => 'stylesheet'}"
end
|
#haml(s) ⇒ Object
13
14
15
|
# File 'lib/ki/helpers.rb', line 13
def haml(s)
Haml::Engine.new(s).render
end
|
#js(url) ⇒ Object
9
10
11
|
# File 'lib/ki/helpers.rb', line 9
def js(url)
haml "%script{:src => '#{url}'}"
end
|
#partial(s) ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'lib/ki/helpers.rb', line 17
def partial(s)
path = view_path(s)
if File.file?(path)
haml(File.read(path))
else
fail PartialNotFoundError, path
end
end
|