tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject [3/7] git commit: Add a Layout component
Date Sat, 01 Jun 2013 01:20:00 GMT
Add a Layout component


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/fac32ffa
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/fac32ffa
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/fac32ffa

Branch: refs/heads/master
Commit: fac32ffa4373c598d989d5116d40065a067a6b8b
Parents: d71a6cb
Author: Howard M. Lewis Ship <hlship@apache.org>
Authored: Fri May 31 17:20:38 2013 -0700
Committer: Howard M. Lewis Ship <hlship@apache.org>
Committed: Fri May 31 17:20:38 2013 -0700

----------------------------------------------------------------------
 .../test/groovy/t5/wro4j/components/Layout.groovy  |   20 ++++++++
 .../test/resources/t5/wro4j/components/Layout.tml  |   36 +++++++++++++++
 .../src/test/resources/t5/wro4j/pages/Index.tml    |   21 +--------
 3 files changed, 58 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/fac32ffa/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy b/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy
new file mode 100644
index 0000000..3ce825a
--- /dev/null
+++ b/tapestry-wro4j/src/test/groovy/t5/wro4j/components/Layout.groovy
@@ -0,0 +1,20 @@
+package t5.wro4j.components
+
+import org.apache.tapestry5.annotations.Import
+import org.apache.tapestry5.ioc.annotations.Inject
+import org.apache.tapestry5.services.ComponentClassResolver
+
+@Import(module = "bootstrap")
+class Layout {
+
+    @Inject
+    private ComponentClassResolver resolver
+
+    String name
+
+    List<String> getPageNames() {
+        resolver.pageNames.findAll { !it.startsWith("core/") }
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/fac32ffa/tapestry-wro4j/src/test/resources/t5/wro4j/components/Layout.tml
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/resources/t5/wro4j/components/Layout.tml b/tapestry-wro4j/src/test/resources/t5/wro4j/components/Layout.tml
new file mode 100644
index 0000000..04915e3
--- /dev/null
+++ b/tapestry-wro4j/src/test/resources/t5/wro4j/components/Layout.tml
@@ -0,0 +1,36 @@
+<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
+<head>
+    <title>WRO4J Tests: ${componentResources.pageName}</title>
+</head>
+
+<div class="navbar navbar-inverse">
+    <div class="navbar-inner">
+        <div class="container">
+            <a class="brand" href="/">WRO4J Module Tests</a>
+            <ul class="nav">
+                <li><p class="navbar-text">${componentResources.pageName}</p></li>
+            </ul>
+            <ul class="pull-right nav">
+                <li class="divider-vertical"/>
+                <li class="dropdown">
+                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
+                        Pages <b class="caret"/>
+                    </a>
+                    <ul class="dropdown-menu">
+                        <li t:type="loop" source="pageNames" value="name">
+                            <t:pagelink page="prop:name">${name}</t:pagelink>
+                        </li>
+                    </ul>
+                </li>
+            </ul>
+        </div>
+    </div>
+</div>
+
+<div class="container">
+
+    <t:body/>
+
+</div>
+
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/fac32ffa/tapestry-wro4j/src/test/resources/t5/wro4j/pages/Index.tml
----------------------------------------------------------------------
diff --git a/tapestry-wro4j/src/test/resources/t5/wro4j/pages/Index.tml b/tapestry-wro4j/src/test/resources/t5/wro4j/pages/Index.tml
index 026e53d..26a47ee 100644
--- a/tapestry-wro4j/src/test/resources/t5/wro4j/pages/Index.tml
+++ b/tapestry-wro4j/src/test/resources/t5/wro4j/pages/Index.tml
@@ -1,24 +1,7 @@
-<html>
-<head>
-    <title>WRO4J Tests</title>
-</head>
-
-    <div class="navbar navbar-inverse">
-        <div class="navbar-inner">
-            <div class="container">
-
-            <a class="brand" href="/">WRO4J Module Tests</a>
-        </div>
-    </div>
-</div>
-
-<div class="container">
+<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd">
 
     <p>This page is used to demonstrate the integration of WRO4J.</p>
 
-
     <div class="alert alert-success" id="banner"/>
 
-</div>
-
-</html>
\ No newline at end of file
+</t:layout>


Mime
View raw message