ComunicWeb/assets/js/pages/groups/sections/header.js

104 lines
2.6 KiB
JavaScript
Raw Normal View History

2018-07-03 09:45:57 +00:00
/**
* Groups header
*
* @author Pierre HUBERT
*/
2021-03-15 17:04:20 +00:00
const GroupSectionHeader = {
2018-07-03 09:45:57 +00:00
/**
* Display groups page header
*
* @param {Object} info Information about the group to display
* @param {HTMLElement} target The target for the header
*/
display: function(info, target){
2021-03-15 17:04:20 +00:00
//Create page row
var pageRow = createElem2({
2018-07-03 09:45:57 +00:00
appendTo: target,
type: "div",
2021-03-15 17:04:20 +00:00
class: "row group-page"
});
//Create header column
var headerColumn = createElem2({
appendTo: pageRow,
type: "div",
class: "col-md-6"
});
//Create header container
const headerContainer = createElem2({
appendTo: headerColumn,
type: "div",
class: "group-header box box-primary"
2018-07-03 09:45:57 +00:00
});
//Create a row
2021-03-15 17:04:20 +00:00
const row = createElem2({
2018-07-03 09:45:57 +00:00
appendTo: headerContainer,
type: "div",
class: "box-body row"
2018-07-03 09:45:57 +00:00
});
//First column
2021-03-15 17:04:20 +00:00
const firstColumn = createElem2({
2018-07-03 09:45:57 +00:00
appendTo: row,
type: "div",
2018-07-07 05:27:55 +00:00
class: "col-md-4 group-col-icon",
2018-07-03 09:45:57 +00:00
});
//Group icon
2021-03-15 17:04:20 +00:00
const groupIcon = createElem2({
2018-07-03 09:45:57 +00:00
appendTo: firstColumn,
type: "img",
src: info.icon_url,
class: "group-icon"
});
//Group name
2021-03-15 17:04:20 +00:00
const groupName = createElem2({
2018-07-03 09:45:57 +00:00
appendTo: firstColumn,
type: "span",
class: "group-name",
innerHTML: info.name
});
2018-07-03 11:06:55 +00:00
2018-07-15 16:37:10 +00:00
//Group tag (if any)
if(info.virtual_directory != "null"){
createElem2({
appendTo: firstColumn,
type: "small",
class: "group-tag",
innerHTML: "@" + info.virtual_directory
});
}
2018-07-07 05:27:55 +00:00
2021-03-15 17:04:20 +00:00
createElem2({
2018-07-03 11:06:55 +00:00
appendTo: row,
type: "div",
2021-03-15 17:04:20 +00:00
class: "spacer"
})
2018-07-07 05:27:55 +00:00
2021-03-15 17:04:20 +00:00
// Second column : basic information about the group
2018-07-07 05:27:55 +00:00
var thirdColumn = createElem2({
appendTo: row,
type: "div",
2021-03-15 17:04:20 +00:00
class: "col-md-7 col-metadata"
});
//Display membership level
2021-03-15 17:04:20 +00:00
ComunicWeb.pages.groups.sections.membershipBlock.display(info, thirdColumn);
2018-07-19 12:34:19 +00:00
//Display follow block
if(signed_in() && ComunicWeb.components.groups.utils.isGroupMember(info))
ComunicWeb.pages.groups.sections.followBlock.display(info, thirdColumn);
2018-07-03 09:45:57 +00:00
},
2021-03-15 17:04:20 +00:00
};
ComunicWeb.pages.groups.sections.header = GroupSectionHeader;