Added checkbox for following discussion

This commit is contained in:
Pierre 2017-06-05 11:34:43 +02:00
parent be3b685429
commit b7eb77b928
3 changed files with 51 additions and 10 deletions

View File

@ -67,7 +67,8 @@ function checkMail(emailAddress){
*
* @param {HTMLElement} target The target of the field
* @param {String} label The label of the field
* @param {String} placeholder The placeholder of the field
* @param {String} placeholder The placeholder of the field (for checkbox:
* defines if the box has to be checked by default)
* @param {String} type The type of the field
* @return {HTMLElement} The input
*/
@ -78,17 +79,46 @@ function createFormGroup(target, label, placeholder, type){
//Add label
var labelElem = createElem("label", formGroup);
labelElem.innerHTML = label;
//Create input group
var inputGroup = createElem("div", formGroup);
inputGroup.className = "input-group";
//Treatement differs if it is a checkbox
if(type == "checkbox"){
//Create input
var input = createElem("input", inputGroup);
input.type = type;
input.placeholder = placeholder;
//Create checkbox
var input = createElem("input", labelElem) ;
input.type = "checkbox";
//Check if input has to be checked by default
if(placeholder){
if(placeholder === "true"){
input.checked = "true";
}
}
//Add label value
var labelValue = createElem("span", labelElem);
labelValue.innerHTML = " "+label;
//Enable iCheck
$(input).iCheck({
checkboxClass: 'icheckbox_flat-blue',
radioClass: 'iradio_flat-blue'
});
}
else {
//Else continue the function as a normal input type
labelElem.innerHTML = label;
//Create input group
var inputGroup = createElem("div", formGroup);
inputGroup.className = "input-group";
inputGroup.style.width = "100%";
//Create input
var input = createElem("input", inputGroup);
input.className = "form-control";
input.type = type;
input.placeholder = placeholder;
}
//Return input
return input;

View File

@ -69,7 +69,17 @@ ComunicWeb.components.discussions.list = {
var createForm = createElem("div", listBox.boxBody);
//Discussion name
var discussionNameInput = createFormGroup()
var discussionNameInput = createFormGroup(createForm, "Discussion name", "Optionnal", "text");
//Follow disucssion
var followDiscussionInput = createFormGroup(createForm, "Follow discussion", "true", "checkbox");
//Create button
var createButton = createElem("butto", createForm);
createButton.className = "btn btn-primary";
createButton.style.width = "100%";
createButton.innerHTML = "Create discussion";
//Success
return true;

View File

@ -15,6 +15,7 @@ $config['CSSfiles'] = array(
"%PATH_ASSETS%3rdparty/adminLTE/plugins/font-awesome/css/font-awesome.min.css",
"%PATH_ASSETS%3rdparty/adminLTE/plugins/ionicons/css/ionicons.min.css",
"%PATH_ASSETS%3rdparty/adminLTE/plugins/iCheck/square/blue.css",
"%PATH_ASSETS%3rdparty/adminLTE/plugins/iCheck/flat/blue.css",
"%PATH_ASSETS%3rdparty/adminLTE/dist/css/AdminLTE.min.css",
"%PATH_ASSETS%3rdparty/adminLTE/dist/css/skins/_all-skins.min.css",