You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2021/07/13 10:45:22 UTC

[sling-project-archetype] branch master updated: SLING-10604 - Add default, simple, styling to the generated project

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-project-archetype.git


The following commit(s) were added to refs/heads/master by this push:
     new 6d3bca0  SLING-10604 - Add default, simple, styling to the generated project
6d3bca0 is described below

commit 6d3bca0fed295047891f0340ed2493be3a3bc389
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Jul 13 13:41:49 2021 +0300

    SLING-10604 - Add default, simple, styling to the generated project
---
 .../META-INF/maven/archetype-metadata.xml          |  1 +
 .../apps/__appsFolderName__/home/body.html         |  1 -
 .../apps/__appsFolderName__/home/head.html         |  1 +
 .../apps/__appsFolderName__/page/body.html         |  3 +-
 .../apps/__appsFolderName__/page/footer.html       |  2 +-
 .../apps/__appsFolderName__/page/head.html         |  1 +
 .../apps/__appsFolderName__/page/page.html         | 18 +++++--
 .../__contentFolderName__/home/.content.xml        |  2 +-
 .../home/{welcome => contact}/.content.xml         |  4 +-
 .../home/welcome/.content.xml                      |  2 +-
 .../{home => static}/.content.xml                  |  9 +---
 .../__contentFolderName__/static/styles.css        | 56 ++++++++++++++++++++++
 12 files changed, 79 insertions(+), 21 deletions(-)

diff --git a/src/main/resources/META-INF/maven/archetype-metadata.xml b/src/main/resources/META-INF/maven/archetype-metadata.xml
index 265f9ed..a864e0b 100644
--- a/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -154,6 +154,7 @@
                     <includes>
                         <include>**/*.xml</include>
                         <include>**/*.html</include>
+                        <include>**/*.css</include>
                     </includes>
                 </fileSet>
             </fileSets>
diff --git a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/home/body.html b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/home/body.html
index aa6ce9d..cadec86 100644
--- a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/home/body.html
+++ b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/home/body.html
@@ -20,7 +20,6 @@
     under the License.
 */ -->
 <h2>${symbol_dollar}{properties.jcr:title}</h2>
-<p>${artifactName} Home Page from Sling Project Archetype</p>
 <p><b><i>Description: </i></b>${symbol_dollar}{properties.jcr:description}</p>
 <div data-sly-use.sampleRequest="${package}.${slingModelSubPackage}.SampleRequestModel">
 	<p>Current User: ${symbol_dollar}{sampleRequest.currentUser}</p>
diff --git a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/home/head.html b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/home/head.html
index cbf8586..b6b3662 100644
--- a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/home/head.html
+++ b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/home/head.html
@@ -23,4 +23,5 @@
 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <title>${artifactName} Home Page</title>
+<link rel="stylesheet" href="/content/${contentFolderName}/static/styles.css">
 <!-- ${symbol_dollar}{properties.jcr:title} -->
\ No newline at end of file
diff --git a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/page/body.html b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/page/body.html
index 7741f7a..9057248 100644
--- a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/page/body.html
+++ b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/page/body.html
@@ -20,5 +20,4 @@
     under the License.
 */ -->
 <h2>${symbol_dollar}{properties.jcr:title}</h2>
-<p>${artifactName} Page from Sling Project Archetype</p>
-<p><b>Description: </b>${symbol_dollar}{properties.jcr:description}</p>
\ No newline at end of file
+<p>${symbol_dollar}{properties.jcr:description}</p>
\ No newline at end of file
diff --git a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/page/footer.html b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/page/footer.html
index b1c2e6b..00f16cb 100644
--- a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/page/footer.html
+++ b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/page/footer.html
@@ -19,4 +19,4 @@
     specific language governing permissions and limitations
     under the License.
 */ -->
-${artifactName} Footer
+${artifactName} Footer. Website generated from the <a href="https://github.com/apache/sling-project-archetype">Sling Project Archetype</a>.
diff --git a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/page/head.html b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/page/head.html
index 0dd5a53..9cdf197 100644
--- a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/page/head.html
+++ b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/page/head.html
@@ -23,4 +23,5 @@
 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <title>${artifactName} Page</title>
+<link rel="stylesheet" href="/content/${contentFolderName}/static/styles.css">
 <!-- ${symbol_dollar}{properties.jcr:title} -->
\ No newline at end of file
diff --git a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/page/page.html b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/page/page.html
index b0d2d52..58830fb 100644
--- a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/page/page.html
+++ b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/page/page.html
@@ -25,12 +25,20 @@
     <sly data-sly-include="${symbol_dollar}{'head.html'}"/>
 </head>
     <body>
-        <h3>Navigation</h3>
-        <div data-sly-list.child="${symbol_dollar}{resource.listChildren}">
-            <a href="${symbol_dollar}{child.path}.html">${symbol_dollar}{child.name}</a>
+        <nav >
+            <a href="/content/${contentFolderName}/home.html">Home</a>
+            <sly data-sly-unwrap data-sly-list.child="${symbol_dollar}{resource.listChildren}">
+                | <a href="${symbol_dollar}{child.path}.html">${symbol_dollar}{child.name}</a>
+            </sly>
+        </nav>
+        <div class="body">
+            <sly data-sly-include="${symbol_dollar}{'body.html'}"/>
+            <div class="explanation">
+                This is a standard Sling page. The title and description rendered are 
+                taken from the resource properties. The resource currently being rendered is
+                ${symbol_dollar}{resource.path} and its resource type is ${symbol_dollar}{properties.sling:resourceType} 
+            </div>
         </div>
-        <br/>
-        <sly data-sly-include="${symbol_dollar}{'body.html'}"/>
         <footer>
             <sly data-sly-include="${symbol_dollar}{'footer.html'}"/>
         </footer>
diff --git a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/home/.content.xml b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/home/.content.xml
index ddda733..0fa70fc 100644
--- a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/home/.content.xml
+++ b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/home/.content.xml
@@ -17,7 +17,7 @@
 <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
           jcr:primaryType="sling:Folder"
           jcr:title="${artifactName} Home"
-          jcr:description="${artifactName} Home Page"
+          jcr:description="${artifactName} Home Page. This is the entry point to your website and typically contains a welcome message and links to the most important pages."
           sling:resourceType="${appsFolderName}/home"
 >
 </jcr:root>
diff --git a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/home/welcome/.content.xml b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/home/contact/.content.xml
similarity index 87%
copy from src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/home/welcome/.content.xml
copy to src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/home/contact/.content.xml
index acdc0f8..cdd15f4 100644
--- a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/home/welcome/.content.xml
+++ b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/home/contact/.content.xml
@@ -18,8 +18,8 @@
     under the License.
 --><jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
           jcr:primaryType="sling:Folder"
-          jcr:title="${artifactName} Welcome"
-          jcr:description="${artifactName} Welcome Page"
+          jcr:title="${artifactName} Contact"
+          jcr:description="${artifactName} Contact Page. This is a page where contact information can be added."
           sling:resourceType="${appsFolderName}/page"
 >
 </jcr:root>
diff --git a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/home/welcome/.content.xml b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/home/welcome/.content.xml
index acdc0f8..2180d1a 100644
--- a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/home/welcome/.content.xml
+++ b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/home/welcome/.content.xml
@@ -19,7 +19,7 @@
 --><jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
           jcr:primaryType="sling:Folder"
           jcr:title="${artifactName} Welcome"
-          jcr:description="${artifactName} Welcome Page"
+          jcr:description="${artifactName} Welcome Page. This is an example sub-page that demonstrates how multiple resource types can work in a single page."
           sling:resourceType="${appsFolderName}/page"
 >
 </jcr:root>
diff --git a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/home/.content.xml b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/static/.content.xml
similarity index 79%
copy from src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/home/.content.xml
copy to src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/static/.content.xml
index ddda733..dc674df 100644
--- a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/home/.content.xml
+++ b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/static/.content.xml
@@ -1,6 +1,3 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
     Licensed to the Apache Software Foundation (ASF) under one or more contributor license
@@ -16,8 +13,4 @@
 -->
 <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
           jcr:primaryType="sling:Folder"
-          jcr:title="${artifactName} Home"
-          jcr:description="${artifactName} Home Page"
-          sling:resourceType="${appsFolderName}/home"
->
-</jcr:root>
+/>
diff --git a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/static/styles.css b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/static/styles.css
new file mode 100644
index 0000000..b2700e4
--- /dev/null
+++ b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/content/__contentFolderName__/static/styles.css
@@ -0,0 +1,56 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements.  See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership.  The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License.  You may obtain a copy of the License at
+ ~
+ ~   http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied.  See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+body {
+    margin: 1em 5%;
+    background-color: #fafafa;
+    font-family: sans-serif;
+}
+
+h1, h2, h3, h4, h5, h6 {
+    font-family: serif;
+}
+
+nav {
+    background-color: #f9bb00;
+    border: 2px solid #f9bb00;
+    padding: 0.5em;
+    border-radius: 3px 3px 0 0;
+}
+
+nav, nav a  {
+    color: white;
+    text-decoration: none;
+    font-size: 1.2em;
+}
+
+.body {
+    padding: 0 2em;
+}
+
+.explanation {
+    font-style: italic;
+}
+
+footer {
+    border-top: 2px solid #eeeeee;
+    margin-top: 1em;
+    padding: 1em;
+    font-size: 0.8em;
+}