rombert closed pull request #1: SLING-7308 - Sling 9 Compatibility URL: https://github.com/apache/sling-samples/pull/1
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/htlblog/README.md b/htlblog/README.md index 2e0c79d..640d664 100644 --- a/htlblog/README.md +++ b/htlblog/README.md @@ -11,13 +11,13 @@ This sample is designed as an introduction to Sling and HTL. ## Requirements * [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) -* [Sling 8](http://sling.apache.org/downloads.cgi) +* [Sling 9](http://sling.apache.org/downloads.cgi) * [Maven 3+](http://maven.apache.org/download.cgi) ## Installation ### 1. Run Sling - java -jar org.apache.sling.launchpad-8.jar + java -jar org.apache.sling.launchpad-9.jar ### 2. Install HTLBlog @@ -25,7 +25,7 @@ This sample is designed as an introduction to Sling and HTL. ### 3. Explore - http://localhost:8080/content/htlblog.html + http://localhost:8080/content/htlblog/posts.html ## Parts of the Application ### Java @@ -50,9 +50,8 @@ HTL Blog uses Sling Models extensively. You can read about them [here](https://s * Mostly Bootstrap and some basic custom styles. ### Content -The content is built using a single JSON file called `htlblog.json`. It maps to the following nodes: +The content is built using a two JSON files under `/content/htlblog`. They map to the following nodes: -* `/content/htlblog` - Our homepage. Currently lists our posts. * `/content/htlblog/admin` - Our admin home. Used to list our posts for editing or deleting. * `/content/htlblog/admin/edit` - Our edit page. Use to create, or if a post path is supplied, it will edit an existing post. * `/content/htlblog/posts` - Another post list, but also used as the parent of our posts. diff --git a/htlblog/pom.xml b/htlblog/pom.xml index a96f3a9..3d54198 100644 --- a/htlblog/pom.xml +++ b/htlblog/pom.xml @@ -56,7 +56,10 @@ org.apache.sling.samples.htlblog </Sling-Model-Packages> <!-- Always overwrite all content to give us a fresh start --> - <Sling-Initial-Content>initial-content;overwrite:=true;uninstall:=true</Sling-Initial-Content> + <Sling-Initial-Content> + initial-content/apps/htlblog;overwrite:=true;uninstall:=true;path:=/apps/htlblog, + initial-content/content/htlblog;overwrite:=true;uninstall:=true;path:=/content/htlblog + </Sling-Initial-Content> </instructions> </configuration> <version>3.3.0</version> @@ -66,8 +69,8 @@ <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> - <source>7</source> - <target>7</target> + <source>8</source> + <target>8</target> </configuration> </plugin> <plugin> @@ -127,7 +130,7 @@ <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.api</artifactId> - <version>2.9.0</version> + <version>2.16.2</version> <scope>provided</scope> </dependency> <dependency> @@ -156,13 +159,13 @@ <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.models.api</artifactId> - <version>1.2.2</version> + <version>1.3.4</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.models.impl</artifactId> - <version>1.2.2</version> + <version>1.4.2</version> <scope>provided</scope> </dependency> <dependency> diff --git a/htlblog/src/main/resources/initial-content/apps/htlblog/admin/page/nav.html b/htlblog/src/main/resources/initial-content/apps/htlblog/admin/page/nav.html index 007b54b..e611072 100644 --- a/htlblog/src/main/resources/initial-content/apps/htlblog/admin/page/nav.html +++ b/htlblog/src/main/resources/initial-content/apps/htlblog/admin/page/nav.html @@ -23,7 +23,7 @@ <span class="icon-bar"></span> <span class="icon-bar"></span> </button> - <a class="navbar-brand" href="/content/htlblog.html">HTL Blog</a> + <a class="navbar-brand" href="/content/htlblog/posts.html">HTL Blog</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> diff --git a/htlblog/src/main/resources/initial-content/apps/htlblog/public/page/nav.html b/htlblog/src/main/resources/initial-content/apps/htlblog/public/page/nav.html index b97ff94..5cee374 100644 --- a/htlblog/src/main/resources/initial-content/apps/htlblog/public/page/nav.html +++ b/htlblog/src/main/resources/initial-content/apps/htlblog/public/page/nav.html @@ -23,7 +23,7 @@ <span class="icon-bar"></span> <span class="icon-bar"></span> </button> - <a class="navbar-brand" href="/content/htlblog.html">HTL Blog</a> + <a class="navbar-brand" href="/content/htlblog/posts.html">HTL Blog</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> diff --git a/htlblog/src/main/resources/initial-content/content/htlblog.json b/htlblog/src/main/resources/initial-content/content/htlblog.json deleted file mode 100644 index 83633c3..0000000 --- a/htlblog/src/main/resources/initial-content/content/htlblog.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "htlblog/public/list", - "title": "HTL Blog", - "description": "The blog homepage.", - "posts": { - "jcr:primaryType": "sling:OrderedFolder", - "sling:resourceType": "htlblog/public/list", - "title": "HTL Blog", - "description": "The blog homepage.", - "hello-world" : { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "htlblog/public/post", - "title": "Hello World", - "jcr:createdBy": "admin", - "created": "2017-04-01T13:26:00.000+01:00", - "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." - }, - "hola-mundo" : { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "htlblog/public/post", - "title": "Hola Mundo", - "jcr:createdBy": "admin", - "created": "2017-04-01T13:26:00.000+01:00", - "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." - } - }, - "admin": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "htlblog/admin/list", - "title": "HTL Blog Admin", - "description": "The blog admin.", - "edit": { - "jcr:primaryType": "nt:unstructured", - "sling:resourceType": "htlblog/admin/edit", - "title": "HTL Blog Edit" - } - } -} \ No newline at end of file diff --git a/htlblog/src/main/resources/initial-content/content/htlblog/admin.json b/htlblog/src/main/resources/initial-content/content/htlblog/admin.json new file mode 100644 index 0000000..46a6f65 --- /dev/null +++ b/htlblog/src/main/resources/initial-content/content/htlblog/admin.json @@ -0,0 +1,11 @@ +{ + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "htlblog/admin/list", + "title": "HTL Blog Admin", + "description": "The blog admin.", + "edit": { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "htlblog/admin/edit", + "title": "HTL Blog Edit" + } +} \ No newline at end of file diff --git a/htlblog/src/main/resources/initial-content/content/htlblog/posts.json b/htlblog/src/main/resources/initial-content/content/htlblog/posts.json new file mode 100644 index 0000000..3eea1fa --- /dev/null +++ b/htlblog/src/main/resources/initial-content/content/htlblog/posts.json @@ -0,0 +1,22 @@ +{ + "jcr:primaryType": "sling:OrderedFolder", + "sling:resourceType": "htlblog/public/list", + "title": "HTL Blog", + "description": "The blog homepage.", + "hello-world" : { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "htlblog/public/post", + "title": "Hello World", + "jcr:createdBy": "admin", + "created": "2017-04-01T13:26:00.000+01:00", + "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." + }, + "hola-mundo" : { + "jcr:primaryType": "nt:unstructured", + "sling:resourceType": "htlblog/public/post", + "title": "Hola Mundo", + "jcr:createdBy": "admin", + "created": "2017-04-01T13:26:00.000+01:00", + "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." + } +} \ No newline at end of file ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services