Conjunto de cambios 0b2127c en consulta_publica para static


Ignorar:
Fecha y hora:
24/05/2017 11:03:38 (hace 7 años)
Autor:
rudmanmrrod <rudman22@…>
Branches:
constituyente, estudiantes, general, plan_patria, sala
Children:
e26ee47
Parents:
2645b43
Mensaje:

Agregados campos extra para el perfil de usuario

Fichero:
1 editado

Leyenda

No modificado
Añadido
Eliminado
  • static/js/funciones.js

    r2645b43 r0b2127c  
    498498    var form = $("#encuesta_form");
    499499    var routes = $(location).attr('pathname').split('/')
    500     var pk = routes[routes.length-1]
     500    var pk = routes[routes.length-2]
     501    var obj = routes[routes.length-1]
    501502    var participacion;
    502     $.get('/participacion/ajax/validar-participacion?&consulta='+pk)
     503    $.get('/participacion/ajax/validar-participacion?consulta='+pk+'&objetivo='+obj)
    503504    .done(function(response){
    504505        if (response.mensaje) {
     
    515516                    type: 'POST',
    516517                    data: $(form).serialize(),
    517                     url: "/participacion/"+pk,
     518                    url: "/participacion/"+pk+"/"+obj,
    518519                    success: function(response) {
    519520                        if (response.code == true) {
     
    584585                        var text_area = $(value).parent().parent().find('textarea');
    585586                        not_empty = $(text_area).val().trim() !== '' ? 1:0;
    586                         not_empty = $(text_area).val().length >= 500 && $(text_area).val().length <= 2000  ? 1:0;
    587                         if ($(text_area).val().length < 500 || $(text_area).val().length >2000) {
    588                             bootbox.alert("La longitud de la respuesta debe estar entre 500 y 2000 cáracteres");
     587                        not_empty = $(text_area).val().length >= 10 && $(text_area).val().length <= 50  ? 1:0;
     588                        if ($(text_area).val().length < 10 || $(text_area).val().length >50) {
     589                            bootbox.alert("La longitud de la respuesta debe estar entre 10 y 50 cáracteres");
    589590                        }
    590591                    }
     
    818819
    819820    return false;
    820 <<<<<<< HEAD
    821 }
    822 =======
    823 }
    824 >>>>>>> 2fc7ee188afa71bfda5ba7c934156ea7c833781f
     821}
     822
     823/**
     824 * @brief Función para mostrar un campo
     825 * @param valor Recibe el valor
     826 * @param condicion Recibe la condición a evaluar
     827 * @param element Recibe el elemento a habilitar
     828 */
     829function mostrar(valor,condicion,element) {
     830    if (valor==condicion) {
     831        $('#'+element).show();
     832    }
     833    else{
     834        $('#'+element).hide();
     835    }
     836}
     837
     838/**
     839 * @brief Función para habilitar/deshabilitar un campo
     840 * @param valor Recibe el valor
     841 * @param condicion Recibe la condición a evaluar
     842 * @param element Recibe el elemento a modificar
     843 * @param attr_name Recibe el nombre del atributo a agregar/remover
     844 */
     845function habilitar(valor,condicion,element,attr_name) {
     846    if (valor!=condicion) {
     847        $('#'+element).attr(attr_name,true)
     848    }
     849    else{
     850        $('#'+element).removeAttr(attr_name);
     851    }
     852}
     853
     854/**
     855 * @brief Función para mostrar los sectores
     856 * @param valor Recibe el valor
     857 */
     858function mostrar_sector(valor) {
     859    mostrar(valor,'ES','sector_estudiante');
     860    mostrar(valor,'TR','sector_trabajador');
     861}
     862
     863/**
     864 * @brief Función para validar si pertenece a un colectivo
     865 * @param valor Recibe el valor
     866 */
     867function habilitar_colectivo(valor) {
     868    habilitar(valor,'CO','id_colectivo','readonly');
     869}
Nota: Vea TracChangeset para ayuda en el uso del visor de conjuntos de cambios.