Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
ugly aem page with knotx snippet #61
Browse files Browse the repository at this point in the history
  • Loading branch information
malaskowski committed May 15, 2019
1 parent 9c80eee commit 884e509
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 4 deletions.
1 change: 1 addition & 0 deletions aem/gradle/environment.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ configure<AemExtension> {
url("Author login", "http://author.example.com/libs/granite/core/content/login.html" +
"?resource=%2F&\$\$login\$\$=%24%24login%24%24&j_reason=unknown&j_reason_code=unknown", text = "AEM Sign In")
url("Knot.x", "http://knotx.example.com/", statusCode = 404)
url("Knot.x product", "http://knotx.example.com/products/10.html", text = "Hello Knot.x with GAP")
}
}

Expand Down
3 changes: 2 additions & 1 deletion aem/gradle/environment/knotx/conf/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
<logger name="io.vertx" level="TRACE"/>

<root level="INFO">
<!-- FixMe log to file -->
<appender-ref ref="FILE"/>
<!-- <appender-ref ref="CONSOLE"/>-->
<appender-ref ref="CONSOLE"/>
</root>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ allowedRequestHeaders = [
User-Agent
Via
"X-.*"
"Host.*"
]

# Statically defined HTTP request header sent in every request to the repository
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:Page">
<jcr:content
cq:designPath="/apps/settings/wcm/designs/example/sites"
cq:template="/apps/example/sites/templates/home-page"
jcr:primaryType="cq:PageContent"
jcr:title="Products List"
jcr:description="Home Page of English US market"
jcr:language="en_US"
sling:resourceType="example/sites/components/home-page">
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="wcm/foundation/components/parsys"/>
</jcr:content>
</jcr:root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:Page">
<jcr:content
cq:designPath="/apps/settings/wcm/designs/example/sites"
cq:template="/apps/example/sites/templates/products-detail-page"
jcr:primaryType="cq:PageContent"
jcr:title="Products List"
jcr:description="Home Page of English US market"
jcr:language="en_US"
sling:resourceType="example/sites/components/products-detail-page">
</jcr:content>
</jcr:root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
cq:isContainer="{Boolean}false"
jcr:primaryType="cq:Component"
jcr:title="Products Detail Page"
sling:resourceSuperType="wcm/foundation/components/page"
allowedParents=""/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<sly data-sly-use.page="com.company.example.aem.sites.components.page.PageModel"/>
<sly data-sly-use.clientLib="${'/libs/granite/sightly/templates/clientlib.html'}"/>
<!DOCTYPE html>
<html lang="${page.languageCode}">
<head>
<title>Example | ${page.title}</title>

<sly data-sly-call="${clientLib.css @ categories='example.sites.publish'}"/>
<sly data-sly-call="${clientLib.css @ categories='example.sites.author'}" data-sly-test="${!wcmmode.disabled}"/>
</head>
<body>
<header id="header" class="container">
<div class="jumbotron">
<h1>${page.title}</h1>
<p>${page.description}</p>
</div>
</header>
<div id="content" class="container">
<knotx:snippet data-knotx-task="hello-world">
<p>{{hello._result.message}}</p>
</knotx:snippet>
</div>
<footer id="footer" class="container">
<div class="card">
<div class="card-header">
AEM application built by
</div>
<div class="card-body">
<a href="https://github.com/Cognifide/gradle-aem-plugin">
<img class="logo" src="/etc.clientlibs/example/sites/clientlibs/page/publish/resources/img/logo.png" alt="">
</a>
</div>
</div>

<div class="mt-3 mb-3">
All rights reserved | 2019 &copy; Company
</div>
</footer>

<sly data-sly-call="${clientLib.js @ categories='example.sites.publish'}"/>
<sly data-sly-call="${clientLib.js @ categories='example.sites.author'}" data-sly-test="${!wcmmode.disabled}"/>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:Template"
jcr:title="Product Detail Page"
allowedParents="[/apps/example/sites/templates/products-detail-page]"
ranking="{Long}100">
<jcr:content
cq:allowedTemplates="[/apps/example/sites/templates/products-detail-page]"
cq:designPath="/apps/settings/wcm/designs/example/sites"
jcr:primaryType="cq:PageContent"
sling:resourceType="example/sites/components/products-detail-page">
</jcr:content>
</jcr:root>
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ class PageModel : Serializable {
}

private fun determineLanguageCode(): String {
val languagePath = LanguageUtil.getLanguageRoot(resource.path)
val languagePart = languagePath.substringAfterLast("/")
// val languagePath = LanguageUtil.getLanguageRoot(resource.path)
// val languagePart = languagePath.substringAfterLast("/")

return LanguageUtil.getLanguage(languagePart).languageCode ?: "en"
// return LanguageUtil.getLanguage(languagePart).languageCode ?: "en"
return "en"
}

}

0 comments on commit 884e509

Please sign in to comment.