Skip to content

Instantly share code, notes, and snippets.

View nateyolles's full-sized avatar
😄

Nate Yolles nateyolles

😄
View GitHub Profile
@nateyolles
nateyolles / .content.xml
Created July 13, 2016 05:08
AEM Granite Render Condition
<widgetParam
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldLabel="This only shows with querystring param &quot;biz=baz&quot;"
name="./widgetParam">
<granite:rendercondition
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/renderconditions/simple"
expression="${param.biz == 'baz'}"/>
</widgetParam>
@nateyolles
nateyolles / ClientLibUseObject.java
Created June 1, 2016 04:08
Custom ClientLibUseObject Java-Use POJO to create custom HTML markup
package apps.clientlib_async.sightly.templates;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Collection;
import java.util.List;
import java.util.ArrayList;
import javax.script.Bindings;
@nateyolles
nateyolles / CustomSightlyClientLib.html
Created June 1, 2016 04:06
Custom Client Library Sightly templates in AEM
<!--/*
For the entire file, see: https://github.com/nateyolles/aem-clientlib-async/blob/master/clientlib-async/apps/clientlib-async/sightly/templates/clientlib.html
*/-->
<template data-sly-template.all="${@ categories='Client Library categories',
loading='Accepts async and defer',
onload='JavaScript to run for async and defer',
crossorigin='Accepts anonymous and use-credentials'}">
<section data-sly-test="${request.getResourceResolver}"
data-sly-use.clientlib="${'/apps/clientlib-async/sightly/templates/graniteClientLib.html'}"
data-sly-call="${clientlib.include @ categories=categories, loading=loading, onload=onload, crossorigin=crossorigin}"
@nateyolles
nateyolles / CustomSightlyClientLibUsage.html
Created June 1, 2016 04:05
Custom Client Library Usage in AEM with Sightly
<head data-sly-use.clientLib="${'/apps/clientlib-async/sightly/templates/clientlib.html'}">
<!--/* for css+js */-->
<meta data-sly-call="${clientLib.all @ categories='your.clientlib'}" data-sly-unwrap></meta>
</head>
@nateyolles
nateyolles / SightlyClientLibUsage.html
Created June 1, 2016 04:04
Use Client Libraries in AEM with Sightly
<head data-sly-use.clientLib="${'/libs/granite/sightly/templates/clientlib.html'}">
<!--/* for css+js */-->
<meta data-sly-call="${clientLib.all @ categories='your.clientlib'}" data-sly-unwrap></meta>
<!--/* only js */-->
<meta data-sly-call="${clientLib.js @ categories='your.clientlib'}" data-sly-unwrap></meta>
<!--/* only css */-->
<meta data-sly-call="${clientLib.css @ categories='your.clientlib'}" data-sly-unwrap></meta>
@nateyolles
nateyolles / conf.json
Created March 27, 2016 19:06
AEM example slash conf structure
{
"jcr:primaryType": "sling:Folder",
"jcr:mixinTypes": ["rep:AccessControllable"],
"global": {
"jcr:primaryType": "sling:Folder",
"settings": {
"jcr:primaryType": "sling:Folder",
"socialmedia": {
"jcr:primaryType": "cq:Page",
"facebook": {
@nateyolles
nateyolles / ConfOtherModel.java
Created March 27, 2016 18:54
AEM com.adobe.granite.confmgr.Conf examples of getting a specific configuration and getting it's list of inherited settings
package com.nateyolles.aem.slashconf.core.models;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ValueMap;
@nateyolles
nateyolles / ConfServiceAccountModel.java
Last active March 28, 2016 17:43
AEM com.adobe.granite.confmgr.Conf example of using a Service Account
package com.nateyolles.aem.slashconf.core.models;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.LoginException;
@nateyolles
nateyolles / ConfServiceModel.java
Created March 27, 2016 18:52
AEM com.adobe.granite.confmgr.Conf example of using the com.adobe.granite.confmgr.ConfMgr service
package com.nateyolles.aem.slashconf.core.models;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;
import org.apache.sling.models.annotations.Model;
@nateyolles
nateyolles / ConfModel.java
Created March 27, 2016 18:50
AEM com.adobe.granite.confmgr.Conf example by adapting the current page
package com.nateyolles.aem.slashconf.core.models;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.ValueMap;
import org.apache.sling.models.annotations.Model;
import com.adobe.granite.confmgr.Conf;