From dbbb57b1ad041f7b762430cfb5ed5cfad01e6188 Mon Sep 17 00:00:00 2001 From: Jens Pelzetter Date: Mon, 7 Feb 2022 21:08:09 +0100 Subject: [PATCH] Some more bugfixes for event. --- .../contenttypes/event/MvcEventInfoStep.java | 60 +++++++++---------- .../event/MvcEventInfoStepResources.java | 12 ++-- .../librecms/cmsEditorVariants.xhtml | 37 +++++++----- .../ui/contenttypes/event/event-info.xhtml | 20 ++++--- .../contenttypes/event/eventdate/edit.xhtml | 24 ++++---- .../contenttypes/event/eventdate/view.xhtml | 2 +- .../contenttypes/event/eventtype/edit.xhtml | 24 ++++---- .../contenttypes/event/eventtype/view.xhtml | 2 +- .../ui/contenttypes/event/location/edit.xhtml | 24 ++++---- .../ui/contenttypes/event/location/view.xhtml | 2 +- .../event/main-contributor/edit.xhtml | 24 ++++---- .../event/main-contributor/view.xhtml | 2 +- .../ui/contenttypes/EventBundle.properties | 1 + .../ui/contenttypes/EventBundle_de.properties | 1 + .../event-info-step-eventdate.ts | 52 ++++++++++++++++ .../event-info-step-eventtype.ts | 52 ++++++++++++++++ .../event-info-step-location.ts | 52 ++++++++++++++++ .../event-info-step-maincontributor.ts | 52 ++++++++++++++++ ccm-cms/webpack.config.js | 4 ++ 19 files changed, 336 insertions(+), 111 deletions(-) create mode 100644 ccm-cms/src/main/typescript/content-sections/event-info-step-eventdate.ts create mode 100644 ccm-cms/src/main/typescript/content-sections/event-info-step-eventtype.ts create mode 100644 ccm-cms/src/main/typescript/content-sections/event-info-step-location.ts create mode 100644 ccm-cms/src/main/typescript/content-sections/event-info-step-maincontributor.ts diff --git a/ccm-cms/src/main/java/org/librecms/ui/contenttypes/event/MvcEventInfoStep.java b/ccm-cms/src/main/java/org/librecms/ui/contenttypes/event/MvcEventInfoStep.java index c7a7c9120..286b6f57d 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contenttypes/event/MvcEventInfoStep.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contenttypes/event/MvcEventInfoStep.java @@ -52,7 +52,7 @@ import javax.ws.rs.PathParam; * @author Jens Pelzetter */ @RequestScoped -@Path(MvcAuthoringSteps.PATH_PREFIX + "@event-info") +@Path(MvcAuthoringSteps.PATH_PREFIX + "event-info") @Controller @MvcAuthoringStepDef( bundle = EventStepsConstants.BUNDLE, @@ -277,7 +277,7 @@ public class MvcEventInfoStep extends AbstractMvcAuthoringStep { if (itemPermissionChecker.canEditItem(getEvent())) { final Locale locale = new Locale(localeParam); - getEvent().getText().removeValue(locale); + getEvent().getEventDate().removeValue(locale); itemRepo.save(getEvent()); return buildRedirectPathForStep(); @@ -510,7 +510,7 @@ public class MvcEventInfoStep extends AbstractMvcAuthoringStep { ); } final Locale locale = new Locale(localeParam); - getEvent().getText().putValue(locale, value); + getEvent().getMainContributor().putValue(locale, value); itemRepo.save(getEvent()); return buildRedirectPathForStep(); @@ -557,9 +557,9 @@ public class MvcEventInfoStep extends AbstractMvcAuthoringStep { } @POST - @Path("/main-contributor/add") + @Path("/main-contributor/edit/{locale}") @Transactional(Transactional.TxType.REQUIRED) - public String addMainContributorValue( + public String editMainContributorValue( @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) final String sectionIdentifier, @PathParam(MvcAuthoringSteps.DOCUMENT_PATH_PATH_PARAM_NAME) @@ -675,7 +675,7 @@ public class MvcEventInfoStep extends AbstractMvcAuthoringStep { ); } final Locale locale = new Locale(localeParam); - getEvent().getEventDate().putValue(locale, value); + getEvent().getEventType().putValue(locale, value); itemRepo.save(getEvent()); return buildRedirectPathForStep(); @@ -689,7 +689,7 @@ public class MvcEventInfoStep extends AbstractMvcAuthoringStep { } @GET - @Path("/eventdate/edit/{locale}") + @Path("/eventtype/edit/{locale}") @Transactional(Transactional.TxType.REQUIRED) public String editEventTypeValue( @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) @@ -720,7 +720,7 @@ public class MvcEventInfoStep extends AbstractMvcAuthoringStep { } @POST - @Path("/eventdate/edit/{locale}") + @Path("/eventtype/edit/{locale}") @Transactional(Transactional.TxType.REQUIRED) public String editEventTypeValue( @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) @@ -754,7 +754,7 @@ public class MvcEventInfoStep extends AbstractMvcAuthoringStep { } @POST - @Path("/eventdate/remove/{locale}") + @Path("/eventtype/remove/{locale}") @Transactional(Transactional.TxType.REQUIRED) public String removeEventTypeValue( @PathParam(MvcAuthoringSteps.SECTION_IDENTIFIER_PATH_PARAM) @@ -845,7 +845,7 @@ public class MvcEventInfoStep extends AbstractMvcAuthoringStep { ); locationModel.setVariants( getEvent() - .getEventDate() + .getLocation() .getValues() .entrySet() .stream() @@ -902,36 +902,36 @@ public class MvcEventInfoStep extends AbstractMvcAuthoringStep { eventTypeModel.setCanEdit(canEdit); eventTypeModel.setEventTypeValues( getEvent() - .getEventType() - .getValues() - .entrySet() - .stream() - .collect( - Collectors.toMap( - entry -> entry.getKey().toString(), - Map.Entry::getValue + .getEventType() + .getValues() + .entrySet() + .stream() + .collect( + Collectors.toMap( + entry -> entry.getKey().toString(), + Map.Entry::getValue + ) ) - ) ); eventTypeModel.setVariants( getEvent() - .getEventType() - .getValues() - .entrySet() - .stream() - .map(CmsEditorUtil::buildVariantRow) - .collect(Collectors.toList()) + .getEventType() + .getValues() + .entrySet() + .stream() + .map(CmsEditorUtil::buildVariantRow) + .collect(Collectors.toList()) ); final Set eventTypeLocales = getEvent() .getEventType() .getAvailableLocales(); eventTypeModel.setUnusedLocales( globalizationHelper - .getAvailableLocales() - .stream() - .filter(locale -> !eventTypeLocales.contains(locale)) - .map(Locale::toString) - .collect(Collectors.toList()) + .getAvailableLocales() + .stream() + .filter(locale -> !eventTypeLocales.contains(locale)) + .map(Locale::toString) + .collect(Collectors.toList()) ); } } diff --git a/ccm-cms/src/main/java/org/librecms/ui/contenttypes/event/MvcEventInfoStepResources.java b/ccm-cms/src/main/java/org/librecms/ui/contenttypes/event/MvcEventInfoStepResources.java index d44766652..210f1fa9d 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contenttypes/event/MvcEventInfoStepResources.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contenttypes/event/MvcEventInfoStepResources.java @@ -139,7 +139,7 @@ public class MvcEventInfoStepResources { // Location @GET - @Path("/eventdate/wordcount/{locale}") + @Path("/location/wordcount/{locale}") @Produces(MediaType.TEXT_HTML) @Transactional(Transactional.TxType.REQUIRED) public String getLocationWordCount( @@ -181,7 +181,7 @@ public class MvcEventInfoStepResources { } @GET - @Path("/eventdate/{locale}") + @Path("/location/{locale}") @Produces(MediaType.TEXT_HTML) @Transactional(Transactional.TxType.REQUIRED) public String viewLocationValue( @@ -217,7 +217,7 @@ public class MvcEventInfoStepResources { // Main Contributor @GET - @Path("/eventdate/wordcount/{locale}") + @Path("/main-contributor/wordcount/{locale}") @Produces(MediaType.TEXT_HTML) @Transactional(Transactional.TxType.REQUIRED) public String getMainContributorWordCount( @@ -259,7 +259,7 @@ public class MvcEventInfoStepResources { } @GET - @Path("/eventdate/{locale}") + @Path("/main-contributor/{locale}") @Produces(MediaType.TEXT_HTML) @Transactional(Transactional.TxType.REQUIRED) public String viewMainContributorValue( @@ -295,7 +295,7 @@ public class MvcEventInfoStepResources { // Event Type @GET - @Path("/eventdate/wordcount/{locale}") + @Path("/eventtype/wordcount/{locale}") @Produces(MediaType.TEXT_HTML) @Transactional(Transactional.TxType.REQUIRED) public String getEventTypeWordCount( @@ -337,7 +337,7 @@ public class MvcEventInfoStepResources { } @GET - @Path("/eventdate/{locale}") + @Path("/eventtype/{locale}") @Produces(MediaType.TEXT_HTML) @Transactional(Transactional.TxType.REQUIRED) public String viewEventTypeValue( diff --git a/ccm-cms/src/main/resources/META-INF/resources/components/librecms/cmsEditorVariants.xhtml b/ccm-cms/src/main/resources/META-INF/resources/components/librecms/cmsEditorVariants.xhtml index 6318a72a7..d084b0477 100644 --- a/ccm-cms/src/main/resources/META-INF/resources/components/librecms/cmsEditorVariants.xhtml +++ b/ccm-cms/src/main/resources/META-INF/resources/components/librecms/cmsEditorVariants.xhtml @@ -189,6 +189,13 @@ shortDescription="Info about the available variants. Must be a List of CmsEditorLocaleVariantRow objects." type="java.util.List" /> +