Skip to content

Commit

Permalink
disable facultad required
Browse files Browse the repository at this point in the history
  • Loading branch information
xtian7489 committed Jul 2, 2024
1 parent 8870126 commit d193f43
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
4 changes: 2 additions & 2 deletions ext/lib/site/formulario-propuesta/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class FormularioPropuesta extends Component {
//if (this.state.claustro === '') return true
if (this.state.solucion === '') return true
if (this.state.beneficios === '') return true
if (this.state.facultad === '') return true
// if (this.state.facultad === '') return true
return false;

}
Expand Down Expand Up @@ -594,7 +594,7 @@ class FormularioPropuesta extends Component {
{this.hasErrorsField('tag') && <li className="error-li">El campo "Tipo" no puede quedar vacío</li> }
{this.hasErrorsField('solucion') && <li className="error-li">El campo "Tu idea" no puede quedar vacío</li> }
{this.hasErrorsField('beneficios') && <li className="error-li">El campo "Beneficios" no puede quedar vacío</li>}
{this.hasErrorsField('facultad') && <li className="error-li">El campo "Facultad" no puede quedar vacío</li> }
{/* {this.hasErrorsField('facultad') && <li className="error-li">El campo "Facultad" no puede quedar vacío</li> } */}
{/* {this.hasErrorsField('claustro') && <li className="error-li">El campo "Claustro" no puede quedar vacío</li>} */}
</ul>
</div>
Expand Down
6 changes: 3 additions & 3 deletions ext/lib/site/topic-layout/topic-article-idea/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class TopicArticle extends Component {
trigger={`Proyecto final`}>
<div className='topic-article-author'><span>Autor/es/as:</span> {topic.owner.fullName}</div>
{topic.attrs['presupuesto-total'] && <div>Presupuesto asignado: <span>${topic.attrs['presupuesto-total'].toLocaleString()}</span></div>}
<div className='topic-article-facultad'><span>{topic.facultad.nombre}</span></div>
{topic.facultad && <div className='topic-article-facultad'><span>{topic.facultad.nombre}</span></div>}

{topic.attrs['proyecto-contenido'].replace(/https?:\/\/[a-zA-Z0-9./]+/g, '<a href="$&" rel="noopener noreferer" target="_blank">$&</a>')}
</Collapsible>
Expand All @@ -241,9 +241,9 @@ class TopicArticle extends Component {
{topic.attrs['solucion'] ?
<div>
<div className="row">
<div className="col-md-6">
{topic.facultad && <div className="col-md-6">
{topic.facultad.nombre}
</div>
</div>}
<div className="col-md-6">
<strong>Autor/as/es:</strong> {topic.owner.fullName}
</div>
Expand Down
2 changes: 1 addition & 1 deletion lib/api-v2/db-api/topics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ exports.create = function create (opts, attrs) {

attrs.forum = forum._id
attrs.owner = user._id
attrs.facultad = facultad._id
attrs.facultad = facultad ? facultad._id : null
attrs.tag = tag._id

switch (attrs['action.method']) {
Expand Down
23 changes: 14 additions & 9 deletions lib/api-v2/middlewares/facultades.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
const api = require('../db-api')

function findWithId (id, req, res, next) {
api.facultades.find({ _id: id })
.findOne()
.exec()
.then((facultad) => {
if (!facultad) return next(new Error404(id))
if (id) {
api.facultades.find({ _id: id })
.findOne()
.exec()
.then((facultad) => {
if (!facultad) return next(new Error404(id))

req.facultad = facultad
req.facultad = facultad

next()
})
.catch(next)
next()
})
.catch(next)
} else {

next()
}
}

exports.findById = function findById (req, res, next) {
Expand Down

0 comments on commit d193f43

Please sign in to comment.