-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
61de30d
commit 63ecf7f
Showing
10 changed files
with
345 additions
and
3 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
webapp/portlet/src/main/webapp/vue-apps/common/js/SitesService.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* This file is part of the Meeds project (https://meeds.io/). | ||
* | ||
* Copyright (C) 2023 Meeds Association [email protected] | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
export function retrieveSites(siteType, displayed, allSites, excludedSiteName, expandNavigations, filterByPermission) { | ||
|
||
const formData = new FormData(); | ||
if (siteType) { | ||
formData.append('siteType', siteType); | ||
} | ||
formData.append('displayed', displayed); | ||
formData.append('allSites', allSites); | ||
formData.append('filterByPermission', filterByPermission); | ||
if (excludedSiteName) { | ||
formData.append('excludedSiteName', excludedSiteName); | ||
} | ||
formData.append('expandNavigations', expandNavigations); | ||
const params = new URLSearchParams(formData).toString(); | ||
|
||
return fetch(`${eXo.env.portal.context}/${eXo.env.portal.rest}/v1/sitesManagement?${params}`, { | ||
method: 'GET', | ||
credentials: 'include', | ||
}).then(resp => { | ||
if (resp?.ok) { | ||
return resp.json(); | ||
} else { | ||
throw new Error('error while retrieving sites'); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
webapp/portlet/src/main/webapp/vue-apps/hamburger-menu/components/site/SiteHamburgerItem.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<!-- | ||
This file is part of the Meeds project (https://meeds.io/). | ||
Copyright (C) 2020 - 2023 Meeds Association [email protected] | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 3 of the License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public License | ||
along with this program; if not, write to the Free Software Foundation, | ||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
--> | ||
<template> | ||
<v-list-item :href="uri" class="ps-0"> | ||
<v-list-item-icon class="flex align-center flex-grow-0 my-2"> | ||
<v-icon v-if="siteRootNode.icon"> {{ icon }}</v-icon> | ||
<i v-else :class="iconClass"></i> | ||
</v-list-item-icon> | ||
<v-list-item-content> | ||
<v-list-item-title | ||
class="subtitle-2" | ||
v-text="site.displayName" /> | ||
</v-list-item-content> | ||
</v-list-item> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
site: { | ||
type: Object, | ||
default: null | ||
} | ||
}, | ||
data: () => ({ | ||
BASE_SITE_URI: `${eXo.env.portal.context}/${eXo.env.portal.portalName}/`, | ||
}), | ||
computed: { | ||
uri() { | ||
return this.site?.siteNavigations && this.site?.siteNavigations[0]?.uri && this.site?.siteNavigations[0].pageLink && this.urlVerify(this.site?.siteNavigations[0].pageLink) || `/portal/${this.site.name}/${this.site?.siteNavigations[0].uri}`; | ||
}, | ||
icon() { | ||
return `fas ${this.site?.siteNavigations && this.site?.siteNavigations[0]?.icon}`; | ||
}, | ||
siteRootNode() { | ||
return this.site?.siteNavigations && this.site?.siteNavigations[0]; | ||
}, | ||
iconClass() { | ||
const capitilizedName = `${this.siteRootNode.name[0].toUpperCase()}${this.siteRootNode.name.slice(1)}`; | ||
return `uiIcon uiIconFile uiIconToolbarNavItem uiIcon${capitilizedName} icon${capitilizedName} ${this.siteRootNode.icon}`; | ||
} | ||
}, | ||
methods: { | ||
urlVerify(url) { | ||
if (!url.match(/^(https?:\/\/|javascript:|\/portal\/)/)) { | ||
url = `//${url}`; | ||
} | ||
return url; | ||
}, | ||
} | ||
}; | ||
</script> |
47 changes: 47 additions & 0 deletions
47
webapp/portlet/src/main/webapp/vue-apps/hamburger-menu/components/site/SiteHamburgerList.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!-- | ||
This file is part of the Meeds project (https://meeds.io/). | ||
Copyright (C) 2020 - 2023 Meeds Association [email protected] | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 3 of the License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public License | ||
along with this program; if not, write to the Free Software Foundation, | ||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
--> | ||
<template> | ||
<v-list | ||
dense | ||
min-width="90%" | ||
class="pb-0"> | ||
<v-list-item | ||
v-for="site in sites" | ||
:key="site.name" | ||
link> | ||
<site-hamburger-item | ||
v-if="!site.defaultSite" | ||
:site="site" /> | ||
<site-hamburger-navigation-list v-else :navigations="site.siteNavigations" /> | ||
</v-list-item> | ||
</v-list> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
sites: { | ||
type: Array, | ||
default: () => [] | ||
} | ||
} | ||
}; | ||
</script> |
69 changes: 69 additions & 0 deletions
69
...t/src/main/webapp/vue-apps/hamburger-menu/components/site/SiteHamburgerNavigationItem.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<!-- | ||
This file is part of the Meeds project (https://meeds.io/). | ||
Copyright (C) 2020 - 2023 Meeds Association [email protected] | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 3 of the License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public License | ||
along with this program; if not, write to the Free Software Foundation, | ||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
--> | ||
<template> | ||
<v-list-item | ||
:href="uri" | ||
:target="target" | ||
class="ps-0"> | ||
<v-list-item-icon class-name="flex align-center flex-grow-0"> | ||
<v-icon v-if="navigation.icon"> {{ icon }}</v-icon> | ||
<i v-else :class="iconClass"></i> | ||
</v-list-item-icon> | ||
<v-list-item-content> | ||
<v-list-item-title | ||
class-name="subtitle-2" | ||
v-text="navigation.label" /> | ||
</v-list-item-content> | ||
</v-list-item> | ||
</template> | ||
<script> | ||
export default { | ||
props: { | ||
navigation: { | ||
type: Object, | ||
default: null | ||
} | ||
}, | ||
computed: { | ||
uri() { | ||
return this.navigation?.pageLink && this.urlVerify(this.navigation.pageLink) || `/portal/${this.navigation.siteKey.name}/${this.navigation.uri}`; | ||
}, | ||
target() { | ||
return this.navigation?.target === 'SAME_TAB' && '_self' || '_blank'; | ||
}, | ||
icon() { | ||
return `fas ${this.navigation?.icon}`; | ||
}, | ||
iconClass() { | ||
const capitilizedName = `${this.navigation.name[0].toUpperCase()}${this.navigation.name.slice(1)}`; | ||
return `uiIcon uiIconFile uiIconToolbarNavItem uiIcon${capitilizedName} icon${capitilizedName} ${this.navigation.icon}`; | ||
} | ||
}, | ||
methods: { | ||
urlVerify(url) { | ||
if (!url.match(/^(https?:\/\/|javascript:|\/portal\/)/)) { | ||
url = `//${url}`; | ||
} | ||
return url; | ||
}, | ||
} | ||
}; | ||
</script> |
42 changes: 42 additions & 0 deletions
42
...t/src/main/webapp/vue-apps/hamburger-menu/components/site/SiteHamburgerNavigationList.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!-- | ||
This file is part of the Meeds project (https://meeds.io/). | ||
Copyright (C) 2020 - 2023 Meeds Association [email protected] | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 3 of the License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public License | ||
along with this program; if not, write to the Free Software Foundation, | ||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
--> | ||
<template> | ||
<v-main class="ps-0"> | ||
<v-list-item | ||
v-for="navigation in navigations" | ||
:key="navigation.name" | ||
dense | ||
class="pb-0 ps-0"> | ||
<site-hamburger-navigation-item | ||
:navigation="navigation" /> | ||
</v-list-item> | ||
</v-main> | ||
</template> | ||
<script> | ||
export default { | ||
props: { | ||
navigations: { | ||
type: Array, | ||
default: () => [] | ||
} | ||
} | ||
}; | ||
</script> |
Oops, something went wrong.