mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 12:09:21 +00:00
Get account image settings from the server
This commit is contained in:
parent
159108b08b
commit
8367a76906
5
assets/css/pages/settings/sections/accountImage.css
Normal file
5
assets/css/pages/settings/sections/accountImage.css
Normal file
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Account image settings section stylesheet
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
@ -99,6 +99,11 @@ var ComunicWeb = {
|
||||
*/
|
||||
createCalloutElem: function(calloutTitle, calloutMessage, calloutType){},
|
||||
|
||||
/**
|
||||
* Create and return a callout element
|
||||
*/
|
||||
createLoadingCallout: function(target){},
|
||||
|
||||
/**
|
||||
* Create and display a confirmation dialog
|
||||
*/
|
||||
@ -1129,6 +1134,13 @@ var ComunicWeb = {
|
||||
password: {
|
||||
//TODO : implement
|
||||
},
|
||||
|
||||
/**
|
||||
* Account image section
|
||||
*/
|
||||
accountImage: {
|
||||
//TODO : implement
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -37,6 +37,24 @@ ComunicWeb.common.messages.createCalloutElem = function(calloutTitle, calloutMes
|
||||
return calloutElem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create loading callout element
|
||||
*
|
||||
* @param {HTMLElement} target Optionnal, the target of the callout element
|
||||
* @return {HTMLElement} Generated loading callout element
|
||||
*/
|
||||
ComunicWeb.common.messages.createLoadingCallout = function(target){
|
||||
|
||||
var elem = this.createCalloutElem("Loading", "Please wait while this page is loading...", "info");
|
||||
|
||||
if(target)
|
||||
target.appendChild(elem);
|
||||
|
||||
return elem;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a confirmation dialog
|
||||
*
|
||||
|
@ -85,4 +85,15 @@ ComunicWeb.components.settings.interface = {
|
||||
};
|
||||
ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Get account image settings from the API
|
||||
*
|
||||
* @param {function} callback
|
||||
*/
|
||||
getAccountImage: function(callback){
|
||||
var apiURI = "settings/get_account_image";
|
||||
var params = {};
|
||||
ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, callback);
|
||||
}
|
||||
}
|
@ -77,6 +77,20 @@ ComunicWeb.pages.settings.navigationPane = {
|
||||
sectionSecurityLink.onclick = function(){
|
||||
openPage("settings/security");
|
||||
};
|
||||
|
||||
//Account image
|
||||
var sectionSecurity = createElem2({
|
||||
appendTo: elemList,
|
||||
type: "li",
|
||||
});
|
||||
var sectionSecurityLink = createElem2({
|
||||
appendTo: sectionSecurity,
|
||||
type: "a",
|
||||
innerHTML: "<i class='fa fa-file-image-o'></i> Account image"
|
||||
});
|
||||
sectionSecurityLink.onclick = function(){
|
||||
openPage("settings/account_image");
|
||||
};
|
||||
}
|
||||
|
||||
}
|
63
assets/js/pages/settings/sections/accountImage.js
Normal file
63
assets/js/pages/settings/sections/accountImage.js
Normal file
@ -0,0 +1,63 @@
|
||||
/**
|
||||
* Account image settings section
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
ComunicWeb.pages.settings.sections.accountImage = {
|
||||
|
||||
/**
|
||||
* Open settings section
|
||||
*
|
||||
* @param {object} args Additionnal arguments
|
||||
* @param {HTMLElement} target The target for the page
|
||||
*/
|
||||
open: function(args, target){
|
||||
|
||||
//Create a box
|
||||
var box = createElem2({
|
||||
appendTo: target,
|
||||
type: "div",
|
||||
class: "box box-primary box-account-image-settings"
|
||||
});
|
||||
|
||||
//Add box header
|
||||
var boxHead = createElem2({
|
||||
appendTo: box,
|
||||
type: "div",
|
||||
class: "box-header",
|
||||
});
|
||||
var boxTitle = createElem2({
|
||||
appendTo: boxHead,
|
||||
type: "h3",
|
||||
class: "box-title",
|
||||
innerHTML: "Account image"
|
||||
});
|
||||
|
||||
//Create box body
|
||||
var boxBody = createElem2({
|
||||
appendTo: box,
|
||||
type: "div",
|
||||
class: "box-body"
|
||||
});
|
||||
|
||||
//Add loading callout
|
||||
var loadMsg = ComunicWeb.common.messages.createLoadingCallout(boxBody);
|
||||
|
||||
//Fetch information about account image on the API
|
||||
ComunicWeb.components.settings.interface.getAccountImage(function(result){
|
||||
|
||||
//Remove loading message
|
||||
loadMsg.remove();
|
||||
|
||||
//Check for errors
|
||||
if(result.error){
|
||||
notify("Could not get account image information !", "danger");
|
||||
return;
|
||||
}
|
||||
|
||||
//Apply account image settings
|
||||
|
||||
});
|
||||
},
|
||||
}
|
@ -42,7 +42,7 @@ ComunicWeb.pages.settings.sections.general = {
|
||||
});
|
||||
|
||||
//Display loading message
|
||||
var loadingMsg = ComunicWeb.common.messages.createCalloutElem("Loading", "Please wait while this page is loading...", "info");
|
||||
var loadingMsg = ComunicWeb.common.messages.createLoadingCallout();
|
||||
boxBody.appendChild(loadingMsg);
|
||||
|
||||
//Load general settings information
|
||||
|
@ -29,4 +29,12 @@ ComunicWeb.pages.settings.sectionsList = {
|
||||
title: "Password",
|
||||
handler: "ComunicWeb.pages.settings.sections.password.open",
|
||||
},
|
||||
|
||||
/**
|
||||
* Account image
|
||||
*/
|
||||
account_image: {
|
||||
title: "Account image",
|
||||
handler: "ComunicWeb.pages.settings.sections.accountImage.open"
|
||||
},
|
||||
}
|
@ -177,6 +177,7 @@ class Dev {
|
||||
"css/pages/settings/sections/general.css",
|
||||
"css/pages/settings/sections/security.css",
|
||||
"css/pages/settings/sections/password.css",
|
||||
"css/pages/settings/sections/accountImage.css",
|
||||
|
||||
//Latest post page stylesheet
|
||||
"css/pages/latestPosts/main.css",
|
||||
@ -345,6 +346,7 @@ class Dev {
|
||||
"js/pages/settings/sections/general.js",
|
||||
"js/pages/settings/sections/security.js",
|
||||
"js/pages/settings/sections/password.js",
|
||||
"js/pages/settings/sections/accountImage.js",
|
||||
|
||||
//Login page
|
||||
"js/pages/login.js",
|
||||
|
Loading…
Reference in New Issue
Block a user