diff --git a/assets/css/components/posts/form.css b/assets/css/components/posts/form.css index 73efd881..07be9ece 100644 --- a/assets/css/components/posts/form.css +++ b/assets/css/components/posts/form.css @@ -12,4 +12,9 @@ border: 1px solid #dddddd; padding: 10px; margin-bottom: 10px; +} + +.post-form .post-types .radio { + display: inline-block; + padding-right: 20px; } \ No newline at end of file diff --git a/assets/js/common/utils.js b/assets/js/common/utils.js index a5ce092b..988ec271 100644 --- a/assets/js/common/utils.js +++ b/assets/js/common/utils.js @@ -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 * diff --git a/assets/js/components/posts/form.js b/assets/js/components/posts/form.js index 12021012..ab6d4318 100644 --- a/assets/js/components/posts/form.js +++ b/assets/js/components/posts/form.js @@ -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({ diff --git a/system/config/dev.config.php b/system/config/dev.config.php index 923cf790..96637a92 100644 --- a/system/config/dev.config.php +++ b/system/config/dev.config.php @@ -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",