Display posts types

This commit is contained in:
Pierre 2018-01-05 09:11:41 +01:00
parent 135dcd031b
commit dd26f5f1c1
2 changed files with 57 additions and 13 deletions

View File

@ -14,7 +14,19 @@
margin-bottom: 10px; margin-bottom: 10px;
} }
.post-form .post-types .radio { .post-form .post-types {
display: inline-block; text-align: center;
padding-right: 20px; }
.post-form .post-types label {
margin: 5px;
}
.post-form .post-form-choice input {
display: none;
}
.post-form-choice input:checked ~ span {
color: #72afd2;
font-size: 110%;
} }

View File

@ -50,29 +50,29 @@ ComunicWeb.components.posts.form = {
}); });
//Text //Text
var textType = create_radio(postTypesContener, "post_type", "Text"); var textType = this._add_post_type(postTypesContener, "text", "Text");
$(textType).iCheck("check"); textType.checked = true;
//Image //Image
var imageType = create_radio(postTypesContener, "post_type", "Image"); var imageType = this._add_post_type(postTypesContener, "image", "<i class='fa fa-picture-o'></i> <span class='hidden-xs'>Image</span>");
//Youtube //Youtube
var youtubeType = create_radio(postTypesContener, "post_type", "YouTube"); var youtubeType = this._add_post_type(postTypesContener, "youtube", "<i class='fa fa-youtube-play'></i> <span class='hidden-xs'>YouTube</span>");
//Movie //Movie
var movieType = create_radio(postTypesContener, "post_type", "Movie"); var movieType = this._add_post_type(postTypesContener, "movie", "<i class='fa fa-file-movie-o'></i> <span class='hidden-xs'>Movie</span>");
//Link //Link
var linkType = create_radio(postTypesContener, "post_type", "Link"); var linkType = this._add_post_type(postTypesContener, "link", "<i class='fa fa-link'></i> <span class='hidden-xs'>Weblink</span>");
//PDF //PDF
var pdfType = create_radio(postTypesContener, "post_type", "PDF"); var pdfType = this._add_post_type(postTypesContener, "pdf", "<i class='fa fa-file-pdf-o'></i> <span class='hidden-xs'>PDF</span>");
//Countdown timer //Countdown timer
var countdownType = create_radio(postTypesContener, "post_type", "Countdown timer"); var countdownType = this._add_post_type(postTypesContener, "countdown", "<i class='fa fa-clock-o'></i> <span class='hidden-xs'>Timer</span>");
//Survey //Survey
var surveyType = create_radio(postTypesContener, "post_type", "Survey"); var surveyType = this._add_post_type(postTypesContener, "survey", "<i class='fa fa-pie-chart'></i> <span class='hidden-xs'>Survey</span>");
//Add send button //Add send button
var sendButton = createElem2({ var sendButton = createElem2({
@ -81,6 +81,38 @@ ComunicWeb.components.posts.form = {
class: "btn btn-primary pull-right", class: "btn btn-primary pull-right",
innerHTML: "Send" innerHTML: "Send"
}); });
} },
/**
* Create and add post type choice
*
* @param {HTMLElement} target The target for the post type
* @param {string} value The value of the new post type
* @param {string} label The label associated with the post type
* @return {HTMLElement} The created input
*/
_add_post_type: function(target, value, label){
var postTypeContener = createElem2({
appendTo: target,
type: "label",
class: "post-form-choice"
});
var input = createElem2({
appendTo: postTypeContener,
type: "input",
elemType: "radio",
name: "post_type",
value: value
});
createElem2({
appendTo: postTypeContener,
type: "span",
innerHTML: label
});
return input;
}
} }