source: sicp/static/js/layout.js @ 26b76a6

Last change on this file since 26b76a6 was 26b76a6, checked in by Ing. Roldan D. Vargas G <rvargas@…>, 9 years ago

agregadas instrucciones para alinear radio buttons y posicionamiento de los mensajes tooltiptext

  • Property mode set to 100644
File size: 2.9 KB
Line 
1$(document).ready(function() {
2    /**
3     * @brief Función que actualiza la imagen captcha del formulario
4     *
5     * @author Ing. Roldan Vargas (rvargas at cenditel.gob.ve)
6     * @copyright GNU/GPLv2
7     * @date 14-05-2015
8     * @return Retorna falso en caso de no obtener respuesta del servidor, en caso contrario, muestra la nueva imagen captcha
9     */
10    if ($('.js-captcha-refresh').length) {
11        $('.js-captcha-refresh').click(function(){
12            $form = $(this).parents('form');
13            var url = location.protocol + "//" + window.location.hostname + ":" + location.port + "/captcha/refresh/";
14
15            $.getJSON(url, {}, function(json) {
16                $form.find('input[name="captcha_0"]').val(json.key);
17                $form.find('img.captcha').attr('src', json.image_url);
18            });
19
20            return false;
21        });
22    }
23
24    /**
25     * @brief Instrucción que alinea los elementos radio options
26     *
27     * @author Ing. Roldan Vargas (rvargas at cenditel.gob.ve)
28     * @copyright GNU/GPLv2
29     * @date 01-06-2015
30     */
31    if ($(".radio").length) {
32        $('form div ul').contents().unwrap();
33        $('form div li').contents().unwrap();
34        $('.radio').each(function() {
35            $(this).parent().addClass('radio-inline');
36        });
37    }
38
39    /**
40     * @brief Agrega el estilo para los tooltiptext de los elementos del formulario
41     *
42     * @author Ing. Roldan Vargas (rvargas at cenditel.gob.ve)
43     * @copyright GNU/GPLv2
44     * @date 14-05-2015
45     */
46    if (!$('.tip-top').length && !$('.tip-bottom').length && !$('.tip-left').length && !$('.tip-right').length) {
47        $('[data-toggle="tooltip"]').tooltip({});
48    }
49    else {
50
51        $('.tip-top').tooltip({
52            placement: 'top'
53        });
54        $('.tip-bottom').tooltip({
55            placement: 'bottom'
56        });
57        $('.tip-left').tooltip({
58            placement: 'left'
59        });
60        $('.tip-right').tooltip({
61            placement: 'right'
62        });
63    }
64
65
66
67    /**
68     * @brief Inicializa los elementos del dataTable
69     *
70     * @author Ing. Roldan Vargas (rvargas at cenditel.gob.ve)
71     * @copyright GNU/GPLv2
72     * @date 02-06-2015
73     */
74    if ($('.dataTable').length) {
75        $(".dataTable").dataTable({
76            "language": {
77                "url": "http://cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Spanish.json"
78            },
79            "scrollY":        "200px",
80            "scrollCollapse": true,
81            "ordering": true,
82            "order": [[0, 'asc']],
83            "bDestroy": true
84        });
85    }
86
87
88    /**
89     * @brief Instrucción que asigna el estilo select2 a los campos del formulario del tipo select
90     *
91     * @author Ing. Roldan Vargas (rvargas at cenditel.gob.ve)
92     * @copyright GNU/GPLv2
93     * @date 01-06-2015
94     */
95    if ($(".select2").length) {
96        $(".select2").select2({});
97    }
98});
Note: See TracBrowser for help on using the repository browser.