Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds basic listing into /en page #1

Merged
merged 1 commit into from Apr 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/target/classes/META-INF/MANIFEST.MF
@@ -1,5 +1,5 @@
Manifest-Version: 1.0
Bnd-LastModified: 1522331928643
Bnd-LastModified: 1522747518123
Build-Jdk: 9.0.4
Built-By: MSteel
Bundle-Description: Core bundle for AEM62App
Expand Down
Binary file modified core/target/echo62.core-1.0-SNAPSHOT.jar
Binary file not shown.
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="com.aem.community.core.models.TestHelloWorldModel" time="0.186" tests="1" errors="0" skipped="0" failures="0">
<testsuite name="com.aem.community.core.models.TestHelloWorldModel" time="0.165" tests="1" errors="0" skipped="0" failures="0">
<properties>
<property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/>
<property name="java.vm.version" value="9.0.4+11"/>
Expand Down Expand Up @@ -62,5 +62,5 @@
<property name="ftp.nonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
<property name="sun.cpu.isalist" value=""/>
</properties>
<testcase name="testGetMessage" classname="com.aem.community.core.models.TestHelloWorldModel" time="0.186"/>
<testcase name="testGetMessage" classname="com.aem.community.core.models.TestHelloWorldModel" time="0.165"/>
</testsuite>
@@ -1,4 +1,4 @@
-------------------------------------------------------------------------------
Test set: com.aem.community.core.models.TestHelloWorldModel
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.187 sec - in com.aem.community.core.models.TestHelloWorldModel
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.167 sec - in com.aem.community.core.models.TestHelloWorldModel
Binary file modified it.launcher/target/echo62.it.launcher-1.0-SNAPSHOT.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion it.launcher/target/maven-archiver/pom.properties
@@ -1,5 +1,5 @@
#Generated by Maven
#Thu Mar 29 14:58:52 BST 2018
#Tue Apr 03 10:25:21 BST 2018
groupId=AEM62App
artifactId=echo62.it.launcher
version=1.0-SNAPSHOT
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion it.tests/target/classes/META-INF/MANIFEST.MF
@@ -1,5 +1,5 @@
Manifest-Version: 1.0
Bnd-LastModified: 1522331930843
Bnd-LastModified: 1522747520457
Build-Jdk: 9.0.4
Built-By: MSteel
Bundle-Description: Bundles for Integration Tests for AEM62App
Expand Down
Binary file modified it.tests/target/echo62.it.tests-1.0-SNAPSHOT.jar
Binary file not shown.
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Component"
jcr:title="Listing Component"
componentGroup="AEM62"/>
@@ -0,0 +1,41 @@
/*
* Copyright 2015 Adobe Systems Incorporated
*
* Licensed 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.
*/
package apps.AEM62App.components.content.listing;

import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import java.net.*;
import java.io.*;

import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.Default;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.settings.SlingSettingsService;

@Model(adaptables=Resource.class)
public class Listing {

@Inject
private SlingSettingsService settings;

@Inject @Named("sling:resourceType") @Default(values="No resourceType")
protected String resourceType;

public String getLogo() {
return "<img src=\"https://www.costa.co.uk/img/header/logo@2x.png\">";
}
}
@@ -0,0 +1,21 @@
<?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="nt:unstructured"
jcr:title="Properties"
sling:resourceType="cq/gui/components/authoring/dialog">
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
</items>
</column>
</items>
</content>
</jcr:root>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:ClientLibraryFolder"
categories="[AEM62CSS.textimage]"/>
@@ -0,0 +1,2 @@

style.css
@@ -0,0 +1,68 @@
/*
* Copyright 2015 Adobe Systems Incorporated
*
* Licensed 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.
*/

@import url('https://fonts.googleapis.com/css?family=Lobster+Two|Magra');

.listingContainer {
font-family: 'Magra', sans-serif;
margin: 0px auto;
padding: 100px;
text-align: center;
padding-top: 80px;
background: white;
font-size: 18px;
}

.left,
.right {
display: block;
min-width: 700px;
text-align: center;
padding-top: 50px;
padding-bottom: 50px;
}

.left {
background: white;
color: #111;
margin-bottom: 30px;
}

.listingContainer .leftHeader {
width: 608px;
height: 54px;
font-family: TradeGothic;
font-size: 32px;
font-weight: bold;
font-style: normal;
font-stretch: normal;
line-height: 1.69;
letter-spacing: normal;
text-align: center;
color: #404042;
margin: auto;
}

.right {
background: #6c2037;
color: white;
}

.right div input {
font-size: 18px;
margin-bottom: 20px;
padding: 4px;
}
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Dialog"
title="Properties"
xtype="panel">
<items jcr:primaryType="cq:WidgetCollection">
</items>
</jcr:root>
@@ -0,0 +1,44 @@
<script>
const renderListing = (data, template) => {
let html = ''
if (data && data.products) {
for (let index in data.products) {
const product = data.products[index]
html =
html +
template
.replace(/{name}/g, product.name || '')
.replace(/{price}/g, product.price || '')
.replace(/{src}/g, product.src || '')
}
}
document.getElementById('listingContainer').innerHTML = html
}

const getData = (url, next) => {
const xhr = new XMLHttpRequest()
xhr.open('GET', url)
xhr.onload = function() {
if (xhr.status === 200) {
let data = xhr.responseText
try {
data = JSON.parse(xhr.responseText)
} catch (e) {}
next(data)
}
}
xhr.send()
}

const getTemplate = data => {
getData('http://localhost:4502/content/AEM62App/menuItem.html', template => {
renderListing(data, template)
})
}

const getListing = () => {
getData('http://demo5716470.mockable.io/products/', getTemplate)
}

getListing()
</script>
@@ -1,20 +1,18 @@
<!--/*
Copyright 2015 Adobe Systems Incorporated

Licensed 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.
*/-->
<meta charset="utf-8" data-sly-use.head="head.js">
<title>${currentPage.title || currentPage.name}</title>
<meta name="keywords" content="${head.keywords}"/>
<meta name="description" content="${properties.jcr:description}"/>
<link data-sly-test="${head.favIcon}" rel="icon" href="${head.favIcon}"/>
<div class="listingContainer" id="listingContainer" data-sly-use.header="Listing">
<sly data-sly-include="js/listing.html" />
</div>
Expand Up @@ -14,5 +14,5 @@
limitations under the License.
*/-->
<div class="menuItemContainer" data-sly-use.menuItem="MenuItem">
This is a menu item ${menuItem.item}
This is a menu item {name}, it costs £{price}
</div>
Expand Up @@ -13,9 +13,6 @@
See the License for the specific language governing permissions and
limitations under the License.
*/-->
<!doctype html>
<html lang="en">
<body class="page ${currentPage.template.name}">
<sly data-sly-include="partials/menuItem.html" data-sly-unwrap/>
</body>
</html>
<div class="listing-item">
<sly data-sly-include="partials/menuItem.html" data-sly-unwrap/>
</div>

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.