Skip to content

Commit

Permalink
#149 adjusted navigation models
Browse files Browse the repository at this point in the history
  • Loading branch information
smcgrath0 committed Aug 17, 2020
1 parent 6118944 commit 0e15b6a
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 16 deletions.
34 changes: 18 additions & 16 deletions core/src/main/java/com/themecleanflex/models/NavigationModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,13 @@
}
}
},
"levelsdeep": {
"levels": {
"type": "string",
"x-source": "inject",
"x-form-label": "Levels Deep",
"x-form-type": "materialrange",
"x-default": 1,
"x-form-min": 1,
"x-form-max": 5
"x-form-type": "number",
"x-form-label": "Levels",
"x-form-default": 1,
"x-form-min": 1
},
"mobiletoggletype": {
"type": "string",
Expand Down Expand Up @@ -375,10 +374,9 @@ public class NavigationModel extends AbstractComponent {
@Default(values ="end")
private String justifyitems;

/* {"type":"string","x-source":"inject","x-form-label":"Levels Deep","x-form-type":"materialrange","x-default":1,"x-form-min":1,"x-form-max":5} */
/* {"type":"string","x-source":"inject","x-form-type":"number","x-form-label":"Levels","x-form-default":1,"x-form-min":1} */
@Inject
@Default(values ="1")
private String levelsdeep;
private String levels;

/* {"type":"string","x-source":"inject","x-form-label":"Collapse Style for mobile","x-form-type":"materialradio","x-default":"toggle","properties":{"toggle":{"x-form-name":"Toggle","x-form-value":"toggle"},"accordion":{"x-form-name":"Accordion","x-form-value":"accordion"}}} */
@Inject
Expand Down Expand Up @@ -501,11 +499,6 @@ public String getJustifyitems() {
return justifyitems;
}

/* {"type":"string","x-source":"inject","x-form-label":"Levels Deep","x-form-type":"materialrange","x-default":1,"x-form-min":1,"x-form-max":5} */
public String getLevelsdeep() {
return levelsdeep;
}

/* {"type":"string","x-source":"inject","x-form-label":"Collapse Style for mobile","x-form-type":"materialradio","x-default":"toggle","properties":{"toggle":{"x-form-name":"Toggle","x-form-value":"toggle"},"accordion":{"x-form-name":"Accordion","x-form-value":"accordion"}}} */
public String getMobiletoggletype() {
return mobiletoggletype;
Expand Down Expand Up @@ -624,13 +617,23 @@ public String getContentname() {

/* {"type":"string","x-source":"inject","x-form-type":"number","x-form-label":"Levels","x-form-default":1,"x-form-min":1} */
public String getLevels() {
return "2";
return levels == null ? "1" : levels;
}

public String getExcludeSitemapExcludes() {
return excludesitemapexcludes == null ? "false" : excludesitemapexcludes;
}

public String getRootPage() {
if(rootpage == null) {
PerPage currentPage = getResource().adaptTo(PerPage.class);
if(currentPage != null) {
return currentPage.getPath();
}
}
return rootpage;
}

public String getRootPageTitle() {
PerPageManager ppm = getResource().getResourceResolver().adaptTo(PerPageManager.class);
PerPage page = ppm.getPage(getRootpage());
Expand Down Expand Up @@ -697,7 +700,6 @@ public Boolean getHasChildren() {

public List<Page> getChildrenPages() {
List<Page> childPages = new ArrayList<Page>();
System.out.println();
if(page != null) {
for (PerPage child: page.listChildren()) {
if(excludeSitemap && child.getContentProperty(EXCLUDE_FROM_SITEMAP, false)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.themecleanflex.models;

import com.peregrine.nodetypes.models.AbstractComponent;
import com.peregrine.nodetypes.models.IComponent;
import com.peregrine.nodetypes.models.Container;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.Default;
import org.apache.sling.models.annotations.DefaultInjectionStrategy;
import org.apache.sling.models.annotations.Exporter;
import org.apache.sling.models.annotations.Model;
import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;

/*
//GEN[:DATA
{
"definitions": {
"Navigationnested": {
"type": "object",
"x-type": "component",
"properties": {}
}
},
"name": "Navigationnested",
"componentPath": "themecleanflex/components/navigationnested",
"package": "com.themecleanflex.models",
"modelName": "Navigationnested",
"classNameParent": "AbstractComponent"
}
//GEN]
*/

//GEN[:DEF
@Model(
adaptables = Resource.class,
resourceType = "themecleanflex/components/navigationnested",
defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL,
adapters = IComponent.class
)
@Exporter(
name = "jackson",
extensions = "json"
)

//GEN]
public class NavigationnestedModel extends AbstractComponent {

public NavigationnestedModel(Resource r) { super(r); }

//GEN[:INJECT

//GEN]

//GEN[:GETTERS

//GEN]

//GEN[:CUSTOMGETTERS
//GEN]

}

0 comments on commit 0e15b6a

Please sign in to comment.