From 4c364fc54a0ba94300561d7d0300047def16af54 Mon Sep 17 00:00:00 2001 From: Boubaker Khanfir Date: Mon, 30 Oct 2023 17:43:37 +0100 Subject: [PATCH] feat: Add No Public Program Container - MEED-2804 - Meeds-io/MIPs#100 (#1233) This change will introduce a new Behavior container that will display its content only when there is no public programs. Besides, this change will move another Behavior Container from Gatein-portal. --- .../conf/sites/portal/public/pages.xml | 26 ++++++++++++++++--- .../UINoPublicProgramContainer.gtmpl | 8 ++++++ .../UIOpenRegistrationContainer.gtmpl | 9 +++++++ 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 webapps/plf-sites-extension/src/main/webapp/groovy/webui/container/UINoPublicProgramContainer.gtmpl create mode 100644 webapps/plf-sites-extension/src/main/webapp/groovy/webui/container/UIOpenRegistrationContainer.gtmpl diff --git a/webapps/plf-sites-extension/src/main/webapp/WEB-INF/conf/sites/portal/public/pages.xml b/webapps/plf-sites-extension/src/main/webapp/WEB-INF/conf/sites/portal/public/pages.xml index 073dc72fa..1e2472f01 100644 --- a/webapps/plf-sites-extension/src/main/webapp/WEB-INF/conf/sites/portal/public/pages.xml +++ b/webapps/plf-sites-extension/src/main/webapp/WEB-INF/conf/sites/portal/public/pages.xml @@ -19,7 +19,8 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. --> - @@ -101,7 +102,7 @@ false - + Everyone Everyone + + Everyone + + *:/platform/rewarding + + + gamification-portlets + CreateProgramButton + + Create Program Button + Everyone + false + + + Everyone *:/platform/administrators true - + Everyone Everyone diff --git a/webapps/plf-sites-extension/src/main/webapp/groovy/webui/container/UINoPublicProgramContainer.gtmpl b/webapps/plf-sites-extension/src/main/webapp/groovy/webui/container/UINoPublicProgramContainer.gtmpl new file mode 100644 index 000000000..f28eaa9ef --- /dev/null +++ b/webapps/plf-sites-extension/src/main/webapp/groovy/webui/container/UINoPublicProgramContainer.gtmpl @@ -0,0 +1,8 @@ +<% + import io.meeds.gamification.service.ProgramService; + + if(_ctx.getRequestContext().getUIApplication().isEditing() + || uicomponent.getApplicationComponent(ProgramService.class).countPublicPrograms() == 0) { + uicomponent.renderChildren(); + } +%> \ No newline at end of file diff --git a/webapps/plf-sites-extension/src/main/webapp/groovy/webui/container/UIOpenRegistrationContainer.gtmpl b/webapps/plf-sites-extension/src/main/webapp/groovy/webui/container/UIOpenRegistrationContainer.gtmpl new file mode 100644 index 000000000..9dae5d63b --- /dev/null +++ b/webapps/plf-sites-extension/src/main/webapp/groovy/webui/container/UIOpenRegistrationContainer.gtmpl @@ -0,0 +1,9 @@ +<% + import io.meeds.portal.security.service.SecuritySettingService; + import io.meeds.portal.security.constant.UserRegistrationType; + + if(_ctx.getRequestContext().getUIApplication().isEditing() + || UserRegistrationType.OPEN == uicomponent.getApplicationComponent(SecuritySettingService.class).getRegistrationType()) { + uicomponent.renderChildren(); + } +%> \ No newline at end of file