diff options
-rw-r--r-- | examples/layout/other.haml | 4 | ||||
-rw-r--r-- | examples/sample.ru | 17 | ||||
-rw-r--r-- | examples/view/url1/alt.haml | 14 | ||||
-rw-r--r-- | examples/view/url1/index.haml | 7 |
4 files changed, 35 insertions, 7 deletions
diff --git a/examples/layout/other.haml b/examples/layout/other.haml new file mode 100644 index 0000000..ac6f300 --- /dev/null +++ b/examples/layout/other.haml @@ -0,0 +1,4 @@ +%h1=@title +%p="xx - OTHER - xx" +%p=@content +%p="xx - OTHER - xx" diff --git a/examples/sample.ru b/examples/sample.ru index 009eaae..a7d6b16 100644 --- a/examples/sample.ru +++ b/examples/sample.ru @@ -14,12 +14,16 @@ Zorglub::Config.root = File.dirname( File.absolute_path(__FILE__) ) # class Node1 < Zorglub::Node # + include Zorglub::Helpers::Css + css 'class_level.css' + # def index a1, *a2 - @title='Node2' - #"<title>Node1:index</title><p>a1 : #{a1.inspect}</p><p>a2 : #{a2.inspect}</p>#{html}" + @title='Index' + css 'instance_level.css' end # def alt *args + @title='Alt' "<title>Node1:alt</title>#{html}" end # @@ -31,6 +35,8 @@ end # class Node2 < Zorglub::Node # + include Zorglub::Helpers::Css + # map APP, '/url2' engine 'my-engine' # not available layout 'my-layout' # not available @@ -40,9 +46,10 @@ class Node2 < Zorglub::Node end # def alt *args - engine 'temp-engine' - layout 'temp-layout-name' - view 'path-to-temp-view' + @title = "Alt 2" + engine 'temp-engine' # haml renamed + layout 'other' # use layout/other.haml template + view File.join( 'url1','alt') # use view/url1/alt.haml template "<title>Node2:alt</title>#{html}" end # diff --git a/examples/view/url1/alt.haml b/examples/view/url1/alt.haml new file mode 100644 index 0000000..ca990e4 --- /dev/null +++ b/examples/view/url1/alt.haml @@ -0,0 +1,14 @@ +%h3='Alt template' +-action.each do |k,v| + %p="#{k} => #{v}" +%p="Css #{css.inspect}" +%p + %a{:href=>Node1.r('index','arg1','arg2')}="Node1::index" +%p + %a{:href=>Node1.r('alt')}="Node1::alt" +%p + %a{:href=>Node2.r('index')}="Node2::index" +%p + %a{:href=>Node2.r('alt')}="Node2::alt" +%p + %a{:href=>Node1.r('pour', 'voir')}="nowhere" diff --git a/examples/view/url1/index.haml b/examples/view/url1/index.haml index 577e342..eb52535 100644 --- a/examples/view/url1/index.haml +++ b/examples/view/url1/index.haml @@ -1,8 +1,11 @@ -%h3='My content' +%h3='Index template' -action.each do |k,v| %p="#{k} => #{v}" +%p="Css #{css.inspect}" %p - %a{:href=>Node1.r('alt')}="alternative" + %a{:href=>Node1.r('index','arg1','arg2')}="Node1::index" +%p + %a{:href=>Node1.r('alt')}="Node1::alt" %p %a{:href=>Node2.r('index')}="Node2::index" %p |