Model for page properties.
parent
2c7208818f
commit
f8ef994da0
|
|
@ -37,6 +37,7 @@ import org.librecms.contentsection.ContentItemManager;
|
||||||
import org.librecms.contentsection.ContentItemVersion;
|
import org.librecms.contentsection.ContentItemVersion;
|
||||||
import org.librecms.pages.models.CategoryModel;
|
import org.librecms.pages.models.CategoryModel;
|
||||||
import org.librecms.pages.models.ContentItemModel;
|
import org.librecms.pages.models.ContentItemModel;
|
||||||
|
import org.librecms.pages.models.PagePropertiesModel;
|
||||||
import org.librecms.pages.models.SiteInfoModel;
|
import org.librecms.pages.models.SiteInfoModel;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
@ -191,6 +192,9 @@ public class PagesController {
|
||||||
@Inject
|
@Inject
|
||||||
private PageManager pageManager;
|
private PageManager pageManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private PagePropertiesModel pagePropertiesModel;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private PagesRepository pagesRepo;
|
private PagesRepository pagesRepo;
|
||||||
|
|
||||||
|
|
@ -336,6 +340,7 @@ public class PagesController {
|
||||||
final Pages pages = getPages(domain);
|
final Pages pages = getPages(domain);
|
||||||
final Category category = getCategory(domain, pages, "/");
|
final Category category = getCategory(domain, pages, "/");
|
||||||
final Page page = pageManager.findPageForCategory(category);
|
final Page page = pageManager.findPageForCategory(category);
|
||||||
|
pagePropertiesModel.setProperties(page.getProperties());
|
||||||
return themesMvc.getMvcTemplate(
|
return themesMvc.getMvcTemplate(
|
||||||
uriInfo, "pages", page.getDisplayName()
|
uriInfo, "pages", page.getDisplayName()
|
||||||
);
|
);
|
||||||
|
|
@ -494,6 +499,7 @@ public class PagesController {
|
||||||
final Pages pages = getPages(domain);
|
final Pages pages = getPages(domain);
|
||||||
final Category category = getCategory(domain, pages, pagePath);
|
final Category category = getCategory(domain, pages, pagePath);
|
||||||
final Page page = pageManager.findPageForCategory(category);
|
final Page page = pageManager.findPageForCategory(category);
|
||||||
|
pagePropertiesModel.setProperties(page.getProperties());
|
||||||
return themesMvc.getMvcTemplate(
|
return themesMvc.getMvcTemplate(
|
||||||
uriInfo, "pages", page.getDisplayName()
|
uriInfo, "pages", page.getDisplayName()
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2021 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.librecms.pages.models;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
@Named("CmsPagePropertiesModel")
|
||||||
|
public class PagePropertiesModel {
|
||||||
|
|
||||||
|
private Map<String, String> properties;
|
||||||
|
|
||||||
|
public Map<String, String> getProperties() {
|
||||||
|
return Collections.unmodifiableMap(properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProperties(final Map<String, String> properties) {
|
||||||
|
this.properties = new HashMap<>(properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue