Skip to content

Commit

Permalink
feat: Allow External users to display badges list - MEED-7635 - Meeds…
Browse files Browse the repository at this point in the history
…-io/meeds#2484 (#1751)

This change will allow users member of '/platform/externals' to display
the list of Badges from Badges Overview Portlet. At the same time, this
will change the margins of Badges list display to avoid having a
scrollbar.
  • Loading branch information
boubaker committed Oct 11, 2024
1 parent 82872d9 commit edb58c3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 27 deletions.
49 changes: 23 additions & 26 deletions portlets/src/main/webapp/WEB-INF/jsp/badgesOverview.jsp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<%@page import="org.exoplatform.services.security.ConversationState"%>
<%
/**
* This file is part of the Meeds project (https://meeds.io/).
Expand Down Expand Up @@ -26,34 +25,32 @@
<%@ page import="org.exoplatform.portal.application.PortalRequestContext"%>
<%@ page import="org.exoplatform.portal.config.UserACL"%>
<%@ page import="org.exoplatform.container.ExoContainerContext"%>
<%@page import="org.exoplatform.services.security.ConversationState"%>
<%
String profileOwnerId = Utils.getOwnerIdentityId();
Identity ownerIdentity = Utils.getOwnerIdentity(true);
Profile profile = ownerIdentity.getProfile();
boolean isExternal = profile.getProperty(Profile.EXTERNAL) != null && ((String) profile.getProperty(Profile.EXTERNAL)).equals("true");
if (!isExternal) {
String portletStorageId = ((String) request.getAttribute("portletStorageId"));
String showName = request.getAttribute("showName") == null ? "false" : ((String[]) request.getAttribute("showName"))[0];
String sortBy = request.getAttribute("badgesSortBy") == null ? "" : ((String[]) request.getAttribute("badgesSortBy"))[0];
Page currentPage = PortalRequestContext.getCurrentInstance().getPage();
boolean canEdit = ExoContainerContext.getService(UserACL.class).hasEditPermission(currentPage, ConversationState.getCurrent().getIdentity());
String pageRef = currentPage.getPageKey().format();
String portletStorageId = ((String) request.getAttribute("portletStorageId"));
String showName = request.getAttribute("showName") == null ? "false" : ((String[]) request.getAttribute("showName"))[0];
String sortBy = request.getAttribute("badgesSortBy") == null ? "" : ((String[]) request.getAttribute("badgesSortBy"))[0];
Page currentPage = PortalRequestContext.getCurrentInstance().getPage();
boolean canEdit = ExoContainerContext.getService(UserACL.class).hasEditPermission(currentPage, ConversationState.getCurrent().getIdentity());
String pageRef = currentPage.getPageKey().format();
%>
<div class="VuetifyApp">
<div data-app="true"
class="v-application white v-application--is-ltr theme--light profileAboutMeOther"
id="badgesOverview">
<script type="text/javascript">
eXo.env.portal.addOnLoadCallback(() => {
window.require(['PORTLET/gamification-portlets/BadgesOverview'], app => app.init(
<%=portletStorageId%>,
<%=showName%>,
'<%=sortBy%>',
<%=canEdit%>,
'<%=pageRef%>'
));
});
</script>
</div>
<div class="VuetifyApp">
<div data-app="true"
class="v-application white v-application--is-ltr theme--light profileAboutMeOther"
id="badgesOverview">
<script type="text/javascript">
eXo.env.portal.addOnLoadCallback(() => {
window.require(['PORTLET/gamification-portlets/BadgesOverview'], app => app.init(
<%=portletStorageId%>,
<%=showName%>,
'<%=sortBy%>',
<%=canEdit%>,
'<%=pageRef%>'
));
});
</script>
</div>
<% } %>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
:class="!loading && 'd-flex'"
class="align-center justify-center transparent flex-grow-0 flex-shrink-0 border-box-sizing px-5 ma-auto"
max-width="100%"
min-height="100"
min-height="90"
flat>
<card-carousel
v-if="hasBadges"
Expand Down

0 comments on commit edb58c3

Please sign in to comment.