Authoring Step for text body
parent
b584b895d6
commit
6070c6aae1
|
|
@ -21,16 +21,18 @@ import javax.ws.rs.Path;
|
|||
|
||||
import org.librecms.ui.contentsections.documents.MvcAuthoringStep;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.ws.rs.FormParam;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PathParam;
|
||||
|
||||
import static org.librecms.ui.contenttypes.MvcArticlePropertiesStep.PATH_FRAGMENT;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -40,9 +42,10 @@ import static org.librecms.ui.contenttypes.MvcArticlePropertiesStep.PATH_FRAGMEN
|
|||
@Controller
|
||||
@Path("/")
|
||||
@AuthoringStepPathFragment(MvcArticleTextBodyStep.PATH_FRAGMENT)
|
||||
@Named("CmsArticleTextBodyStep")
|
||||
public class MvcArticleTextBodyStep implements MvcAuthoringStep {
|
||||
|
||||
static final String PATH_FRAGMENT = "basicproperties";
|
||||
static final String PATH_FRAGMENT = "text";
|
||||
|
||||
@Inject
|
||||
private ContentItemRepository itemRepo;
|
||||
|
|
@ -147,6 +150,18 @@ public class MvcArticleTextBodyStep implements MvcAuthoringStep {
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
public List<String> getUnusedLocales() {
|
||||
final Set<Locale> locales = document
|
||||
.getText()
|
||||
.getAvailableLocales();
|
||||
return globalizationHelper
|
||||
.getAvailableLocales()
|
||||
.stream()
|
||||
.filter(locale -> !locales.contains(locale))
|
||||
.map(Locale::toString)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/@add")
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@authoringsteps/basicproperties/title/@edit"
|
||||
editorId="title-editor"
|
||||
hasUnusedLocales="#{!CmsArticlePropertiesStep.unusedTitleLocales.isEmpty()}"
|
||||
headingLevel="3"
|
||||
objectIdentifier="#{CmsSelectedDocumentModel.itemPath}"
|
||||
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@authoringsteps/basicproperties/title/@remove"
|
||||
title="#{CmsArticleMessageBundle['basicproperties.title.header']}"
|
||||
|
|
@ -53,11 +54,13 @@
|
|||
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@authoringsteps/basicproperties/description/@edit"
|
||||
editorId="description-editor"
|
||||
hasUnusedLocales="#{!CmsArticlePropertiesStep.unusedTitleLocales.isEmpty()}"
|
||||
headingLevel="3"
|
||||
objectIdentifier="#{CmsSelectedDocumentModel.itemPath}"
|
||||
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@authoringsteps/basicproperties/description/@remove"
|
||||
title="#{CmsArticleMessageBundle['basicproperties.description.header']}"
|
||||
unusedLocales="#{CmsArticlePropertiesStep.unusedTitleLocales}"
|
||||
values="#{CmsArticlePropertiesStep.descriptionValues}"
|
||||
useTextarea="true"
|
||||
/>
|
||||
|
||||
</ui:composition>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html [<!ENTITY times '×'>]>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
|
||||
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
|
||||
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
|
||||
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
|
||||
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml">
|
||||
|
||||
<h2>#{CmsArticleMessageBundle['textstep.header']}</h2>
|
||||
|
||||
<libreccm:localizedStringEditor
|
||||
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@authoringsteps/text/@add"
|
||||
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@authoringsteps/text/@edit"
|
||||
editorId="article-text-editor"
|
||||
hasUnusedLocales="#{!CmsArticleTextBodyStep.unusedLocales.isEmpty()}"
|
||||
headingLevel="3"
|
||||
objectIdentifier="#{CmsSelectedDocumentModel.itemPath}"
|
||||
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@authoringsteps/text/@remove"
|
||||
title="#{CmsArticleMessageBundle['text.editor.header']}"
|
||||
unusedLocales="#{CmsArticleTextBodyStep.unusedLocales}"
|
||||
useTextarea="true"
|
||||
values="#{CmsArticleTextBodyStep.textValues}"
|
||||
/>
|
||||
|
||||
</ui:composition>
|
||||
</html>
|
||||
|
||||
Loading…
Reference in New Issue