Views for editing the abstract of a publication.

pull/1/head
Jens Pelzetter 2022-06-25 13:14:47 +02:00
parent 2f1d3b34a0
commit 8a8c6326bd
7 changed files with 147 additions and 1 deletions

View File

@ -297,6 +297,12 @@ public class PublicationAbstractStep extends AbstractMvcAuthoringStep {
); );
if (canEdit) { if (canEdit) {
abstractStepModel.setCanEdit(canEdit); abstractStepModel.setCanEdit(canEdit);
abstractStepModel.setPublicationTitle(
globalizationHelper
.getValueFromLocalizedString(
getPublication().getTitle()
)
);
abstractStepModel.setAbstractValues( abstractStepModel.setAbstractValues(
getPublication() getPublication()
.getPublicationAbstract() .getPublicationAbstract()

View File

@ -21,6 +21,8 @@ public class PublicationAbstractStepModel {
private boolean canEdit; private boolean canEdit;
private String publicationTitle;
private Map<String, String> abstractValues; private Map<String, String> abstractValues;
private List<CmsEditorLocaleVariantRow> variants; private List<CmsEditorLocaleVariantRow> variants;
@ -29,6 +31,14 @@ public class PublicationAbstractStepModel {
private String selectedLocale; private String selectedLocale;
public String getPublicationTitle() {
return publicationTitle;
}
public void setPublicationTitle(final String publicationTitle) {
this.publicationTitle = publicationTitle;
}
public Map<String, String> getAbstractValues() { public Map<String, String> getAbstractValues() {
return Collections.unmodifiableMap(abstractValues); return Collections.unmodifiableMap(abstractValues);
} }
@ -53,7 +63,7 @@ public class PublicationAbstractStepModel {
this.unusedLocales = new ArrayList<>(unusedLocales); this.unusedLocales = new ArrayList<>(unusedLocales);
} }
public String getSelectedLocales() { public String getSelectedLocale() {
return selectedLocale; return selectedLocale;
} }

View File

@ -0,0 +1,32 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<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:librecms="http://xmlns.jcp.org/jsf/composite/components/librecms"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml">
<ui:define name="authoringStep">
<h2>#{SciPublicationsUiMessageBundle.getMessage('editsteps.abstract.header', SciCmsPublicationAbstractStepModel.publicationTitle)}</h2>
<librecms:cmsEditorVariants
addButtonLabel="#{SciPublicationsUiMessageBundle['editsteps.abstract.editor.add_variant']}"
addDialogLocaleSelectHelp="#{SciPublicationsUiMessageBundle['editsteps.abstract.editor.add.locale_help']}"
addMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@publication-abstract/abstract/add"
canEdit="#{SciCmsPublicationAbstractStepModel.canEdit}"
editorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@publication-abstract/abstract/edit"
hasUnusedLocales="#{!SciCmsPublicationAbstractStepModel.unusedLocales.isEmpty()}"
headingLevel="3"
removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@publication-abstract/abstract/remove"
sourceEditorPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@publication-abstract/abstract/edit-source"
title="#{SciPublicationsUiMessageBundle['editsteps.abstract.editor.header']}"
unusedLocales="#{SciCmsPublicationAbstractStepModel.unusedLocales}"
variants="#{SciCmsPublicationAbstractStepModel.variants}"
variantsId="publication-abstract"
viewPageUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@publication-abstract/abstract/view"
/>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,42 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<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:librecms="http://xmlns.jcp.org/jsf/composite/components/librecms"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml">
<ui:define name="authoringStep">
<div class="d-flex">
<a class="btn btn-secondary btn-sm align-self-center mr-2"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/docuemnts/#{CmsSelectedDocumentModel.itemPath}/@publication-abstract">
<bootstrap:svgIcon icon="caret-left-fill" />
<span class="sr-only">#{SciPublicationsUiMessageBundle['editsteps.abstract.step_back']}</span>
</a>
<h2>#{SciPublicationsUiMessageBundle['editsteps.abstract.header_edit']}</h2>
</div>
<c:if test="#{SciCmsPublicationAbstractStepModel.canEdit}">
<librecms:cmsEditor
backUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/docuemnts/#{CmsSelectedDocumentModel.itemPath}/@publication-abstract"
baseUrl="#{mvc.basePath}"
canEdit="#{SciCmsPublicationAbstractStepModel.canEdit}"
contentSection="#{ContentSectionModel.sectionName}"
editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@publication-abstract/abstract/edit"
editorId="scipublication-abstract-editor"
objectIdentifier="#{CmsSelectedDocumentModel.itemPath}"
selectedLocale="#{SciCmsPublicationAbstractStepModel.selectedLocale}"
title="#{SciPublicationsUiMessageBundle['editsteps.abstract.editor.header']}"
variantUrl="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@publication-abstract-resources"
/>
</c:if>
</ui:define>
<ui:define name="scripts">
<script src="#{request.contextPath}/assets/@content-sections/cms-editor.js"></script>
</ui:define>
</ui:composition>
</html>

View File

@ -0,0 +1,40 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<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:librecms="http://xmlns.jcp.org/jsf/composite/components/librecms"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<ui:composition template="/WEB-INF/views/org/librecms/ui/contentsection/documents/authoringstep.xhtml">
<ui:define name="authoringStep">
<div class="d-flex">
<a class="btn btn-secondary btn-sm align-self-center mr-2"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@publication-abstract">
<bootstrap:svgIcon icon="caret-left-fill" />
<span class="sr-only">#{SciPublicationsUiMessageBundle['editsteps.abstract.step_back']}</span>
</a>
<h2>#{SciPublicationsUiMessageBundle['editsteps.abstract.header_view']}</h2>
</div>
<c:if test="#{SciCmsPublicationAbstractStepModel.canEdit}">
<div class="text-right">
<a class="btn btn-secondary"
href="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@publication-abstract/abstract/edit">
<bootstrap:svgIcon icon="pen" />
<span class="sr-only">#{SciPublicationsUiMessageBundle['editsteps.abstract.edit']}</span>
</a>
</div>
</c:if>
<div class="cms-text-preview article-text border p-2">
<h:outputText escape="false"
value="#{SciCmsPublicationAbstractStepModel.abstractValues.get(SciCmsPublicationAbstractStepModel.selectedLocale)}"
</div>
</ui:define>
</ui:composition>
</html>

View File

@ -361,3 +361,11 @@ publication.editstep.properties.edit.close=Cancel
publication.editstep.properties.edit.submit=Save publication.editstep.properties.edit.submit=Save
monograph.reviewed.yes=Yes monograph.reviewed.yes=Yes
monograph.reviewed.no=No monograph.reviewed.no=No
editsteps.abstract.header=Edit abstract of publication {0}
editsteps.abstract.editor.add_variant=Add a localized abstract
editsteps.abstract.editor.add.locale_help=The locale of the abstract.
editsteps.abstract.editor.header=Edit localized abstracts
editsteps.abstract.step_back=Back
editsteps.abstract.header_view=Abstract
editsteps.abstract.edit=Edit
editsteps.abstract.header_edit=Edit abstract

View File

@ -361,3 +361,11 @@ publication.editstep.properties.edit.close=Abbrechen
publication.editstep.properties.edit.submit=Speichern publication.editstep.properties.edit.submit=Speichern
monograph.reviewed.yes=Ja monograph.reviewed.yes=Ja
monograph.reviewed.no=Nein monograph.reviewed.no=Nein
editsteps.abstract.header=Zusammenfassung der Publikation {0} bearbeiten
editsteps.abstract.editor.add_variant=Add a localized abstract
editsteps.abstract.editor.add.locale_help=Die Sprache der Zusammenfassung.
editsteps.abstract.editor.header=Lokalisierte Zusammenfassungen bearbeiten
editsteps.abstract.step_back=Zur\u00fcck
editsteps.abstract.header_view=Zusammenfassung
editsteps.abstract.edit=Bearbeiten
editsteps.abstract.header_edit=Zusammenfassung bearbeiten