Added all post types

This commit is contained in:
Pierre 2018-01-04 19:39:22 +01:00
parent fc568767de
commit 135dcd031b
4 changed files with 94 additions and 0 deletions

View File

@ -13,3 +13,8 @@
padding: 10px;
margin-bottom: 10px;
}
.post-form .post-types .radio {
display: inline-block;
padding-right: 20px;
}

View File

@ -34,6 +34,7 @@ function createElem(nodeType, appendTo){
* @info {String} title The title of the new element
* @info {String} src The src attribute of the new element
* @info {String} href href attribute for the src element
* @info {string} name The name of the new element
* @info {String} elemType The type attribute of the new element
* @info {String} value The value of the new element
* @info {String} placeholder The placeholder of the new element
@ -80,6 +81,10 @@ function createElem2(infos){
if(infos.href)
newElem.href = infos.href;
//Specify the name of the new element
if(infos.name)
newElem.name = infos.name;
//Specify element type
if(infos.elemType)
newElem.type = infos.elemType;
@ -274,6 +279,54 @@ function createFormGroup(infos){
return input;
}
/**
* Create a radio element
*
* @param {HTMLElement} target The target of the radio
* @param {string} name The name of the radio group
* @param {string} label The label of the radio
* @return {HTMLElement} The input element of the radio
*/
function create_radio(target, name, label){
//Contener
var radioDiv = createElem2({
appendTo: target,
type: "div",
class: "radio icheck"
});
//Label
var radioLabel = createElem2({
appendTo: radioDiv,
type: "label"
});
//Input
var radioInput = createElem2({
appendTo: radioLabel,
type: "input",
name: name,
elemType: "radio"
});
//Add label
var labelElem = createElem2({
appendTo: radioLabel,
type: "span",
innerHTML: " "+ label
});
//Enable input
$(radioInput).iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue'
});
return radioInput;
}
/**
* Check if a string is valid and ready to be sent to be saved
*

View File

@ -42,6 +42,37 @@ ComunicWeb.components.posts.form = {
//Enable bootstrap-wysiwyg
$(inputMessageDiv).wysiwyg();
//Add the different post types
var postTypesContener = createElem2({
appendTo: boxBody,
type: "div",
class: "post-types"
});
//Text
var textType = create_radio(postTypesContener, "post_type", "Text");
$(textType).iCheck("check");
//Image
var imageType = create_radio(postTypesContener, "post_type", "Image");
//Youtube
var youtubeType = create_radio(postTypesContener, "post_type", "YouTube");
//Movie
var movieType = create_radio(postTypesContener, "post_type", "Movie");
//Link
var linkType = create_radio(postTypesContener, "post_type", "Link");
//PDF
var pdfType = create_radio(postTypesContener, "post_type", "PDF");
//Countdown timer
var countdownType = create_radio(postTypesContener, "post_type", "Countdown timer");
//Survey
var surveyType = create_radio(postTypesContener, "post_type", "Survey");
//Add send button
var sendButton = createElem2({

View File

@ -30,8 +30,13 @@ class Dev {
"3rdparty/adminLTE/bootstrap/css/bootstrap.min.css",
"3rdparty/adminLTE/plugins/font-awesome/css/font-awesome.min.css",
"3rdparty/adminLTE/plugins/ionicons/css/ionicons.min.css",
//iCheck
"3rdparty/adminLTE/plugins/iCheck/square/blue.css",
"3rdparty/adminLTE/plugins/iCheck/flat/blue.css",
"3rdparty/adminLTE/plugins/iCheck/minimal/blue.css",
"3rdparty/adminLTE/plugins/select2/select2.min.css",
"3rdparty/adminLTE/dist/css/AdminLTE.min.css",
"3rdparty/adminLTE/dist/css/skins/_all-skins.min.css",