Skip to content

Commit

Permalink
Merge pull request #12 from DemocraciaEnRed/dev/setting-stages
Browse files Browse the repository at this point in the history
Dev/setting stages
  • Loading branch information
xtian7489 authored Sep 18, 2023
2 parents 20412a9 + c399dd3 commit 52298b6
Show file tree
Hide file tree
Showing 61 changed files with 3,575 additions and 1,678 deletions.
44 changes: 44 additions & 0 deletions ext/lib/api-v2/about/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const express = require('express')

const middlewares = require('lib/api-v2/middlewares')

const api = require('lib/db-api')

const utils = require('lib/utils')
const expose = utils.expose

const app = (module.exports = express.Router())

const goToNextRoute = (req, res, next) => next('route')

app.post('/about',
middlewares.users.restrict,
middlewares.forums.findFromBody,
goToNextRoute)

app.put('/about/:id',
middlewares.users.restrict, // restringe
middlewares.about.findById,
goToNextRoute)

app.delete('/about/:id',
middlewares.users.restrict, // restringe
middlewares.about.findById,
goToNextRoute)

app.put('/about-update-order',
middlewares.users.restrict, // restringe
middlewares.forums.findFromBody,
goToNextRoute
)

app.get('/about-all', (req, res, next) => {
try {
api.about.all(function (err, faqs) {
if (err) return _handleError(err, req, res);
res.status(200).json(faqs.map(expose('id question answer createdAt order')))
})
} catch (err) {
next(err)
}
})
3 changes: 2 additions & 1 deletion ext/lib/api-v2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ const app = module.exports = express()
app.use(require('./topics'))
app.use(require('./topics/xlsx'))

app.use(require('./votes'))
app.use(require('./votes'))
app.use(require('./about'))
2 changes: 1 addition & 1 deletion ext/lib/api-v2/topics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const purgeBody = (req, res, next) => {
// beware with subscribers fields
if (isCitizenOnProposal(req.user, req.forum)) {
//console.log('Entre por true')
if (config.propuestasAbiertas){
if (req.forum.config.propuestasAbiertas){
// IF THE FORM IS OPEN, RUN THIS
req.body = Object.assign(
defaultValues(),
Expand Down
3 changes: 2 additions & 1 deletion ext/lib/api/topics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ app.get('/topics',
},
tipoIdea: {
type: 'string',
default: 'pendiente,proyecto'
default: 'nothing'
},
years: {
type: 'string',
Expand Down Expand Up @@ -91,6 +91,7 @@ app.get('/topics',
} else {
finalTopics = topics
}
finalTopics = utils.findByKwordsAndSort(finalTopics,req.query.queryString)
res.status(200).json({
status: 200,
pagination: {
Expand Down
18 changes: 18 additions & 0 deletions ext/lib/api/topics/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ exports.parseYears = (req, res, next) => {
}

exports.parseKWords = (req, res, next) => {
req.query.queryString = req.query.kwords
req.query.kwords = req.query.kwords.split(' ').filter((t) => !!t)
next()
}
Expand Down Expand Up @@ -167,3 +168,20 @@ exports.findTopicsCount = (opts) => getPossibleOwners(opts).then(owners => {
} else
return 0
})


exports.findByKwordsAndSort = (results, searchTerm) => {
const exactMatchResults = [];
const partialMatchResults = [];

results.forEach(result => {
if (result.mediaTitle.toLowerCase().includes(searchTerm.toLowerCase())) {
exactMatchResults.push(result);
} else {
partialMatchResults.push(result);
}
});

const sortedResults = exactMatchResults.concat(partialMatchResults);
return sortedResults;
}
40 changes: 40 additions & 0 deletions ext/lib/site/Popup/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from 'react'



const PopUp = (props) => {
const { forum } = props

const handleTypeForm = (event)=>{
const form = document.getElementById('typeform-full')
form.classList.toggle('closed')
event.stopPropagation()
event.currentTarget.classList.toggle('active')
}

if (forum.config.mostrarFormulariosProyectistas) {
return (
<div className='side-panel' >
<iframe
title="Embedded Typeform"
id="typeform-full"
frameBorder="0"
src="https://form.typeform.com/to/cbSeR97L?typeform-medium=embed-snippet"
className='closed'
></iframe>
<button onClick={handleTypeForm} className='popup-proyectista' > <span className='glyphicon glyphicon-comment'></span><span className='text-popup'> ¡Quiero ser proyectista! </span></button>
</div>
)
}
else if (forum.config.votacion) {
return (
<div className='side-panel' id='side_panel'>
<a href="/votacion" className='popup-proyectista' > <span className='text-popup'> ¡Quiero votar! </span></a>
</div>
)
}
else{return(null)}
}


export default PopUp
138 changes: 138 additions & 0 deletions ext/lib/site/Popup/styles.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@

.popup-proyectista{
box-sizing: border-box;
position: absolute;
top: 300px;
width: 250px;
height: 34px;
padding: 0 20px;
margin: 0;
cursor: pointer;
background: #0445AF;
border-radius: 4px 4px 0px 0px;
box-shadow: 0px 2px 12px rgba(0, 0, 0, 0.06), 0px 2px 4px rgba(0, 0, 0, 0.08);
display: flex;
align-items: center;
justify-content: flex-start;
transform: rotate(-90deg);
transform-origin: bottom left;
color: white;
text-decoration: none;
z-index: 9999;
transition: all 1s ease-in-out
border: none
}
.popup-proyectista.active{
right: 50px
}

.text-popup{
text-decoration: none;
font-size: 16px;
font-family: Helvetica,Arial,sans-serif;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 100%;
text-align: center;
-webkit-font-smoothing: antialiased;
}

.side-panel{
position: fixed;
top: calc(50% - 250px);
right: 0;
transition: width 300ms ease-out;
width: 0;
}
.side-panel > a:hover{
color: #fff
}

#typeform-full{
position: fixed;
height: 50vh
top: 50%;
right: 0;
max-width: 1000px
transform: translate(0%, -50%);
}

#typeform-full.closed{
right: -100%
}

.popup-votacion{
box-sizing: border-box;
position: absolute;
top: 300px;
width: 180px;
height: 34px;
padding: 0 20px;
margin: 0;
cursor: pointer;
background: #0080a5;
border-radius: 4px 4px 0px 0px;
box-shadow: 0px 2px 12px rgba(0, 0, 0, 0.06), 0px 2px 4px rgba(0, 0, 0, 0.08);
display: flex;
align-items: center;
justify-content: flex-start;
transform: rotate(-90deg);
transform-origin: bottom left;
color: white!important;
text-decoration: none;
z-index: 9999;
}


.glyphicon-comment{

width: 32px;
position: relative;
text-align: center;
transform: rotate(90deg) scale(0.75);
left: -8px;
}

.typeForm-share{
box-sizing:border-box;
position:absolute;
top:300px;
width:200px;
height:48px;
padding:0 20px;
margin:0;
cursor:pointer;
background:#0445AF;
border-radius:4px 4px 0px 0px;
box-shadow:0px 2px 12px rgba(0, 0, 0, 0.06), 0px 2px 4px rgba(0, 0, 0, 0.08);
display:flex;
align-items:center;
justify-content:flex-start;
transform:rotate(-90deg);
transform-origin:bottom left;
color:white;
text-decoration:none;
z-index:9999;
}

.typeForm-share > span{
width:32px;
position:relative;
text-align:center;
transform:rotate(90deg) scale(0.85);
left:-8px;
}

.typeForm-share > span{
text-decoration:none;
font-size:18px;
font-family:Helvetica,Arial,sans-serif;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
width:100%;
text-align:center;
-webkit-font-smoothing:antialiased;
-moz-osx-font-smoothing:grayscale
}
42 changes: 14 additions & 28 deletions ext/lib/site/banner-invitacion/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,21 @@ import config from 'lib/config'
import {Link} from 'react-router'


export default () => (
export default (props) => {
const {texts} = props
return(
<div className="banner-ideas">
<img src={
config.votacionAbierta ?
"/ext/lib/site/banner-invitacion/icon-votar.svg" :
"/ext/lib/site/banner-invitacion/icon-idea.svg"

} alt="Ideas"/>
<p>{
config.votacionAbierta ?
'Te invitamos a conocer los proyectos y a votar los que quieras que se lleven adelante' :
config.propuestasAbiertas ?
"Subí tu idea o mejorá con tus comentarios las de los vecinos.":
config.propuestasVisibles ?
"La etapa de subida de ideas ya finalizó. Ingresá para ver el listado completo" :
'La etapa de votación ya finalizó. Podrás acceder a ver los proyectos ganadores'
}</p>

<Link to={'/propuestas'} tabIndex="31" className="boton-foro" href="">
{
(config.votacionAbierta || config.votacionVisible) ? "Catálogo de Proyectos" : "Accedé a las ideas"
}
</Link>
{
config.votacionAbierta && <Link to={'/votacion'} tabIndex="32" className="boton-votacion" href="">Votá los proyectos</Link>
{texts['home-banner-image'] &&
<img src={texts['home-banner-image']} alt="Ideas"/>
}
{
!config.votacionAbierta && config.votacionVisible && <Link tabIndex="33" className="boton-votacion" target="_blank" href="https://www.mardelplata.gob.ar/documentos/comunicacion/participamgpproyectosganadores.pdf">Votos por proyectos</Link>
}
<p>{texts['home-banner-title']}</p>

{texts['home-banner-button1-text'] && <Link to={texts['home-banner-button1-link']} tabIndex="31" className="boton-foro" href="">
{texts['home-banner-button1-text']}
</Link>}
{texts['home-banner-button2-text'] && <Link to={texts['home-banner-button2-link']} tabIndex="32" className="boton-votacion" target="_blank">{texts['home-banner-button2-text']}</Link>}


</div>
)
)
}
5 changes: 3 additions & 2 deletions ext/lib/site/encuentrosProximos/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,19 @@ export default class EncuentrosProximos extends Component {

render () {
const { isLoading, availableEvents } = this.state
const { texts } = this.props
return (
<div className='seccion-proximos-encuentros'>
<div className="text-center">
<div className="fondo-titulo" style={{backgroundColor: '#c4d94b', fontFamily: 'Museo300'}}>
<h3 className='subtitle'>NOVEDADES Y PRÓXIMOS ENCUENTROS</h3>
<h3 className='subtitle'>{texts['home-encuentro-title']}</h3>
</div>
</div>
<div className="container-fluid">

<div className="row text-center">
<div className="col-lg-12">
<p className="text-white">Agendate la reunión de tu barrio y presentá tus ideas.<br/></p>
<p className="text-white">{texts['home-encuentro-subtitle']}<br/></p>
</div>
</div>
<br></br>
Expand Down
Loading

0 comments on commit 52298b6

Please sign in to comment.