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
|
|
|
|
*
|
2021-04-18 12:51:22 +00:00
|
|
|
* @param {AdvancedGroupInfo} info Information about the group to display
|
2018-07-03 09:45:57 +00:00
|
|
|
* @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",
|
2018-07-16 07:13:51 +00:00
|
|
|
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",
|
2018-07-16 07:13:51 +00:00
|
|
|
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"
|
2018-07-07 05:36:03 +00:00
|
|
|
});
|
|
|
|
|
2021-04-18 12:51:22 +00:00
|
|
|
// Forez group
|
|
|
|
if (info.is_forez_group) {
|
|
|
|
createElem2({
|
|
|
|
appendTo: thirdColumn,
|
|
|
|
type: "div",
|
|
|
|
innerHTML: "<span><i class='fa fa-leaf'></i> Forez Group</span>"
|
|
|
|
})
|
|
|
|
}
|
2018-07-07 05:36:03 +00:00
|
|
|
|
2021-04-18 12:51:22 +00:00
|
|
|
// 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
|
|
|
|
2021-04-18 12:51:22 +00:00
|
|
|
// Display follow block
|
2018-07-19 12:34:19 +00:00
|
|
|
if(signed_in() && ComunicWeb.components.groups.utils.isGroupMember(info))
|
|
|
|
ComunicWeb.pages.groups.sections.followBlock.display(info, thirdColumn);
|
2018-07-05 06:38:52 +00:00
|
|
|
|
2021-04-18 12:51:22 +00:00
|
|
|
// Likes block
|
2021-03-15 18:19:58 +00:00
|
|
|
ComunicWeb.components.like.button.display(
|
|
|
|
"group",
|
|
|
|
info.id,
|
|
|
|
info.number_likes,
|
|
|
|
info.is_liking,
|
|
|
|
createElem2({
|
|
|
|
appendTo: thirdColumn,
|
|
|
|
type: "div"
|
|
|
|
})
|
|
|
|
);
|
2018-07-03 09:45:57 +00:00
|
|
|
},
|
|
|
|
|
2021-03-15 17:04:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
ComunicWeb.pages.groups.sections.header = GroupSectionHeader;
|