mirror of
https://github.com/pierre42100/ComunicWeb
synced 2025-06-19 12:25:16 +00:00
Perform a request on the API to check user domain availability.
This commit is contained in:
@ -177,7 +177,7 @@ ComunicWeb.pages.settings.sections.general = {
|
||||
});
|
||||
|
||||
//Personnal website
|
||||
var lastName = createFormGroup({
|
||||
var personnalWebsite = createFormGroup({
|
||||
target: target,
|
||||
label: "Personnal website (optionnal)",
|
||||
type: "text",
|
||||
@ -186,7 +186,7 @@ ComunicWeb.pages.settings.sections.general = {
|
||||
});
|
||||
|
||||
//Virtual directory
|
||||
var lastName = createFormGroup({
|
||||
var virtualDirectory = createFormGroup({
|
||||
target: target,
|
||||
label: "Virtual directory for your user page (" + ComunicWeb.__config.siteURL + "user/{virtual_directory})",
|
||||
type: "text",
|
||||
@ -194,6 +194,33 @@ ComunicWeb.pages.settings.sections.general = {
|
||||
value: infos.virtual_directory != "null" ? infos.virtual_directory : ""
|
||||
});
|
||||
|
||||
//Auto-check the virtual directory when it is updated
|
||||
var checkTarget = createElem2({
|
||||
appendTo: target,
|
||||
type: "small"
|
||||
});
|
||||
|
||||
virtualDirectory.onkeyup = function(){
|
||||
checkTarget.innerHTML = "Checking availability...";
|
||||
|
||||
//Get the directory to check
|
||||
var directory = virtualDirectory.value;
|
||||
|
||||
//Check if the directory is empty
|
||||
if(directory == ""){
|
||||
checkTarget.innerHTML = "";
|
||||
return;
|
||||
}
|
||||
|
||||
//Perform a request on the API
|
||||
ComunicWeb.components.settings.interface.checkUserDirectoryAvailability(directory, function(callback){
|
||||
|
||||
//Check if the directory is available or not
|
||||
checkTarget.innerHTML = callback.error ? "<invalidDirectory>This directory is not available!</invalidDirectory>" : "This directory seems to be available!";
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
//Submit button
|
||||
var sendButton = createElem2({
|
||||
appendTo: target,
|
||||
@ -205,7 +232,7 @@ ComunicWeb.pages.settings.sections.general = {
|
||||
//Make the submit button lives
|
||||
sendButton.onclick = function(){
|
||||
|
||||
|
||||
//Check the given values
|
||||
|
||||
};
|
||||
},
|
||||
|
Reference in New Issue
Block a user