Skip to content

Commit

Permalink
Merge pull request #650 from davidjgonzalez/fix/643
Browse files Browse the repository at this point in the history
#643 - Site title shows up the component policy title if not authored…
  • Loading branch information
davidjgonzalez authored Sep 14, 2021
2 parents c8004ee + 768a845 commit 9d3144b
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed

- 0643 - Site title shows up the component policy title if not authored on header component policy

## [v2.1.4]

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public interface Header extends Component {
/**
* property in which a site title is stored.
*/
String PN_SITE_TITLE = JcrConstants.JCR_TITLE;
String PN_SITE_TITLE = "title";

/**
* Name of the node relative to the header component that stores the pages and icon items.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
import com.adobe.aem.commons.assetshare.components.structure.Header;
import com.adobe.cq.export.json.ComponentExporter;
import com.adobe.cq.export.json.ExporterConstants;
import com.day.cq.commons.jcr.JcrConstants;
import com.day.cq.wcm.api.Page;
import com.day.cq.wcm.api.PageManager;
import com.day.cq.wcm.api.designer.Style;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;
Expand Down Expand Up @@ -200,6 +201,11 @@ public String getSiteTitle() {
siteTitle = getHeaderProperty(PN_SITE_TITLE);
}

// Check old property name for backwards compatibility
if (siteTitle == null) {
siteTitle = getHeaderProperty(JcrConstants.JCR_TITLE);
}

return siteTitle;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
*/

@Version("2.0.1")
@Version("2.0.2")
package com.adobe.aem.commons.assetshare.components.structure;

import org.osgi.annotation.versioning.Version;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Site Title"
name="./title"/>

<site-title-legacy
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldDescription="Do not use this field. Please use the Site Title field defined above."
fieldLabel="Site Title (Legacy field)"
emptyText="Do not use this field. Please use the Site Title field above."
disabled="{Boolean}false"
name="./jcr:title"/>
</items>
</branding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,24 @@
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Site Title"
name="./jcr:title"/>
name="./title"/>

<home-page-path
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/pathfield"
fieldDescription="The home page for this Asset Share. When present the Logo will be hyperlinked to this page."
fieldLabel="Home Page Path"
name="./rootPath"
rootPath="/content"/>

<site-title-legacy
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldDescription="Do not use this field. Please use the Site Title field defined above."
fieldLabel="Site Title (Legacy field)"
emptyText="Do not use this field. Please use the Site Title field above."
disabled="{Boolean}false"
name="./jcr:title"/>
</items>
</column>
</items>
Expand Down

0 comments on commit 9d3144b

Please sign in to comment.