Conjunto de cambios 61f1b8e en seiven para static


Ignorar:
Fecha y hora:
05/09/2016 10:36:58 (hace 8 años)
Autor:
Ing. Roldan D. Vargas G <rvargas@…>
Branches:
master, carga
Children:
a9756e5
Parents:
346b175
Mensaje:

se agregan eventos para el select2 y el reload del captcha

Fichero:
1 editado

Leyenda

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

    rea9df55 r61f1b8e  
     1$(document).ready(function() {
     2    var select2 = $(".select2"), refresh_captcha = $('.js-captcha-refresh'),
     3        input_captcha = $('input[name="captcha_1"]');
     4
     5    if (select2.length > 0) {
     6        select2.select2();
     7    }
     8
     9    if (input_captcha.length) {
     10        /** Agrega clases de bootstrap para el input del captcha */
     11        input_captcha.addClass("form-control input-sm");
     12
     13        /** Agrega un placeholder al input del captcha */
     14        input_captcha.attr("placeholder", "texto de la imagen");
     15    }
     16
     17    if (refresh_captcha.length) {
     18        /** Actualiza la imagen captcha del formulario */
     19        refresh_captcha.click(function(){
     20            $form = $(this).parents('form');
     21            var url = location.protocol + "//" + window.location.hostname + ":" + location.port + "/captcha/refresh/";
     22
     23            $.getJSON(url, {}, function(json) {
     24                $form.find('input[name="captcha_0"]').val(json.key);
     25                $form.find('img.captcha').attr('src', json.image_url);
     26            });
     27
     28            return false;
     29        });
     30    }
     31});
Nota: Vea TracChangeset para ayuda en el uso del visor de conjuntos de cambios.