mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Begin to draw side bar (add user logo)
This commit is contained in:
parent
b436c1aabd
commit
356d70651b
@ -7,7 +7,7 @@
|
|||||||
/**
|
/**
|
||||||
* <a> elements
|
* <a> elements
|
||||||
*/
|
*/
|
||||||
a {
|
a, .cursor-pointer {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#incognito-block {
|
#incognito-block {
|
||||||
|
z-index: 900;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 10px;
|
left: 10px;
|
||||||
bottom: 54px;
|
bottom: 54px;
|
||||||
|
@ -587,6 +587,19 @@ var ComunicWeb = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sidebar
|
||||||
|
*/
|
||||||
|
sideBar: {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main sidebar file
|
||||||
|
*/
|
||||||
|
main: {
|
||||||
|
//TODO : implement
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pages bottom
|
* Pages bottom
|
||||||
*/
|
*/
|
||||||
|
@ -258,6 +258,9 @@ ComunicWeb.common.page = {
|
|||||||
//We load specific components for logged in users
|
//We load specific components for logged in users
|
||||||
if(ComunicWeb.user.userLogin.getUserLoginState()){
|
if(ComunicWeb.user.userLogin.getUserLoginState()){
|
||||||
|
|
||||||
|
// Sidebar
|
||||||
|
ComunicWeb.components.sideBar.main.show();
|
||||||
|
|
||||||
//We load friends list (if user is logged in)
|
//We load friends list (if user is logged in)
|
||||||
ComunicWeb.components.friends.bar.display();
|
ComunicWeb.components.friends.bar.display();
|
||||||
|
|
||||||
|
@ -120,6 +120,18 @@ function getMultipleUsersInfos(usersID, afterGetUserInfos, forceRequest){
|
|||||||
ComunicWeb.user.userInfos.getMultipleUsersInfos(usersID, afterGetUserInfos, forceRequest);
|
ComunicWeb.user.userInfos.getMultipleUsersInfos(usersID, afterGetUserInfos, forceRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get information about a single user
|
||||||
|
*
|
||||||
|
* @param {int} userID User on which to make request
|
||||||
|
* @param {function} afterGetUserInfo What to do once users informations are available
|
||||||
|
* @param {Boolean} forceRequest Force the request to be made
|
||||||
|
* @return {Boolean} True for a success
|
||||||
|
*/
|
||||||
|
function getUserInfo(usersID, afterGetUserInfo, forceRequest){
|
||||||
|
ComunicWeb.user.userInfos.getUserInfos(usersID, afterGetUserInfo, forceRequest);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display message on browser console
|
* Display message on browser console
|
||||||
*
|
*
|
||||||
|
@ -43,6 +43,7 @@ function createElem(nodeType, appendTo){
|
|||||||
* @info {String} innerLang Specify the key of the lang to use to fill the element
|
* @info {String} innerLang Specify the key of the lang to use to fill the element
|
||||||
* @info {String} innerHTMLprefix Specify prefix to add at the begining of the content of the element
|
* @info {String} innerHTMLprefix Specify prefix to add at the begining of the content of the element
|
||||||
* @info {boolean} disabled Set whether the field should be disabled or not (input only)
|
* @info {boolean} disabled Set whether the field should be disabled or not (input only)
|
||||||
|
* @info {HTMLElement[]} children Children for the new object
|
||||||
* @return {HTMLElement} The newly created element
|
* @return {HTMLElement} The newly created element
|
||||||
*/
|
*/
|
||||||
function createElem2(infos){
|
function createElem2(infos){
|
||||||
@ -122,6 +123,12 @@ function createElem2(infos){
|
|||||||
if(infos.disabled)
|
if(infos.disabled)
|
||||||
infos.disabled = true;
|
infos.disabled = true;
|
||||||
|
|
||||||
|
if(infos.children){
|
||||||
|
infos.children.forEach(function(i){
|
||||||
|
newElem.appendChild(i);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//Return newly created element
|
//Return newly created element
|
||||||
return newElem;
|
return newElem;
|
||||||
}
|
}
|
||||||
|
71
assets/js/components/sidebar/main.js
Normal file
71
assets/js/components/sidebar/main.js
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
/**
|
||||||
|
* Sidebar main script file
|
||||||
|
*
|
||||||
|
* @author Pierre HUBERT
|
||||||
|
*/
|
||||||
|
ComunicWeb.components.sideBar.main = {
|
||||||
|
show: function() {
|
||||||
|
|
||||||
|
if(byId("main-sidebar")) return;
|
||||||
|
|
||||||
|
var sideBar = createElem2({
|
||||||
|
appendTo: byId("wrapper"),
|
||||||
|
type: "aside",
|
||||||
|
class: "main-sidebar"
|
||||||
|
});
|
||||||
|
|
||||||
|
var section = createElem2({
|
||||||
|
appendTo: sideBar,
|
||||||
|
type: "section",
|
||||||
|
class: "sidebar"
|
||||||
|
});
|
||||||
|
|
||||||
|
// User panel
|
||||||
|
var userPanel = createElem2({
|
||||||
|
appendTo: section,
|
||||||
|
type: "div",
|
||||||
|
class: "user-panel"
|
||||||
|
});
|
||||||
|
|
||||||
|
getUserInfo(userID(), function(info){
|
||||||
|
if(info.error)
|
||||||
|
return userPanel.innerHTML = "Error!";
|
||||||
|
|
||||||
|
// User account image
|
||||||
|
createElem2({
|
||||||
|
appendTo: userPanel,
|
||||||
|
type: "div",
|
||||||
|
class: "pull-left image cursor-pointer",
|
||||||
|
internalHref: userIDorPath(info),
|
||||||
|
children: [
|
||||||
|
createElem2({
|
||||||
|
type: "img",
|
||||||
|
class: "img-circle",
|
||||||
|
src: info.accountImage
|
||||||
|
})
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
// User name
|
||||||
|
createElem2({
|
||||||
|
appendTo: userPanel,
|
||||||
|
type: "div",
|
||||||
|
class: "pull-left info",
|
||||||
|
children: [
|
||||||
|
createElem2({
|
||||||
|
type: "p",
|
||||||
|
class: "cursor-pointer",
|
||||||
|
innerHTML: userFullName(info),
|
||||||
|
internalHref: userIDorPath(info),
|
||||||
|
}),
|
||||||
|
|
||||||
|
createElem2({
|
||||||
|
type: "a",
|
||||||
|
innerHTML: "Settings",
|
||||||
|
internalHref: "settings",
|
||||||
|
}),
|
||||||
|
]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -353,6 +353,9 @@ class Dev {
|
|||||||
"js/components/menuBar/notAuthenticated.js",
|
"js/components/menuBar/notAuthenticated.js",
|
||||||
"js/components/menuBar/authenticated.js",
|
"js/components/menuBar/authenticated.js",
|
||||||
|
|
||||||
|
// Main side bar
|
||||||
|
"js/components/sidebar/main.js",
|
||||||
|
|
||||||
//Bottom view
|
//Bottom view
|
||||||
"js/components/bottom/links.js",
|
"js/components/bottom/links.js",
|
||||||
"js/components/bottom/main.js",
|
"js/components/bottom/main.js",
|
||||||
|
Loading…
Reference in New Issue
Block a user