Work progress on post create form

This commit is contained in:
Pierre 2018-01-05 11:23:07 +01:00
parent 0d40644f6e
commit 85c452fd92
2 changed files with 77 additions and 1 deletions

View File

@ -4,6 +4,9 @@
* @author Pierre HUBERT * @author Pierre HUBERT
*/ */
/**
* Message text form
*/
.post-form .new-message { .post-form .new-message {
width: 100%; width: 100%;
min-height: 100px; min-height: 100px;
@ -14,6 +17,10 @@
margin-bottom: 10px; margin-bottom: 10px;
} }
/**
* Message type chooser
*/
.post-form .post-types { .post-form .post-types {
text-align: center; text-align: center;
} }
@ -31,6 +38,20 @@
font-size: 110%; font-size: 110%;
} }
/**
* Post-types specific
*/
.post-form .post-image,
.post-form .post-youtube,
.post-form .post-movie {
display: none;
}
/**
* Visibility choice
*/
.post-form .post-visiblity-contener { .post-form .post-visiblity-contener {
display: inline-block; display: inline-block;
margin-right: 10px; margin-right: 10px;

View File

@ -75,7 +75,62 @@ ComunicWeb.components.posts.form = {
var surveyType = this._add_post_type(postTypesContener, "survey", "<i class='fa fa-pie-chart'></i> <span class='hidden-xs'>Survey</span>"); var surveyType = this._add_post_type(postTypesContener, "survey", "<i class='fa fa-pie-chart'></i> <span class='hidden-xs'>Survey</span>");
//Add visibility levels //Add image upload form
var imgUploadForm = createElem2({
appendTo: boxBody,
type: "div",
class: "post-image"
});
var imgFileInput = createElem2({
appendTo: imgUploadForm,
type: "input",
elemType: "file"
});
//Add Youtube input form
var youtubeInputForm = createElem2({
appendTo: boxBody,
type: "div",
class: "post-youtube",
});
var youtubeLinkInput = createFormGroup({
target: youtubeInputForm,
label: "Youtube video link",
placeholder: "https://youtube.com/watch?v=",
type: "text"
})
//Add movie input form
var movieInputForm = createElem2({
appendTo: boxBody,
type: "div",
class: "post-movie",
innerHTML: "<p>Not implemented yet.</p>"
});
//Create post type change handler
var changesHandler = function(){
imgUploadForm.style.display = imageType.checked ? "block" : "none";
youtubeInputForm.style.display = youtubeType.checked ? "block" : "none";
movieInputForm.style.display = movieType.checked ? "block" : "none";
};
//Apply changesHandler function to all the data types
textType.onclick = changesHandler;
imageType.onclick = changesHandler;
youtubeType.onclick = changesHandler;
movieType.onclick = changesHandler;
linkType.onclick = changesHandler;
pdfType.onclick = changesHandler;
countdownType.onclick = changesHandler;
surveyType.onclick = changesHandler;
//Right contener
var rightDiv = createElem2({ var rightDiv = createElem2({
appendTo: boxBody, appendTo: boxBody,
type: "div", type: "div",