Model for page properties.

pull/10/head
Jens Pelzetter 2021-11-18 19:35:05 +01:00
parent 2c7208818f
commit f8ef994da0
2 changed files with 52 additions and 0 deletions

View File

@ -37,6 +37,7 @@ import org.librecms.contentsection.ContentItemManager;
import org.librecms.contentsection.ContentItemVersion;
import org.librecms.pages.models.CategoryModel;
import org.librecms.pages.models.ContentItemModel;
import org.librecms.pages.models.PagePropertiesModel;
import org.librecms.pages.models.SiteInfoModel;
import java.net.URI;
@ -191,6 +192,9 @@ public class PagesController {
@Inject
private PageManager pageManager;
@Inject
private PagePropertiesModel pagePropertiesModel;
@Inject
private PagesRepository pagesRepo;
@ -336,6 +340,7 @@ public class PagesController {
final Pages pages = getPages(domain);
final Category category = getCategory(domain, pages, "/");
final Page page = pageManager.findPageForCategory(category);
pagePropertiesModel.setProperties(page.getProperties());
return themesMvc.getMvcTemplate(
uriInfo, "pages", page.getDisplayName()
);
@ -494,6 +499,7 @@ public class PagesController {
final Pages pages = getPages(domain);
final Category category = getCategory(domain, pages, pagePath);
final Page page = pageManager.findPageForCategory(category);
pagePropertiesModel.setProperties(page.getProperties());
return themesMvc.getMvcTemplate(
uriInfo, "pages", page.getDisplayName()
);

View File

@ -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);
}
}