Skip to content

Commit

Permalink
agregando configuracion de estados a facultades
Browse files Browse the repository at this point in the history
  • Loading branch information
xtian7489 committed Aug 17, 2023
1 parent 9a9048b commit 84476b4
Show file tree
Hide file tree
Showing 30 changed files with 698 additions and 77 deletions.
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
39 changes: 39 additions & 0 deletions ext/lib/site/Popup/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
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>
)
}
}


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

.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
}
.popup-proyectista.active{
right: 40px
}

.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
}
21 changes: 12 additions & 9 deletions ext/lib/site/banner-invitacion/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,38 @@ import config from 'lib/config'
import {Link} from 'react-router'


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

} alt="Ideas"/>
<p>{
config.votacionAbierta ?
forum.config.votacion ?
'Te invitamos a conocer los proyectos y a votar los que quieras que se lleven adelante' :
config.propuestasAbiertas ?
forum.config.propuestasAbiertas ?
"Subí tu idea o mejorá con tus comentarios las de los vecinos.":
config.propuestasVisibles ?
forum.config.preVotacion ?
"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"
(forum.config.preVotacion || forum.config.votacion) ? "Catálogo de Proyectos" : "Accedé a las ideas"
}
</Link>
{
config.votacionAbierta && <Link to={'/votacion'} tabIndex="32" className="boton-votacion" href="">Votá los proyectos</Link>
forum.config.votacion && <Link to={'/votacion'} tabIndex="32" className="boton-votacion" href="">Votá los proyectos</Link>
}
{
!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>
forum.config.preVotacion && <Link tabIndex="33" className="boton-votacion" target="_blank" href="https://www.mardelplata.gob.ar/documentos/comunicacion/participamgpproyectosganadores.pdf">Votos por proyectos</Link>
}

</div>
)
)
}
26 changes: 22 additions & 4 deletions ext/lib/site/footer/component.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
import React from 'react'
import React, {Component} from 'react'
import { Link } from 'react-router'
import PopUp from '../Popup/component'
import forumStore from 'lib/stores/forum-store/forum-store'

const Footer = () => (

export default class Footer extends Component {
constructor (props) {
super(props)
this.state={
forum:null
}
}

componentDidMount(){
forumStore.findOneByName('proyectos').then((forum) => this.setState({forum}))
}
render(){
const {forum} = this.state
return(
<footer className='footer-static'>
{forum && <PopUp forum={forum} />}
<div className='container'>
<div className='contacto-detalles'>
<h3>CONTACTO</h3>
Expand Down Expand Up @@ -40,6 +57,7 @@ const Footer = () => (
</div>
</div>
</footer>
)

export default Footer
)
}
}
2 changes: 1 addition & 1 deletion ext/lib/site/formulario-propuesta/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ class FormularioPropuesta extends Component {
const { forum, zonas, barrios, requirementsAccepted } = this.state

if (!forum) return null
if(config.propuestasAbiertas || (this.state.forum.privileges && this.state.forum.privileges.canChangeTopics)) {
if(forum.config.propuestasAbiertas || (this.state.forum.privileges && this.state.forum.privileges.canChangeTopics)) {
return (
<div className='form-propuesta'>
<div className='propuesta-header'>
Expand Down
9 changes: 5 additions & 4 deletions ext/lib/site/formulario-votacion/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ class FormularioVoto extends Component {

componentWillMount () {
const { user } = this.props
const side_panel = document.getElementById("side_panel")
if (side_panel) side_panel.style.visibility = "hidden";

const promises = [
// data del forum
Expand All @@ -106,6 +104,9 @@ class FormularioVoto extends Component {
this.onUserStateChange()
}
this.setState(newState)

const side_panel = document.getElementById("side_panel")
if (side_panel) side_panel.style.visibility = "hidden";
}).catch(err =>
console.error(err)
)
Expand Down Expand Up @@ -453,7 +454,7 @@ class FormularioVoto extends Component {

const { forum, step, warning, forumAndTopicFetched, userFetched, isTopicDialogOpen, topicDialog } = this.state
if (!forum) return null
if (!config.votacionAbierta) return <Close />
if (!forum.config.votacion) return <Close />

if (!forumAndTopicFetched || !userFetched) return (<p>Loading...</p>)

Expand Down Expand Up @@ -503,7 +504,7 @@ class FormularioVoto extends Component {
</div>
}
{this.renderStep(step)}
{config.votacionAbierta && step !== welcome && step <= confirm && !(hasWarning | isTopicDialogOpen) && (
{forum.config.votacion && step !== welcome && step <= confirm && !(hasWarning | isTopicDialogOpen) && (
<div className='footer-votacion'>
<button className='button-anterior' disabled={step <= welcome ? true : false} onClick={() => this.changeStep(step - 1)}>
<span className='icon-arrow-left-circle'></span> Anterior
Expand Down
12 changes: 7 additions & 5 deletions ext/lib/site/header/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class Header extends Component {
userForm: null,
mobileMenu: false,
userMenu: false,
userPrivileges: null
userPrivileges: null,
forumConfig:null
}

props.user.onChange(this.onUserStateChange)
Expand Down Expand Up @@ -74,7 +75,7 @@ class Header extends Component {
onUserStateChange = () => {
if (this.props.user.state.fulfilled){
forumStore.findOneByName(config.forumProyectos).then(
forum => this.setState({ userPrivileges: forum.privileges })
forum => this.setState({ userPrivileges: forum.privileges, forumConfig: forum.config })
)
}
}
Expand All @@ -87,7 +88,7 @@ class Header extends Component {
const showAdmin = this.state.userPrivileges && this.state.userPrivileges.canChangeTopics

const userState = this.props.user.state

const {forumConfig} = this.state
// MEDIA QUERY - Si es menor al breakpoint muestra un menú, si es mayor, otro
if (window.matchMedia('(max-width: 975px)').matches) {
return (
Expand Down Expand Up @@ -134,7 +135,8 @@ class Header extends Component {
form={this.state.userForm}
menuOn={this.state.mobileMenu}
showAdmin={showAdmin}
toggleOnClick={this.toggleMobileMenu} />
toggleOnClick={this.toggleMobileMenu}
forumConfig={forumConfig} />

</ul>
</nav>
Expand Down Expand Up @@ -185,7 +187,7 @@ class Header extends Component {
Archivo
</Link>
</li>
{ config.votacionAbierta && <li className={`header-item ${window.location.pathname.includes('/votacion') ? 'active' : ''}`}>
{ forumConfig && forumConfig.votacion && <li className={`header-item ${window.location.pathname.includes('/votacion') ? 'active' : ''}`}>
<Link
to='/votacion'
className='header-link'
Expand Down
4 changes: 2 additions & 2 deletions ext/lib/site/header/mobile-menu/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class MobileMenu extends Component {
this.props.toggleOnClick()
}
}

render () {
const { forumConfig } = this.props
return (
<nav className='mobile-nav'>
<a
Expand Down Expand Up @@ -67,7 +67,7 @@ class MobileMenu extends Component {
Archivo
</Link>
</div>
{ config.votacionAbierta && <div className='header-item'>
{ forumConfig.votacion && <div className='header-item'>
<Link
to='/votacion'
className={`header-link ${!~window.location.pathname.includes('votacion') ? 'active' : ''}`}
Expand Down
Loading

0 comments on commit 84476b4

Please sign in to comment.