mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-04 04:04:20 +00:00 
			
		
		
		
	Display posts types
This commit is contained in:
		@@ -14,7 +14,19 @@
 | 
			
		||||
	margin-bottom: 10px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.post-form .post-types .radio {
 | 
			
		||||
	display: inline-block;
 | 
			
		||||
	padding-right: 20px;
 | 
			
		||||
.post-form .post-types {
 | 
			
		||||
	text-align: center;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.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%;
 | 
			
		||||
}
 | 
			
		||||
@@ -50,29 +50,29 @@ ComunicWeb.components.posts.form = {
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		//Text
 | 
			
		||||
		var textType = create_radio(postTypesContener, "post_type", "Text");
 | 
			
		||||
		$(textType).iCheck("check");
 | 
			
		||||
		var textType = this._add_post_type(postTypesContener, "text", "Text");
 | 
			
		||||
		textType.checked = true;
 | 
			
		||||
 | 
			
		||||
		//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
 | 
			
		||||
		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
 | 
			
		||||
		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
 | 
			
		||||
		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
 | 
			
		||||
		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
 | 
			
		||||
		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
 | 
			
		||||
		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
 | 
			
		||||
		var sendButton = createElem2({
 | 
			
		||||
@@ -81,6 +81,38 @@ ComunicWeb.components.posts.form = {
 | 
			
		||||
			class: "btn btn-primary pull-right",
 | 
			
		||||
			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;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user