Skip to content

Instantly share code, notes, and snippets.

View by-4x1's full-sized avatar

B Yih by-4x1

View GitHub Profile
@mattlo
mattlo / README.md
Last active July 6, 2023 07:44
AEM 6.2 Touch UI Rich Text Editor Inline Dialog; Coral UI, RTE, CQ5, CUI, RichText

Example config for RTE within a Dialog

  • rtePlugins enables the CUI registry (cq/ui/rte/core/plugins/PluginRegistry.js)
    • Some plugins are enabled be default, so there's instances online where this section is omitted. You'll need this configuration if you want anything that isn't default. I left some other plugin configurations here that aren't in use.
  • uiSettings is a configuration used by CUI
    • Some online resources will note other cui children. inline is the configuration plugin for the inline toolbar mode. fullscreen is the configuration plugin for the full screen toolbar mode. If a plugin isn't enabled, some settings here won't activate.
  • Fixed inline mode won't work for 6.0 or 6.1. You'll need 6.2. In 6.3+, this may not work due to CUI2 being introduced. CUI2 may simplify some setup.

table

<alignment jcr:primaryType="nt:unstructured"
name="./alignChildren"
fieldLabel="Alignment of components"
required="{Boolean}true"
selectionMode="single"
sling:resourceType="granite/ui/components/coral/foundation/form/buttongroup">
<items jcr:primaryType="nt:unstructured">
<default jcr:primaryType="nt:unstructured"
name="./default"

Note that offline compaction requires a long duration of downtime from 30 minutes to 7 hours (and in extreme cases more time).

Offline Oak compaction with debug logging:

  1. Stop Oak / AEM
  2. Install the latest Oak hotfix to your AEM instance:
@nateyolles
nateyolles / ResourceToJSONServlet.java
Created December 9, 2015 04:47
Sample servlet which easily prints an AEM/Sling Resource/Node as JSON to the PrintWriter.
package com.nateyolles.aem;
import org.apache.felix.scr.annotations.sling.SlingServlet;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.jcr.JsonItemWriter;
@nateyolles
nateyolles / aemClassicSelectionCheckboxDialog.xml
Last active July 5, 2022 15:53
AEM Classic UI component dialog checkboxes using the selection xtype
<!-- Checked checkbox will result in a String property of "true" -->
<myCheckbox
jcr:primaryType="cq:Widget"
fieldLabel="My Checkbox"
name="./myCheckbox"
type="checkbox"
xtype="selection"/>
<!-- Checked checkbox will result in a Boolean property of true-->
<myBooleanCheckbox
@gabrielwalt
gabrielwalt / logic.js
Last active May 17, 2021 14:09
Read AEM runmodes from Sightly
var SlingSettingsService = Packages.org.apache.sling.settings.SlingSettingsService;
use(function () {
// Get runmodes and transform them into an object that is easier to read for Sightly
var runmodesObj = {};
var runmodesSet = sling.getService(SlingSettingsService).getRunModes();
var iterator = runmodesSet.iterator();
while (iterator.hasNext()) {
runmodesObj[iterator.next()] = true;
@rjspiker
rjspiker / .content.xml
Last active January 7, 2022 06:07
AEM 6 Touch UI Show/Hide Checkbox Component Extension - Extension to the standard checkbox component. It enables hiding/unhiding of other components based on the selection made in the checkbox.
<enable
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/checkbox"
text="Enable"
id="enable"
value="true"
name="./enable"
class="cq-dialog-checkbox-showhide"
cq-dialog-checkbox-showhide-target=".button-option-enable-showhide-target"/>
<deleteEnable
@gabrielwalt
gabrielwalt / aem-debug
Last active March 7, 2020 16:30
Run AEM in debug mode
java -jar cq-quickstart-6.0.0.jar -debug 10123
@urre
urre / gist:30523173fb22e3a375fa
Created October 27, 2014 13:44
Slick.js slider with thumbnails
$('.specs__slider').slick({
dots: true,
centerMode: true,
focusOnSelect: true,
arrows: false,
customPaging: function(slider, i) {
return '<div class="thumbnails">' +$(slider.$slides[i]).find('img').prop('outerHTML')+ '</div>';
}
});
@floriankraft
floriankraft / JcrQueryLibrary.md
Last active July 28, 2025 14:45
Some useful JCR queries (XPATH, SQL2) for AEM/CQ development.

SQL2

All nodes with a specific name

SELECT * FROM [nt:unstructured] AS node
WHERE ISDESCENDANTNODE(node, "/search/in/path")
AND NAME() = "nodeName"

All pages below content path