mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-04 12:14:12 +00:00 
			
		
		
		
	Add the list of groups of the user
This commit is contained in:
		@@ -34,6 +34,7 @@
 | 
			
		||||
			<li class="bold"><a href="#survey-responses" class="waves-effect waves-teal">Responses to surveys</a></li>
 | 
			
		||||
			<li class="bold"><a href="#all-conversations-message" class="waves-effect waves-teal">Conversations Messages (ALL)</a></li>
 | 
			
		||||
			<li class="bold"><a href="#conversations" class="waves-effect waves-teal">Conversations</a></li>
 | 
			
		||||
			<li class="bold"><a href="#groups" class="waves-effect waves-teal">Groups</a></li>
 | 
			
		||||
		</ul>
 | 
			
		||||
 | 
			
		||||
	</header>
 | 
			
		||||
@@ -202,6 +203,30 @@
 | 
			
		||||
 | 
			
		||||
		</div>
 | 
			
		||||
 | 
			
		||||
		<!-- Groups memberships -->
 | 
			
		||||
		<div id="groups" class="category container">
 | 
			
		||||
			
 | 
			
		||||
			<h1>Your groups membership</h1>
 | 
			
		||||
 | 
			
		||||
			<table id="groups-list-table">
 | 
			
		||||
				<thead>
 | 
			
		||||
					<th>#</th>
 | 
			
		||||
					<th>Icon</th>
 | 
			
		||||
					<th>Name</th>
 | 
			
		||||
					<th>Members count</th>
 | 
			
		||||
					<th>Visibility</th>
 | 
			
		||||
					<th>Registration level</th>
 | 
			
		||||
					<th>Posts creation level</th>
 | 
			
		||||
					<th>Virtual directory</th>
 | 
			
		||||
					<th>Membership</th>
 | 
			
		||||
					<th>Following</th>
 | 
			
		||||
				</thead>
 | 
			
		||||
				<tbody>
 | 
			
		||||
				</tbody>
 | 
			
		||||
			</table>
 | 
			
		||||
 | 
			
		||||
		</div>
 | 
			
		||||
 | 
			
		||||
	</main>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -216,6 +241,7 @@
 | 
			
		||||
	<script	src="assets/js/categories/survey.js"></script>
 | 
			
		||||
	<script src="assets/js/categories/allConversationMessages.js"></script>
 | 
			
		||||
	<script src="assets/js/categories/conversations.js"></script>
 | 
			
		||||
	<script src="assets/js/categories/groups.js"></script>
 | 
			
		||||
	<script src="assets/js/main.js"></script>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -31,6 +31,9 @@ h1 {
 | 
			
		||||
	margin-right: 5px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.group-logo {
 | 
			
		||||
	width: 50px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,49 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Groups membership
 | 
			
		||||
 * 
 | 
			
		||||
 * @author Pierre Hubert
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Apply the list of groups
 | 
			
		||||
 */
 | 
			
		||||
function ApplyGroups() {
 | 
			
		||||
    const target = byId("groups-list-table")
 | 
			
		||||
 | 
			
		||||
    data.groups.forEach(group => {
 | 
			
		||||
 | 
			
		||||
		let groupTR = createElem2({
 | 
			
		||||
			appendTo: target,
 | 
			
		||||
			type: "tr"
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
        const addCell = (content) => createElem2({
 | 
			
		||||
            appendTo: groupTR,
 | 
			
		||||
            type: "td",
 | 
			
		||||
            innerHTML: content,
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
        addCell(group.id)
 | 
			
		||||
 | 
			
		||||
		let groupLogoCell = createElem2({
 | 
			
		||||
			appendTo: groupTR,
 | 
			
		||||
			type: "td"
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		let groupLogo = createElem2({
 | 
			
		||||
			appendTo: groupLogoCell,
 | 
			
		||||
			type: "img",
 | 
			
		||||
            class: "group-logo",
 | 
			
		||||
            src: getFilePathFromURL(group.icon_url)
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
        addCell(group.name)
 | 
			
		||||
		addCell(group.number_members)
 | 
			
		||||
        addCell(group.visibility)
 | 
			
		||||
        addCell(group.registration_level)
 | 
			
		||||
        addCell(group.posts_level)
 | 
			
		||||
        addCell(group.virtual_directory)
 | 
			
		||||
        addCell(group.membership)
 | 
			
		||||
        addCell(group.following ? "Yes" : "No")
 | 
			
		||||
	});
 | 
			
		||||
}
 | 
			
		||||
@@ -81,6 +81,7 @@ xhr.onload = function(){
 | 
			
		||||
	ApplySurveyResponses();
 | 
			
		||||
	ApplyAllConversationMessages();
 | 
			
		||||
	ApplyConversations();
 | 
			
		||||
	ApplyGroups();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
xhr.send(null);
 | 
			
		||||
		Reference in New Issue
	
	Block a user