From 5c9d56208c848ac770833d3910c9c41d64a52af7 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Tue, 16 Mar 2021 16:57:15 +0100 Subject: [PATCH] Populate about page --- assets/css/pages/groups/pages/about.css | 6 ++- assets/css/pages/groups/sections/tabs.css | 2 +- assets/js/components/groups/GroupsList.js | 20 ++++++++ assets/js/pages/groups/pages/about.js | 50 ++++++++++++++++++- assets/js/typings/Group.d.ts | 13 ----- .../templates/pages/groups/pages/about.html | 19 +++++-- 6 files changed, 91 insertions(+), 19 deletions(-) diff --git a/assets/css/pages/groups/pages/about.css b/assets/css/pages/groups/pages/about.css index 37a348a8..b61ae50b 100644 --- a/assets/css/pages/groups/pages/about.css +++ b/assets/css/pages/groups/pages/about.css @@ -2,4 +2,8 @@ * About group page * * @author Pierre Hubert - */ \ No newline at end of file + */ + +.about-group-page { + +} \ No newline at end of file diff --git a/assets/css/pages/groups/sections/tabs.css b/assets/css/pages/groups/sections/tabs.css index 06faac30..cb63f004 100644 --- a/assets/css/pages/groups/sections/tabs.css +++ b/assets/css/pages/groups/sections/tabs.css @@ -21,5 +21,5 @@ .group-page.tabs-container .nav-tabs-custom > .nav-tabs > li.active { border-bottom: 3px solid transparent; - border-top: none; + border-top: 3px solid transparent; } diff --git a/assets/js/components/groups/GroupsList.js b/assets/js/components/groups/GroupsList.js index 889912e7..9c2b2e80 100644 --- a/assets/js/components/groups/GroupsList.js +++ b/assets/js/components/groups/GroupsList.js @@ -6,15 +6,35 @@ class Group { constructor(info){ + + /** @type {Number} */ this.id = info.id; + + /** @type {Boolean} */ this.following = info.following; + + /** @type {String} */ this.icon_url = info.icon_url; + + /** @type {"administrator"|"moderator"|"member"|"invited"|"pending"|"visitor"} */ this.membership = info.membership; + + /** @type {String} */ this.name = info.name; + + /** @type {Number} */ this.number_members = info.number_members; + + /** @type {"moderators"|"members"} */ this.posts_level = info.posts_level; + + /** @type {"open"|"moderated"|"closed"} */ this.registration_level = info.registration_level; + + /** @type {String} */ this.virtual_directory = info.virtual_directory; + + /** @type {"open"|"private"|"secrete"} */ this.visibility = info.visibility; } diff --git a/assets/js/pages/groups/pages/about.js b/assets/js/pages/groups/pages/about.js index a9457008..0919f609 100644 --- a/assets/js/pages/groups/pages/about.js +++ b/assets/js/pages/groups/pages/about.js @@ -16,11 +16,59 @@ const GroupAboutPage = { el.innerHTML = tpl; target.appendChild(el); + const props = [ + { + title: tr("Created"), + value: timeDiffToStr(group.time_create), + icon: "fa-clock-o" + }, + + { + title: tr("Members"), + value: tr("%1% members", {"1": group.number_members}), + icon: "fa-users" + }, + + { + title: tr("Who can create posts"), + value: group.posts_level == "members" ? tr("Every members") : tr("Only moderators and administrators"), + icon: "fa-plus" + }, + + { + title: tr("Registration process"), + value: group.registration_level == "closed" ? tr("Only one invitation") : (group.registration_level == "moderated" ? tr("By requesting memberships") : tr("Anyone can join without approval the group")), + icon: "fa-sign-in" + }, + + { + title: tr("Visibility"), + icon: "fa-eye", + value: group.visibility == "secrete" ? tr("Secrete group") : (group.visibility == "open" ? tr("Open group") : tr("Private group")) + } + ]; + + if (group.description && group.description != null && group.description != "" && group.description != "null") + props.unshift({ + title: tr("Description"), + value: group.description, + icon: "fa-sticky-note-o" + }) + + if (group.url && group.url != null && group.url != "" && group.url != "null") + props.unshift({ + title: tr("URL"), + value: group.url, + icon: "fa-link", + url: group.url + }) + Vue.createApp({ data: () => { return { - group: group + group: group, + props: props } }, diff --git a/assets/js/typings/Group.d.ts b/assets/js/typings/Group.d.ts index a248f000..67807e88 100644 --- a/assets/js/typings/Group.d.ts +++ b/assets/js/typings/Group.d.ts @@ -4,19 +4,6 @@ * @author Pierre Hubert */ -declare interface Group { - id: Number, - name: String, - icon_url: String, - number_members: Number, - visibility: "open"|"private"|"secrete", - registration_level: "open"|"moderated"|"closed", - posts_level: "moderators"|"members", - virtual_directory: String, - membership: "administrator"|"moderator"|"member"|"invited"|"pending"|"visitor", - following: Boolean, -} - declare interface AdvancedGroupInfo extends Group { time_create: Number, description: String, diff --git a/assets/templates/pages/groups/pages/about.html b/assets/templates/pages/groups/pages/about.html index 2d6c8101..7293b776 100644 --- a/assets/templates/pages/groups/pages/about.html +++ b/assets/templates/pages/groups/pages/about.html @@ -1,11 +1,24 @@ -
+
-
+

tr("About") {{group.name}}

-
+
+ +
+ +
+
{{prop.title}}
+
{{prop.value}}
+ +
+ + +
+ +
\ No newline at end of file