From d41551c806038bffaa37c2e0c43c85b8a29ae1aa Mon Sep 17 00:00:00 2001 From: lefuturiste Date: Thu, 30 Jul 2020 12:54:53 +0000 Subject: [PATCH] add countdown and some bug fixes like csv --- assets/development/scripts/countdown.js | 47 +++++++ assets/development/styles/countdown.css | 72 ++++++++++ assets/development/styles/main.css | 2 +- assets/development/styles/organization.css | 64 +++++---- assets/production/scripts/countdown.js | 1 + assets/production/scripts/home.js | 2 +- assets/production/scripts/organization.js | 125 +----------------- assets/production/styles/countdown.css | 1 + assets/production/styles/main.css | 2 +- assets/production/styles/organization.css | 2 +- gulpfile.js | 2 +- src/app.ts | 1 + .../AdminOrganizationController.ts | 8 +- src/controllers/DelegateController.ts | 11 +- src/controllers/PublicController.ts | 4 + src/models/Organization.ts | 9 +- views/countdown.twig | 37 ++++++ views/organization.twig | 78 +++++------ 18 files changed, 263 insertions(+), 205 deletions(-) create mode 100644 assets/development/scripts/countdown.js create mode 100644 assets/development/styles/countdown.css create mode 100644 assets/production/scripts/countdown.js create mode 100644 assets/production/styles/countdown.css create mode 100644 views/countdown.twig diff --git a/assets/development/scripts/countdown.js b/assets/development/scripts/countdown.js new file mode 100644 index 0000000..b5d7d83 --- /dev/null +++ b/assets/development/scripts/countdown.js @@ -0,0 +1,47 @@ +const countdown = document.getElementById('countdown') +const counter = document.getElementById('counter') + +const daysContainer = document.getElementById('days') +const hoursContainer = document.getElementById('hours') +const minutesContainer = document.getElementById('minutes') +const secondsContainer = document.getElementById('seconds') + +let target = new Date("2020-09-04 15:00:00") + +let shown = false + +function render() { + let current = new Date() + let difference = target - current + + var _second = 1000, + _minute = _second * 60, + _hour = _minute * 60, + _day = _hour * 24; + + var days = Math.floor(difference / _day), + hours = Math.floor((difference % _day) / _hour), + minutes = Math.floor((difference % _hour) / _minute), + seconds = Math.floor((difference % _minute) / _second); + + days = (String(days).length >= 2) ? days : '0' + days; + hours = (String(hours).length >= 2) ? hours : '0' + hours; + minutes = (String(minutes).length >= 2) ? minutes : '0' + minutes; + seconds = (String(seconds).length >= 2) ? seconds : '0' + seconds; + + daysContainer.textContent = days + hoursContainer.textContent = hours + minutesContainer.textContent = minutes + secondsContainer.textContent = seconds + + if (!shown) { + setTimeout(() => { + countdown.style.opacity = 1 + shown = true + }, 300) + } +} + + +render() +setInterval(render, 1000) \ No newline at end of file diff --git a/assets/development/styles/countdown.css b/assets/development/styles/countdown.css new file mode 100644 index 0000000..5c485bb --- /dev/null +++ b/assets/development/styles/countdown.css @@ -0,0 +1,72 @@ +.countdown { + width: 100%; + display: flex; + justify-content: center; + align-items: center; + text-align: center; + flex-direction: column; + + opacity: 0; + transition: 0.2s all ease-in-out; +} + +.counter { + display: flex; + align-items: center; +} + +.counter-component { + border: 2px solid #e74c3c; + border-radius: 50%; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + width: 6em; + height: 6em; + margin-right: 1em; + margin-left: 1em; +} + +.counter-component:first-of-type { + margin-left: 0; +} + +.counter-component:last-of-type { + margin-right: 0; +} + +.counter-component span { + font-size: 1.5em; +} + +.label { + font-size: .75em; + color: #34495e; + font-weight: lighter; + margin-top: .5em; +} + +@media (max-width: 600px) { + .counter { + display: grid; + grid-template-columns: 1fr 1fr; + grid-template-rows: 1fr 1fr; + grid-column-gap: 1em; + grid-row-gap: 1em; + margin-bottom: 2em; + } + + .counter-component { + margin-right: 0; + margin-left: 0; + } + + .counter-component:last-of-type { + margin-bottom: 0; + } + + .separator { + display: none; + } +} \ No newline at end of file diff --git a/assets/development/styles/main.css b/assets/development/styles/main.css index 0b62f96..ad711c1 100644 --- a/assets/development/styles/main.css +++ b/assets/development/styles/main.css @@ -43,7 +43,7 @@ body { position: fixed; z-index: 9999999; left: 1em; - bottom: 2em; + bottom: 1em; padding: 1em; font-weight: bold; border-radius: 3px; diff --git a/assets/development/styles/organization.css b/assets/development/styles/organization.css index b99e60e..7a7272d 100644 --- a/assets/development/styles/organization.css +++ b/assets/development/styles/organization.css @@ -29,7 +29,7 @@ .return-icon { display: flex; align-items: center; - margin-right: .5em; + margin-right: .75em; } .return-icon svg { @@ -47,25 +47,34 @@ ********************************************************************************/ -.cover-background { - background-position: center; - background-size: cover; - height: 13em; - width: 100%; +.cover-container { + position: relative; } -.cover { - height: 13em; - margin-top: -13em; - background-color: rgba(230, 126, 34, 0.4); +.cover-background { + z-index: -1; + position: absolute; + top: 0; + left: 0; + + background-position: center; background-size: cover; + width: 100%; + height: 100%; } .cover-content { + background-color: rgba(230, 126, 34, 0.75); + background-size: cover; + color: white; + padding-top: 1.5em; + padding-bottom: 1.5em; +} + +.cover-content .container { display: flex; align-items: center; - height: 13em; } .cover-image { @@ -76,16 +85,14 @@ background-position: center; width: 10em; height: 10em; + min-width: 10em; + min-height: 10em; margin-right: 3em; } -.cover-title-container { - -} - .cover-title { font-family: 'Roboto Slab', serif; - font-size: 3.5em; + font-size: 3em; font-weight: normal; margin: 0; } @@ -497,6 +504,14 @@ section { margin-bottom: 1em; } +.contact-item.address .contact-content div { + margin-bottom: .25em; +} + +.contact-item.address .contact-content div:last-child { + margin-bottom: 0; +} + .contact-icon { color: #B15808; background-color: #C4C4C4; @@ -573,6 +588,7 @@ People cards .people-card { width: 100%; + max-width: 50%; margin-right: 1em; border-radius: 3px; padding: 1.2em 1.5em; @@ -674,20 +690,8 @@ RESPONSIVE @media (max-width: 900px) { - - .cover-background { - height: 23em; - width: 100%; - } - .cover { - height: 23em; - margin-top: -23em; - } - - .cover-content { - height: 23em; - + .cover-content .container { flex-direction: column; justify-content: center; text-align: center; @@ -699,6 +703,7 @@ RESPONSIVE } .cover-title { + font-size: 2.5em; margin-bottom: .25em; } @@ -804,6 +809,7 @@ RESPONSIVE } .people-card { + max-width: 100%; width: auto; text-align: center; margin-bottom: 1em; diff --git a/assets/production/scripts/countdown.js b/assets/production/scripts/countdown.js new file mode 100644 index 0000000..7d71734 --- /dev/null +++ b/assets/production/scripts/countdown.js @@ -0,0 +1 @@ +const countdown=document.getElementById("countdown"),counter=document.getElementById("counter"),daysContainer=document.getElementById("days"),hoursContainer=document.getElementById("hours"),minutesContainer=document.getElementById("minutes"),secondsContainer=document.getElementById("seconds");let target=new Date("2020-09-04 15:00:00"),shown=!1;function render(){let e=new Date,t=target-e;var n=Math.floor(t/864e5),o=Math.floor(t%864e5/36e5),r=Math.floor(t%36e5/6e4),d=Math.floor(t%6e4/1e3);n=String(n).length>=2?n:"0"+n,o=String(o).length>=2?o:"0"+o,r=String(r).length>=2?r:"0"+r,d=String(d).length>=2?d:"0"+d,daysContainer.textContent=n,hoursContainer.textContent=o,minutesContainer.textContent=r,secondsContainer.textContent=d,shown||setTimeout(()=>{countdown.style.opacity=1,shown=!0},300)}render(),setInterval(render,1e3); \ No newline at end of file diff --git a/assets/production/scripts/home.js b/assets/production/scripts/home.js index 9c072d8..e707f98 100644 --- a/assets/production/scripts/home.js +++ b/assets/production/scripts/home.js @@ -1 +1 @@ -let navOpened=!1,oldNavText="",oldNavIcon="",navEnabler=document.getElementById("nav-enabler"),navEnablerText=document.getElementById("nav-enabler-text"),navEnablerIcon=document.getElementById("nav-enabler-icon"),navContent=document.getElementById("nav-content"),mosaic=document.getElementById("mosaic"),mosaicHeader=document.getElementById("mosaic-header"),tags=[];function createEl(e=!1,n="div"){let t=document.createElement(n);return 0!=e&&(t.className=e),t}function renderNavItem(e){let n=createEl("nav-item"),t=createEl("nav-icon"),a=createEl(e.icon,"i");t.appendChild(a),n.appendChild(t);let r=createEl("nav-item-content"),l=createEl("nav-title");l.textContent=e.name,r.appendChild(l);let o=createEl("nav-access"),i=createEl("fas fa-chevron-right","i");return o.appendChild(i),r.appendChild(l),r.appendChild(o),n.appendChild(r),n}function setAttributes(e,n){for(var t in n)attr=document.createAttribute(t),attr.value=n[t],e.attributes.setNamedItem(attr)}function renderCard(e){let n=createEl("card","a"),t=createEl("card-image-container"),a=createEl("card-image");a.style=`background-image: url('${e.thumbnail}')`,t.appendChild(a),n.appendChild(t);let r=createEl("card-content"),l=createEl(),o=createEl("card-title-container"),i=createEl("card-title","h2");i.textContent=e.name,o.appendChild(i);let c=createEl("card-icon");if(Array.isArray(e.tags)&&e.tags.length>0){let n=tags.filter(n=>e.tags[0]===n._id)[0];c.innerHTML=n.iconHTML}o.appendChild(c),l.appendChild(o);let d=createEl("card-description");d.textContent=e.description;let s="/association/"+e.slug;return isProposed&&(s+="?version=proposed"),l.appendChild(d),r.appendChild(l),n.appendChild(r),n.href=s,n}navEnabler.onclick=async()=>{navOpened?(navEnablerText.textContent=oldNavText,navEnablerIcon.style.transform="rotate(0deg)",navContent.style.maxHeight=null):(oldNavText=navEnablerText.textContent,navEnablerText.textContent="Minimiser le menu",navEnablerIcon.style.transform="rotate(90eg)",navContent.style.maxHeight=navContent.scrollHeight+"px"),navOpened=!navOpened};let currentTag=null,currentCardContainer=null;function enableTag(e){let n="nav-all"===e.id,t="";n||(t=e.attributes["data-tag-id"].value);let a=organizations.filter(e=>e.tags.filter(e=>e===t).length>0||n);renderMosaic(a),e.className+=" enabled",null!==currentTag&&(currentTag.className=currentTag.className.replace("enabled","")),currentTag=e,null==a||a.length<=0?mosaicHeader.textContent="Aucune associations listées":1===a.length?mosaicHeader.textContent="Une association listée":mosaicHeader.textContent=a.length+" associations listées"}function posY(e){for(var n=e,t=0;n&&"body"!==n.tagName.toLowerCase();)t+=n.offsetTop,n=n.offsetParent;return t}function viewPortHeight(){var e=document.documentElement;return window.innerWidth?window.innerHeight:e&&!isNaN(e.clientHeight)?e.clientHeight:0}function scrollY(){return window.pageYOffset?window.pageYOffset:Math.max(document.documentElement.scrollTop,document.body.scrollTop)}function isVisible(e){var n=viewPortHeight(),t=scrollY();return!(posY(e)>n+t)}let rendering=!0,page=0,elementsPerPage=5,focusPoint=null,focusElementPos=2,cardContainer=null,currentOrganizations=[],pageCount=0;function renderPage(){rendering=!0;let e=currentOrganizations.slice(page*elementsPerPage,(page+1)*elementsPerPage);e.forEach((n,t)=>{let a=renderCard(n);cardContainer.appendChild(a),t===e.length-focusElementPos&&(focusPoint=a)}),rendering=!1}function renderMosaic(e){cardContainer=createEl("card-container"),currentOrganizations=e,pageCount=Math.floor(e.length/elementsPerPage),renderPage(),null!==currentCardContainer&&mosaic.removeChild(currentCardContainer),currentCardContainer=cardContainer,mosaic.appendChild(cardContainer)}window.onscroll=()=>{null!=focusPoint&&isVisible(focusPoint)&&!rendering&&page+1{document.querySelectorAll("#nav-content .nav-item").forEach(e=>{e.onclick=()=>enableTag(e),"nav-all"!==e.id&&tags.push({_id:e.attributes["data-tag-id"].value,iconHTML:e.querySelector(".nav-icon").innerHTML})}),enableTag(document.getElementById("nav-all"))}); \ No newline at end of file +let navOpened=!1,oldNavText="",oldNavIcon="",navEnabler=document.getElementById("nav-enabler"),navEnablerText=document.getElementById("nav-enabler-text"),navEnablerIcon=document.getElementById("nav-enabler-icon"),navContent=document.getElementById("nav-content"),mosaic=document.getElementById("mosaic"),mosaicHeader=document.getElementById("mosaic-header"),tags=[];function createEl(e=!1,n="div"){let t=document.createElement(n);return 0!=e&&(t.className=e),t}function renderNavItem(e){let n=createEl("nav-item"),t=createEl("nav-icon"),a=createEl(e.icon,"i");t.appendChild(a),n.appendChild(t);let r=createEl("nav-item-content"),l=createEl("nav-title");l.textContent=e.name,r.appendChild(l);let i=createEl("nav-access"),o=createEl("fas fa-chevron-right","i");return i.appendChild(o),r.appendChild(l),r.appendChild(i),n.appendChild(r),n}function setAttributes(e,n){for(var t in n)attr=document.createAttribute(t),attr.value=n[t],e.attributes.setNamedItem(attr)}function renderCard(e){let n=createEl("card","a"),t=createEl("card-image-container"),a=createEl("card-image");a.style=`background-image: url('${mediaBaseUrl+"/"+e.thumbnail}')`,t.appendChild(a),n.appendChild(t);let r=createEl("card-content"),l=createEl(),i=createEl("card-title-container"),o=createEl("card-title","h2");o.textContent=e.name,i.appendChild(o);let c=createEl("card-icon");if(Array.isArray(e.tags)&&e.tags.length>0){let n=tags.filter(n=>e.tags[0]===n._id)[0];c.innerHTML=n.iconHTML}i.appendChild(c),l.appendChild(i);let d=createEl("card-description");d.textContent=e.description;let s="/association/"+e.slug;return isProposed&&(s+="?version=proposed"),l.appendChild(d),r.appendChild(l),n.appendChild(r),n.href=s,n}navEnabler.onclick=async()=>{navOpened?(navEnablerText.textContent=oldNavText,navEnablerIcon.style.transform="rotate(0deg)",navContent.style.maxHeight=null):(oldNavText=navEnablerText.textContent,navEnablerText.textContent="Minimiser le menu",navEnablerIcon.style.transform="rotate(90eg)",navContent.style.maxHeight=navContent.scrollHeight+"px"),navOpened=!navOpened};let currentTag=null,currentCardContainer=null;function enableTag(e){let n="nav-all"===e.id,t="";n||(t=e.attributes["data-tag-id"].value);let a=organizations.filter(e=>e.tags.filter(e=>e===t).length>0||n);renderMosaic(a),e.className+=" enabled",null!==currentTag&&(currentTag.className=currentTag.className.replace("enabled","")),currentTag=e,null==a||a.length<=0?mosaicHeader.textContent="Aucune associations listées":1===a.length?mosaicHeader.textContent="Une association listée":mosaicHeader.textContent=a.length+" associations listées"}function posY(e){for(var n=e,t=0;n&&"body"!==n.tagName.toLowerCase();)t+=n.offsetTop,n=n.offsetParent;return t}function viewPortHeight(){var e=document.documentElement;return window.innerWidth?window.innerHeight:e&&!isNaN(e.clientHeight)?e.clientHeight:0}function scrollY(){return window.pageYOffset?window.pageYOffset:Math.max(document.documentElement.scrollTop,document.body.scrollTop)}function isVisible(e){var n=viewPortHeight(),t=scrollY();return!(posY(e)>n+t)}let rendering=!0,page=0,elementsPerPage=5,focusPoint=null,focusElementPos=2,cardContainer=null,currentOrganizations=[],pageCount=0;function renderPage(){rendering=!0;let e=currentOrganizations.slice(page*elementsPerPage,(page+1)*elementsPerPage);e.forEach((n,t)=>{let a=renderCard(n);cardContainer.appendChild(a),t===e.length-focusElementPos&&(focusPoint=a)}),rendering=!1}function renderMosaic(e){cardContainer=createEl("card-container"),currentOrganizations=e,pageCount=Math.floor(e.length/elementsPerPage),renderPage(),null!==currentCardContainer&&mosaic.removeChild(currentCardContainer),currentCardContainer=cardContainer,mosaic.appendChild(cardContainer)}window.onscroll=()=>{null!=focusPoint&&isVisible(focusPoint)&&!rendering&&page+1{document.querySelectorAll("#nav-content .nav-item").forEach(e=>{e.onclick=()=>enableTag(e),"nav-all"!==e.id&&tags.push({_id:e.attributes["data-tag-id"].value,iconHTML:e.querySelector(".nav-icon").innerHTML})}),enableTag(document.getElementById("nav-all"))}); \ No newline at end of file diff --git a/assets/production/scripts/organization.js b/assets/production/scripts/organization.js index 4ce721d..d781d27 100644 --- a/assets/production/scripts/organization.js +++ b/assets/production/scripts/organization.js @@ -1,124 +1 @@ -/** - * Schedule collapsable section animation - */ -document.querySelectorAll('.schedule-category').forEach(node => { - let opened = false - let icon = node.querySelector('.schedule-category-collapse-icon') - let content = node.querySelector('.schedule-category-table') - let header = node.querySelector('.schedule-category-header') - header.onclick = () => { - if (!opened) { - // open the table - icon.style.transform = "rotate(0deg)" - content.style.maxHeight = content.scrollHeight + "px" - } else { - // close the table - icon.style.transform = "rotate(180deg)" - content.style.maxHeight = null - } - opened = !opened - } -}) - -/** - * Description - */ -let description = document.querySelector('.description-cutted') -let descriptionActions = document.querySelector('.description-actions-container') -let descriptionOpened = false -let defaultMaxHeight = "" -if (description !== null) { - let btn = document.querySelector('.description-btn') - btn.onclick = () => { - if (!descriptionOpened) { - // open the full description - descriptionActions.className = descriptionActions.className.replace(' closed', '') - defaultMaxHeight = description.style.maxHeight - description.style.maxHeight = description.scrollHeight + "px" - btn.textContent = "Fermer la description" - } else { - // initial max Height - descriptionActions.className += ' closed' - description.style.maxHeight = defaultMaxHeight - btn.textContent = "Ouvrir la description" - } - descriptionOpened = !descriptionOpened - } -} - -/** - * Gallery modal to view media in large - */ -let mediaModal = document.querySelector('#media-modal') -let mediaModalContent = document.querySelector('#media-modal-content') -// let mediaModalImage = document.querySelector('#media-modal img') -// let mediaModalVideo = document.querySelector('#media-modal video') -// let mediaModalSource = document.querySelector('#media-modal video source') - -// function disableScroll() { -// // Get the current page scroll position -// scrollTop = window.pageYOffset || document.documentElement.scrollTop; -// scrollLeft = window.pageXOffset || document.documentElement.scrollLeft, - -// // if any scroll is attempted, set this to the previous value -// window.onscroll = function() { -// window.scrollTo(scrollLeft, scrollTop); -// }; -// } - -// function enableScroll() { -// window.onscroll = function() {}; -// } - - -let openModal = (url, isVideo) => { - mediaModal.style.visibility = 'visible' - mediaModal.style.opacity = 1 - mediaModalContent.innerHTML = "" - - let attr = document.createAttribute('src') - attr.value = url - let el = null - if (isVideo) { - el = document.createElement('video') - el.setAttribute('controls', '') - el.setAttribute('autoplay', '') - el.setAttribute('name', 'media') - let source = document.createElement('source') - source.setAttribute('src', url) - source.setAttribute('type', 'video/mp4') - el.appendChild(source) - } else { - el = document.createElement('img') - el.attributes.setNamedItem(attr) - } - mediaModalContent.appendChild(el) - //document.body.style.height = '100vh' - document.body.style.overflow = 'hidden' - document.body.style.touchAction = 'none' - - setTimeout(() => { - - const outsideClickListener = event => { - if (!mediaModalContent.contains(event.target) && isVisible(mediaModalContent)) { - closeModal() - document.removeEventListener('click', outsideClickListener) - } - } - document.addEventListener('click', outsideClickListener) - - }, 100) -} - -const isVisible = elem => !!elem && !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ) - -let closeModal = () => { - mediaModal.style.visibility = 'hidden' - mediaModal.style.opacity = 0 - document.body.style.overflow = 'initial' - document.body.style.height = 'initial' - let video = document.querySelector('#media-modal video') - if (video !== null) { - video.pause() - } -} +document.querySelectorAll(".schedule-category").forEach(e=>{let t=!1,i=e.querySelector(".schedule-category-collapse-icon"),o=e.querySelector(".schedule-category-table");e.querySelector(".schedule-category-header").onclick=()=>{t?(i.style.transform="rotate(180deg)",o.style.maxHeight=null):(i.style.transform="rotate(0deg)",o.style.maxHeight=o.scrollHeight+"px"),t=!t}});let description=document.querySelector(".description-cutted"),descriptionActions=document.querySelector(".description-actions-container"),descriptionOpened=!1,defaultMaxHeight="";if(null!==description){let e=document.querySelector(".description-btn");e.onclick=()=>{descriptionOpened?(descriptionActions.className+=" closed",description.style.maxHeight=defaultMaxHeight,e.textContent="Ouvrir la description"):(descriptionActions.className=descriptionActions.className.replace(" closed",""),defaultMaxHeight=description.style.maxHeight,description.style.maxHeight=description.scrollHeight+"px",e.textContent="Fermer la description"),descriptionOpened=!descriptionOpened}}let mediaModal=document.querySelector("#media-modal"),mediaModalContent=document.querySelector("#media-modal-content"),openModal=(e,t)=>{mediaModal.style.visibility="visible",mediaModal.style.opacity=1,mediaModalContent.innerHTML="";let i=document.createAttribute("src");i.value=e;let o=null;if(t){o=document.createElement("video"),o.setAttribute("controls",""),o.setAttribute("autoplay",""),o.setAttribute("name","media");let t=document.createElement("source");t.setAttribute("src",e),t.setAttribute("type","video/mp4"),o.appendChild(t)}else o=document.createElement("img"),o.attributes.setNamedItem(i);mediaModalContent.appendChild(o),document.body.style.overflow="hidden",document.body.style.touchAction="none",setTimeout(()=>{const e=t=>{!mediaModalContent.contains(t.target)&&isVisible(mediaModalContent)&&(closeModal(),document.removeEventListener("click",e))};document.addEventListener("click",e)},100)};const isVisible=e=>!!e&&!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length);let closeModal=()=>{mediaModal.style.visibility="hidden",mediaModal.style.opacity=0,document.body.style.overflow="initial",document.body.style.height="initial";let e=document.querySelector("#media-modal video");null!==e&&e.pause()}; \ No newline at end of file diff --git a/assets/production/styles/countdown.css b/assets/production/styles/countdown.css new file mode 100644 index 0000000..993789f --- /dev/null +++ b/assets/production/styles/countdown.css @@ -0,0 +1 @@ +.countdown{width:100%;display:flex;justify-content:center;align-items:center;text-align:center;flex-direction:column;opacity:0;transition:.2s all ease-in-out}.counter{display:flex;align-items:center}.counter-component{border:2px solid #e74c3c;border-radius:50%;display:flex;justify-content:center;align-items:center;flex-direction:column;width:6em;height:6em;margin-right:1em;margin-left:1em}.counter-component:first-of-type{margin-left:0}.counter-component:last-of-type{margin-right:0}.counter-component span{font-size:1.5em}.label{font-size:.75em;color:#34495e;font-weight:lighter;margin-top:.5em}@media (max-width:600px){.counter{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;grid-column-gap:1em;grid-row-gap:1em;margin-bottom:2em}.counter-component{margin-right:0;margin-left:0}.counter-component:last-of-type{margin-bottom:0}.separator{display:none}} \ No newline at end of file diff --git a/assets/production/styles/main.css b/assets/production/styles/main.css index e9df87f..f434ff6 100644 --- a/assets/production/styles/main.css +++ b/assets/production/styles/main.css @@ -1 +1 @@ -html{overflow-y:scroll}body{font-family:Roboto,sans-serif;margin:0}.container{width:60%;margin:0 auto}a{color:#3498db}a:hover{text-decoration:underline;transition:color .2s;color:#2980b9}body,html{height:100%}body{display:flex;flex-direction:column}.up-footer{flex:1 0 auto}.sticky-footer{flex-shrink:0}.proposed-alert{position:fixed;z-index:9999999;left:1em;bottom:2em;padding:1em;font-weight:700;border-radius:3px;text-transform:uppercase;border:1px solid #c0392b;background-color:#e74c3c;color:#fff}.btn{padding:.5em 1em;color:#fff;border-radius:7px;background:#2c3e50;border:0;cursor:pointer}.btn:focus{outline:0;opacity:.8}@media (max-width:1600px){.container{width:70%}}@media (max-width:1500px){.container{width:80%}}@media (max-width:900px){.container{width:92%}} \ No newline at end of file +html{overflow-y:scroll}body{font-family:Roboto,sans-serif;margin:0}.container{width:60%;margin:0 auto}a{color:#3498db}a:hover{text-decoration:underline;transition:color .2s;color:#2980b9}body,html{height:100%}body{display:flex;flex-direction:column}.up-footer{flex:1 0 auto}.sticky-footer{flex-shrink:0}.proposed-alert{position:fixed;z-index:9999999;left:1em;bottom:1em;padding:1em;font-weight:700;border-radius:3px;text-transform:uppercase;border:1px solid #c0392b;background-color:#e74c3c;color:#fff}.btn{padding:.5em 1em;color:#fff;border-radius:7px;background:#2c3e50;border:0;cursor:pointer}.btn:focus{outline:0;opacity:.8}@media (max-width:1600px){.container{width:70%}}@media (max-width:1500px){.container{width:80%}}@media (max-width:900px){.container{width:92%}} \ No newline at end of file diff --git a/assets/production/styles/organization.css b/assets/production/styles/organization.css index fc3230a..8e19d5c 100644 --- a/assets/production/styles/organization.css +++ b/assets/production/styles/organization.css @@ -1 +1 @@ -.header-container{display:flex;justify-content:space-between;align-items:center;padding-top:1em;padding-bottom:1em;font-size:1.2em}.header-title{text-align:right}.return{display:flex;align-items:center;color:#34495e;cursor:pointer;transition:all .2s;text-decoration:none}.return-icon{display:flex;align-items:center;margin-right:.5em}.return-icon svg{width:1.3em}.return:hover{opacity:.88;text-decoration:underline}.cover-background{background-position:center;background-size:cover;height:13em;width:100%}.cover{height:13em;margin-top:-13em;background-color:rgba(230,126,34,.4);background-size:cover}.cover-content{color:#fff;display:flex;align-items:center;height:13em}.cover-image{background:#fff;border-radius:50%;border:3px solid #fd6e0b;background-size:cover;background-position:center;width:10em;height:10em;margin-right:3em}.cover-title{font-family:'Roboto Slab',serif;font-size:3.5em;font-weight:400;margin:0}.cover-sub-title{font-size:1.5em;font-weight:400;margin:0}.media-mosaic{margin-top:.75em;width:100%;height:25em;display:grid;grid-column-gap:.75em;grid-row-gap:.75em}.media-overlay{background-color:rgba(196,196,196,.7);color:#b12008;display:flex;justify-content:center;align-items:center;position:absolute;left:0;top:0;width:100%;height:100%}.media-container{position:relative}.media-overlay svg{width:3.5em;cursor:pointer;transition:all .2s}.media-overlay svg:hover{transform:scale(1.2)}.mosaic-1{display:flex;justify-content:center}.mosaic-1 .media-container{width:70%}.mosaic-2{grid-template-columns:1fr 1fr;grid-template-rows:1fr}.mosaic-3{grid-template-columns:1fr .5fr;grid-template-rows:1fr 1fr}.mosaic-3 .media-container:first-of-type{grid-row:1/span 2}.mosaic-4{grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr}.mosaic-5{grid-template-columns:1fr .5fr .5fr;grid-template-rows:1fr 1fr}.mosaic-5 .media-container:first-of-type{grid-row:1/span 2}.media{cursor:zoom-in;height:100%;border-radius:4px;background-size:cover;background-position:center}.media-modal-container{position:fixed;width:100%;height:100vh;z-index:99;top:0;left:0;background-color:rgba(0,0,0,.8);display:flex;justify-content:center;align-items:center;visibility:hidden;opacity:0;transition:visibility .1s linear,opacity .1s linear}.media-modal{position:relative;width:50%}.media-modal .media-modal-content{border-radius:4px;width:100%}.media-modal img,.media-modal video{width:100%}.media-close{position:absolute;width:1.5em;height:1.5em;right:-.75em;top:-.75em;color:#fff;cursor:pointer;opacity:.7;transition:all .2s}.media-close:hover{transform:scale(1.2);opacity:1}section{margin-top:1.2em;margin-bottom:0}.section-title{margin-top:1em;margin-bottom:1em}.section-title h1,.section-title h2,.section-title h3{margin:0;font-weight:400;font-family:'Roboto Slab',serif;font-size:1.8em}.section-divider{background-color:rgba(194,129,0,.5);width:100%;height:3px;border-radius:1px}.description{line-height:1.5em;text-align:justify;margin:0 auto;width:80%;margin-top:1em;margin-bottom:.5em}.description p{margin-top:.75em}.description p:last-child{margin-bottom:0}.description h3{font-size:1.4em;margin-top:1em;margin-bottom:0}.description h4{font-size:1.2em;margin-top:1em;margin-bottom:0}.description h3,.description h4{opacity:.8}.description blockquote{border-left:3px solid #95a5a6;border-radius:3px}.description blockquote p{padding-top:1em;padding-bottom:1em;padding-left:1em}.description-cutted{max-height:13em;overflow:hidden;transition:max-height .1s ease-out}.description-actions-container{display:flex;justify-content:center;align-items:center;margin-top:1em}.description-actions-container.closed{box-shadow:0 -16px 16px -3px #fff;background:rgba(255,255,255,.8);position:relative;top:-62px;height:62px;margin-bottom:-62px}.schedule-category{margin-bottom:1em}.schedule-category-header{background-color:rgba(189,195,199,.97);border-radius:4px;display:flex;justify-content:space-between;align-items:center;padding:1em 2em 1em 2em;cursor:pointer}.schedule-category-collapse-icon{transform:rotate(180deg);color:#b12008;width:1.5em;transition:all .1s ease-out}.schedule-category-table{max-height:0;overflow:hidden;transition:max-height .1s ease-out}.schedule-category-days-container{border-radius:4px;background-color:#ecf0f1;margin-left:2em;margin-top:1em;margin-bottom:1em;margin-right:20em;padding:1em 2em 1em 2em}.schedule-category-day-container{display:flex;justify-content:space-between;margin-bottom:1em}.schedule-category-day-container .separator{opacity:.5}.schedule-category-table div:last-child{margin-bottom:0}.schedule-category-hours{color:#2c3e50}.schedule-category-hours .spearator{color:#bdc3c7}.pricing{display:flex;justify-content:center}.pricing-card{max-width:14em;height:10em;width:100%;padding:1.5em 1em;text-align:center;border-radius:4px;display:flex;flex-direction:column;justify-content:space-between;margin-right:1.5em;color:#fff}.pricing .pricing-card:nth-child(1){background-color:rgba(177,88,8,.8)}.pricing .pricing-card:nth-child(2){background-color:rgba(253,110,11,.78)}.pricing .pricing-card:nth-child(3){background-color:rgba(177,32,8,.8)}.pricing .pricing-card:last-child{margin-right:0}.pricing-label{font-size:1.5em}.pricing-name{font-size:1.8em}.org-container{margin:0 auto;width:70%}.contact-item{display:flex;justify-content:space-between;align-items:center;padding-top:.75em;padding-bottom:.75em;padding-left:2em;padding-right:2em;background-color:#ecf0f1;border-radius:4px;margin-bottom:1em}.contact-icon{color:#b15808;background-color:#c4c4c4;border-radius:50%;width:2em;height:2em;display:flex;justify-content:center;align-items:center;font-size:1.5em}.contact-icon svg{width:.7em}.contact-content{text-align:right}.external-link{margin-left:.25em;font-weight:700}.external-link{width:.8em}.email .contact-icon svg{width:.9em}.website .contact-icon svg{width:.9em}.facebook .contact-icon{background-color:#3b5999;color:#fff}.facebook .contact-icon svg{width:.5em}.instagram .contact-icon{background:linear-gradient(45deg,#405de6,#5851db,#833ab4,#c13584,#e1306c,#fd1d1d);color:#fff}.instagram .contact-icon svg{width:.75em}.twitter .contact-icon{background-color:#1da1f2;color:#fff}.twitter .contact-icon svg{width:.75em}.peoples{width:100%;display:flex;justify-content:center;margin-bottom:1em}.people-card{width:100%;margin-right:1em;border-radius:3px;padding:1.2em 1.5em;border:1px solid gray}.people-card:last-of-type{margin-right:0}.people-name{font-size:1.4em;margin-bottom:.5em}.people-contacts{margin-top:.5em}.people-contact{padding-top:.5em;padding-bottom:.5em;display:flex;align-items:center}.people-role{opacity:.8}.people-contact-icon{width:1em;height:1em;margin-right:1em;color:#b15808}.mentions{display:flex;justify-content:center;padding-left:1em;padding-right:1em;flex-direction:column;text-align:center;color:#d35400;margin-top:1em;margin-bottom:1em}.mentions div{margin-bottom:.5em}.footer{width:100%;display:grid;grid-template-columns:50% 25% 25%;grid-template-rows:1fr;height:1em}.footer div:nth-child(1){background-color:rgb(177,32,8,.83)}.footer div:nth-child(2){background-color:rgb(177,88,8,.83)}.footer div:nth-child(3){background-color:rgb(253,110,11,.83)}@media (max-width:1200px){.schedule-category-days-container{margin-right:25em}.media-modal{width:70%}}@media (max-width:900px){.cover-background{height:23em;width:100%}.cover{height:23em;margin-top:-23em}.cover-content{height:23em;flex-direction:column;justify-content:center;text-align:center}.cover-image{margin-right:0;margin-bottom:3em}.cover-title{margin-bottom:.25em}.media-mosaic{height:33em}.mosaic-1 .media-container{width:100%}.mosaic-2{grid-template-rows:1fr 1fr}.mosaic-2,.mosaic-3{grid-template-columns:1fr}.mosaic-3{grid-template-rows:1fr 1fr 1fr}.mosaic-3 .media-container:first-of-type{grid-row:1/span 1}.mosaic-4{grid-template-rows:1fr 1fr 1fr}.mosaic-4 .media-container:first-of-type,.mosaic-4 .media-container:nth-of-type(2){grid-column:1/span 2}.mosaic-4 .media-container:first-of-type{grid-row:1/span 1}.mosaic-5{grid-template-columns:.5fr .5fr;grid-template-rows:1fr .5fr .5fr}.mosaic-5 .media-container:first-of-type{grid-row:1/span 1;grid-column:1/span 2}.media-modal{width:80%}.schedule-category-header{padding-left:1em;padding-right:1em}.schedule-category-days-container{margin-right:5em}.pricing{flex-direction:column;align-items:center}.pricing-card{margin-right:0;margin-bottom:1em}.org-container{width:100%}.contact-icon{width:1.5em;height:1.5em}.contact-item{padding-left:1em;padding-right:1em}.contact-content{word-break:break-all;font-size:.9em}.facebook .contact-content,.instagram .contact-content,.twitter .contact-content,.website .contact-content{font-size:.8em}.peoples{display:flex;flex-direction:column}.people-card{width:auto;text-align:center;margin-bottom:1em;margin-right:0}.people-contacts{display:flex;flex-direction:column;align-items:center}.people-card:last-of-type{margin-bottom:0}}@media (max-width:600px){.schedule-category-days-container{margin-right:1em;padding-left:1em;padding-right:1em}.return-title{display:none}.media-modal{width:90%}.description{width:95%}} \ No newline at end of file +.header-container{display:flex;justify-content:space-between;align-items:center;padding-top:1em;padding-bottom:1em;font-size:1.2em}.header-title{text-align:right}.return{display:flex;align-items:center;color:#34495e;cursor:pointer;transition:all .2s;text-decoration:none}.return-icon{display:flex;align-items:center;margin-right:.75em}.return-icon svg{width:1.3em}.return:hover{opacity:.88;text-decoration:underline}.cover-container{position:relative}.cover-background{z-index:-1;position:absolute;top:0;left:0;background-position:center;background-size:cover;width:100%;height:100%}.cover-content{background-color:rgba(230,126,34,.75);background-size:cover;color:#fff;padding-top:1.5em;padding-bottom:1.5em}.cover-content .container{display:flex;align-items:center}.cover-image{background:#fff;border-radius:50%;border:3px solid #fd6e0b;background-size:cover;background-position:center;width:10em;height:10em;min-width:10em;min-height:10em;margin-right:3em}.cover-title{font-family:'Roboto Slab',serif;font-size:3em;font-weight:400;margin:0}.cover-sub-title{font-size:1.5em;font-weight:400;margin:0}.media-mosaic{margin-top:.75em;width:100%;height:25em;display:grid;grid-column-gap:.75em;grid-row-gap:.75em}.media-overlay{background-color:rgba(196,196,196,.7);color:#b12008;display:flex;justify-content:center;align-items:center;position:absolute;left:0;top:0;width:100%;height:100%}.media-container{position:relative}.media-overlay svg{width:3.5em;cursor:pointer;transition:all .2s}.media-overlay svg:hover{transform:scale(1.2)}.mosaic-1{display:flex;justify-content:center}.mosaic-1 .media-container{width:70%}.mosaic-2{grid-template-columns:1fr 1fr;grid-template-rows:1fr}.mosaic-3{grid-template-columns:1fr .5fr;grid-template-rows:1fr 1fr}.mosaic-3 .media-container:first-of-type{grid-row:1/span 2}.mosaic-4{grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr}.mosaic-5{grid-template-columns:1fr .5fr .5fr;grid-template-rows:1fr 1fr}.mosaic-5 .media-container:first-of-type{grid-row:1/span 2}.media{cursor:zoom-in;height:100%;border-radius:4px;background-size:cover;background-position:center}.media-modal-container{position:fixed;width:100%;height:100vh;z-index:99;top:0;left:0;background-color:rgba(0,0,0,.8);display:flex;justify-content:center;align-items:center;visibility:hidden;opacity:0;transition:visibility .1s linear,opacity .1s linear}.media-modal{position:relative;width:50%}.media-modal .media-modal-content{border-radius:4px;width:100%}.media-modal img,.media-modal video{width:100%}.media-close{position:absolute;width:1.5em;height:1.5em;right:-.75em;top:-.75em;color:#fff;cursor:pointer;opacity:.7;transition:all .2s}.media-close:hover{transform:scale(1.2);opacity:1}section{margin-top:1.2em;margin-bottom:0}.section-title{margin-top:1em;margin-bottom:1em}.section-title h1,.section-title h2,.section-title h3{margin:0;font-weight:400;font-family:'Roboto Slab',serif;font-size:1.8em}.section-divider{background-color:rgba(194,129,0,.5);width:100%;height:3px;border-radius:1px}.description{line-height:1.5em;text-align:justify;margin:0 auto;width:80%;margin-top:1em;margin-bottom:.5em}.description p{margin-top:.75em}.description p:last-child{margin-bottom:0}.description h3{font-size:1.4em;margin-top:1em;margin-bottom:0}.description h4{font-size:1.2em;margin-top:1em;margin-bottom:0}.description h3,.description h4{opacity:.8}.description blockquote{border-left:3px solid #95a5a6;border-radius:3px}.description blockquote p{padding-top:1em;padding-bottom:1em;padding-left:1em}.description-cutted{max-height:13em;overflow:hidden;transition:max-height .1s ease-out}.description-actions-container{display:flex;justify-content:center;align-items:center;margin-top:1em}.description-actions-container.closed{box-shadow:0 -16px 16px -3px #fff;background:rgba(255,255,255,.8);position:relative;top:-62px;height:62px;margin-bottom:-62px}.schedule-category{margin-bottom:1em}.schedule-category-header{background-color:rgba(189,195,199,.97);border-radius:4px;display:flex;justify-content:space-between;align-items:center;padding:1em 2em 1em 2em;cursor:pointer}.schedule-category-collapse-icon{transform:rotate(180deg);color:#b12008;width:1.5em;transition:all .1s ease-out}.schedule-category-table{max-height:0;overflow:hidden;transition:max-height .1s ease-out}.schedule-category-days-container{border-radius:4px;background-color:#ecf0f1;margin-left:2em;margin-top:1em;margin-bottom:1em;margin-right:20em;padding:1em 2em 1em 2em}.schedule-category-day-container{display:flex;justify-content:space-between;margin-bottom:1em}.schedule-category-day-container .separator{opacity:.5}.schedule-category-table div:last-child{margin-bottom:0}.schedule-category-hours{color:#2c3e50}.schedule-category-hours .spearator{color:#bdc3c7}.pricing{display:flex;justify-content:center}.pricing-card{max-width:14em;height:10em;width:100%;padding:1.5em 1em;text-align:center;border-radius:4px;display:flex;flex-direction:column;justify-content:space-between;margin-right:1.5em;color:#fff}.pricing .pricing-card:nth-child(1){background-color:rgba(177,88,8,.8)}.pricing .pricing-card:nth-child(2){background-color:rgba(253,110,11,.78)}.pricing .pricing-card:nth-child(3){background-color:rgba(177,32,8,.8)}.pricing .pricing-card:last-child{margin-right:0}.pricing-label{font-size:1.5em}.pricing-name{font-size:1.8em}.org-container{margin:0 auto;width:70%}.contact-item{display:flex;justify-content:space-between;align-items:center;padding-top:.75em;padding-bottom:.75em;padding-left:2em;padding-right:2em;background-color:#ecf0f1;border-radius:4px;margin-bottom:1em}.contact-item.address .contact-content div{margin-bottom:.25em}.contact-item.address .contact-content div:last-child{margin-bottom:0}.contact-icon{color:#b15808;background-color:#c4c4c4;border-radius:50%;width:2em;height:2em;display:flex;justify-content:center;align-items:center;font-size:1.5em}.contact-icon svg{width:.7em}.contact-content{text-align:right}.external-link{margin-left:.25em;font-weight:700}.external-link{width:.8em}.email .contact-icon svg{width:.9em}.website .contact-icon svg{width:.9em}.facebook .contact-icon{background-color:#3b5999;color:#fff}.facebook .contact-icon svg{width:.5em}.instagram .contact-icon{background:linear-gradient(45deg,#405de6,#5851db,#833ab4,#c13584,#e1306c,#fd1d1d);color:#fff}.instagram .contact-icon svg{width:.75em}.twitter .contact-icon{background-color:#1da1f2;color:#fff}.twitter .contact-icon svg{width:.75em}.peoples{width:100%;display:flex;justify-content:center;margin-bottom:1em}.people-card{width:100%;max-width:50%;margin-right:1em;border-radius:3px;padding:1.2em 1.5em;border:1px solid gray}.people-card:last-of-type{margin-right:0}.people-name{font-size:1.4em;margin-bottom:.5em}.people-contacts{margin-top:.5em}.people-contact{padding-top:.5em;padding-bottom:.5em;display:flex;align-items:center}.people-role{opacity:.8}.people-contact-icon{width:1em;height:1em;margin-right:1em;color:#b15808}.mentions{display:flex;justify-content:center;padding-left:1em;padding-right:1em;flex-direction:column;text-align:center;color:#d35400;margin-top:1em;margin-bottom:1em}.mentions div{margin-bottom:.5em}.footer{width:100%;display:grid;grid-template-columns:50% 25% 25%;grid-template-rows:1fr;height:1em}.footer div:nth-child(1){background-color:rgb(177,32,8,.83)}.footer div:nth-child(2){background-color:rgb(177,88,8,.83)}.footer div:nth-child(3){background-color:rgb(253,110,11,.83)}@media (max-width:1200px){.schedule-category-days-container{margin-right:25em}.media-modal{width:70%}}@media (max-width:900px){.cover-content .container{flex-direction:column;justify-content:center;text-align:center}.cover-image{margin-right:0;margin-bottom:3em}.cover-title{font-size:2.5em;margin-bottom:.25em}.media-mosaic{height:33em}.mosaic-1 .media-container{width:100%}.mosaic-2{grid-template-rows:1fr 1fr}.mosaic-2,.mosaic-3{grid-template-columns:1fr}.mosaic-3{grid-template-rows:1fr 1fr 1fr}.mosaic-3 .media-container:first-of-type{grid-row:1/span 1}.mosaic-4{grid-template-rows:1fr 1fr 1fr}.mosaic-4 .media-container:first-of-type,.mosaic-4 .media-container:nth-of-type(2){grid-column:1/span 2}.mosaic-4 .media-container:first-of-type{grid-row:1/span 1}.mosaic-5{grid-template-columns:.5fr .5fr;grid-template-rows:1fr .5fr .5fr}.mosaic-5 .media-container:first-of-type{grid-row:1/span 1;grid-column:1/span 2}.media-modal{width:80%}.schedule-category-header{padding-left:1em;padding-right:1em}.schedule-category-days-container{margin-right:5em}.pricing{flex-direction:column;align-items:center}.pricing-card{margin-right:0;margin-bottom:1em}.org-container{width:100%}.contact-icon{width:1.5em;height:1.5em}.contact-item{padding-left:1em;padding-right:1em}.contact-content{word-break:break-all;font-size:.9em}.facebook .contact-content,.instagram .contact-content,.twitter .contact-content,.website .contact-content{font-size:.8em}.peoples{display:flex;flex-direction:column}.people-card{max-width:100%;width:auto;text-align:center;margin-bottom:1em;margin-right:0}.people-contacts{display:flex;flex-direction:column;align-items:center}.people-card:last-of-type{margin-bottom:0}}@media (max-width:600px){.schedule-category-days-container{margin-right:1em;padding-left:1em;padding-right:1em}.return-title{display:none}.media-modal{width:90%}.description{width:95%}} \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index c76cdcc..93ecd97 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -12,7 +12,7 @@ function minifyStyles() { } function minifyScripts() { - return gulp.src(developmentPath + '/scripts/home.js') + return gulp.src(developmentPath + '/scripts/*.js') .pipe(terser()) .pipe(gulp.dest(productionPath + '/scripts')) } diff --git a/src/app.ts b/src/app.ts index 017c5d3..693253b 100644 --- a/src/app.ts +++ b/src/app.ts @@ -58,6 +58,7 @@ let main = async () => { app.use(bodyParser.json()) app.get('/', PublicController.home) + app.get('/countdown', PublicController.countdown) app.get('/association/:slug', PublicController.organization) app.get('/a-propos', PublicController.about) app.get('/mentions-legales', PublicController.legals) diff --git a/src/controllers/AdminOrganizationController.ts b/src/controllers/AdminOrganizationController.ts index 202871f..abefe0b 100644 --- a/src/controllers/AdminOrganizationController.ts +++ b/src/controllers/AdminOrganizationController.ts @@ -24,6 +24,7 @@ export default class AdminOrganizationController { // second column is always email const input = req.body.data const parsed = Papa.parse(input) + console.log(parsed) if (parsed.errors.length > 0) { return res .status(400) @@ -51,7 +52,9 @@ export default class AdminOrganizationController { console.log(errors) res.status(400).json({ success: false, - errors + errors, + parsed, + input }) }) } @@ -64,11 +67,12 @@ export default class AdminOrganizationController { ).then(({ data, body }) => { res.json({ success: true, data, body }) }).catch((err: any) => { - res.status(400).json({ success: false, errors: err.errors }) + res.status(400).json({ success: false, errors: [err] }) }) } static storeUniversal(adminName: string, email: string, validationState: string): Promise { + console.log(adminName, email, validationState) return new Promise((resolve, reject) => { if (validationState == null) { validationState = 'unaware' diff --git a/src/controllers/DelegateController.ts b/src/controllers/DelegateController.ts index a65fcbd..c93a22a 100644 --- a/src/controllers/DelegateController.ts +++ b/src/controllers/DelegateController.ts @@ -196,6 +196,7 @@ export default class DelegateController { // before starting the upload process, we want to make sure that this organization is not exeeding the size limit for all the file let currentSize = MediaService.computeSize(res.locals.organization.proposedVersion) if (currentSize >= MediaService.getSizeLimit()) { + console.log('> An upload was refused because of a storage size exceed event') return res .status(413) .json({ @@ -274,9 +275,15 @@ export default class DelegateController { // @ts-ignore req.files.forEach((file: any) => { - proposedVersion.gallery.push(MediaService.buildMedia(file, 'media')) + file = MediaService.buildMedia(file, 'media') + proposedVersion.gallery.push(file) + + // if the media is a video, we generate a thumbnail + if (file.contentType.indexOf('video') !== -1) { + console.log('generating a thumbnail') + } }) - + Organization.updateOne({ _id: res.locals.organization._id }, { proposedVersion, updatedAt: new Date() diff --git a/src/controllers/PublicController.ts b/src/controllers/PublicController.ts index e8c3fd3..932f280 100644 --- a/src/controllers/PublicController.ts +++ b/src/controllers/PublicController.ts @@ -15,6 +15,10 @@ import MediaService from '../MediaService' export default class PublicController { + static async countdown(req: express.Request, res: express.Response) { + res.render('countdown.twig', {}) + } + static async home(req: express.Request, res: express.Response) { // let client: IORedis.Redis = RedisService.getClient() // await client.set('hello', 'world') diff --git a/src/models/Organization.ts b/src/models/Organization.ts index 6dfd16a..d406d2b 100644 --- a/src/models/Organization.ts +++ b/src/models/Organization.ts @@ -28,16 +28,13 @@ class AllowedString extends mongoose.SchemaType { const email = { type: String, - trim: true, - lowercase: true, - unique: true, validate: { validator: function(v: string) { + console.log(v) return /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(v); }, message: "Invalid email" - }, - required: [true, "Email required"] + } } // @ts-ignore @@ -71,7 +68,7 @@ const OrganizationVersion = { website: { type: String }, address: { type: String }, person: { type: String }, - email: { type: String }, + email, phone: { type: String }, peoples: [{ name: { type: String }, diff --git a/views/countdown.twig b/views/countdown.twig new file mode 100644 index 0000000..052e2fb --- /dev/null +++ b/views/countdown.twig @@ -0,0 +1,37 @@ +{% extends "./base.twig" %} +{% block title %}Le site va ouvrir prochainement{% endblock %} +{% block head %} + +{% endblock %} +{% block content %} +
+
+

Soyez patient...

+
Le site ouvre le 4 septembre, c'est à dire dans :
+
+
+
+ +
Jours
+
+ : +
+ +
Heures
+
+ : +
+ +
Minutes
+
+ : +
+ +
Secondes
+
+
+
+{% endblock %} +{% block scripts %} + +{% endblock %} \ No newline at end of file diff --git a/views/organization.twig b/views/organization.twig index 2f239c3..a632790 100644 --- a/views/organization.twig +++ b/views/organization.twig @@ -20,18 +20,20 @@ -
-
-
-
-
-
-

- {{ data.name }} -

- {#

- Sous titre -

#} +
+
+
+
+
+
+
+

+ {{ data.name }} +

+ {#

+ Sous titre +

#} +
@@ -163,7 +165,6 @@
- {% if data.contacts.peoples|length > 0 %}
@@ -183,6 +184,7 @@ {{ data.contacts.email }}
+ {% if data.contacts.phoneInt is not empty %}
+ {% endif %}
{% for people in data.contacts.peoples %} @@ -224,31 +227,32 @@
{% endfor %}
- {% endif %} - {% if data.contacts.peoples|length == 0 and data.contacts.person|length > 0 %} -
-
- + {# + {% if data.contacts.peoples|length == 0 and data.contacts.person|length > 0 %} +
+
+ +
+
+ {{ data.contacts.person }} +
-
- {{ data.contacts.person }} + {% endif %} + {% if data.contacts.peoples|length == 0 and data.contacts.email|length > 0 %} + -
- {% endif %} - {% if data.contacts.peoples|length == 0 and data.contacts.email|length > 0 %} - - {% endif %} + {% endif %} + #} {% if data.contacts.peoples|length == 0 and data.contacts.phone|length > 0 %}
@@ -270,7 +274,7 @@
{% for line in data.contacts.address %} - {{ line }}
+
{{ line }}
{% endfor %}