From 85c452fd92e7ce9d0fb164ae9e5f8a788ceec0a9 Mon Sep 17 00:00:00 2001 From: Pierre Date: Fri, 5 Jan 2018 11:23:07 +0100 Subject: [PATCH] Work progress on post create form --- assets/css/components/posts/form.css | 21 ++++++++++ assets/js/components/posts/form.js | 57 +++++++++++++++++++++++++++- 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/assets/css/components/posts/form.css b/assets/css/components/posts/form.css index 4d7b4705..25c3e41f 100644 --- a/assets/css/components/posts/form.css +++ b/assets/css/components/posts/form.css @@ -4,6 +4,9 @@ * @author Pierre HUBERT */ +/** + * Message text form + */ .post-form .new-message { width: 100%; min-height: 100px; @@ -14,6 +17,10 @@ margin-bottom: 10px; } + +/** + * Message type chooser + */ .post-form .post-types { text-align: center; } @@ -31,6 +38,20 @@ 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 { display: inline-block; margin-right: 10px; diff --git a/assets/js/components/posts/form.js b/assets/js/components/posts/form.js index 4eb55e41..86024258 100644 --- a/assets/js/components/posts/form.js +++ b/assets/js/components/posts/form.js @@ -75,7 +75,62 @@ ComunicWeb.components.posts.form = { var surveyType = this._add_post_type(postTypesContener, "survey", " "); - //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: "

Not implemented yet.

" + }); + + //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({ appendTo: boxBody, type: "div",