Commit 2011c0ee authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Fusion du JS et du CSS des indicateurs

parent 159cda32
Loading
Loading
Loading
Loading
+50 −0
Changes for module/Indicateur/view/indicateur/indicateur/index.phtml: 50 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -139,5 +139,55 @@ $noAbo = new \Indicateur\Entity\Db\NotificationIndicateur();

        });



        WidgetInitializer.add('indicateur', {

            _create: function ()
            {
                var that = this;

                this.getElementNotif().change(function () { that.abonner(); });
                this.getElementInHome().change(function () { that.abonner(); });

                this.element.find(".glyphicon.glyphicon-info-sign").tooltip();
            },


            abonner: function ()
            {
                var that = this;
                var notif = this.getElementNotif();
                var inHome = this.getElementInHome();

                notif.data('previousValue', notif.val());
                notif.addClass("loading");
                $.ajax({
                    type: 'POST',
                    url: this.element.data('url'),
                    data: {
                        notification: notif.val(),
                        'in-home': inHome.is(':checked') ? '1' : '0'
                    },
                    success: function (data, textStatus, jqXHR)
                    {
                        if (data.status !== "success") {
                            notif.val(notif.data('previousValue'));
                        }
                        notif.removeClass("loading");
                        var infos = $(".indicateur-info", notif.parent()).attr('title', data.infos).tooltip('destroy').tooltip();
                        notif.val() ? infos.show() : infos.hide();
                        alertFlash(data.message, data.status, 5000);
                    }
                });
            },

            getElementNotif: function () { return this.element.find('select.notif'); },
            getElementInHome: function () { return this.element.find('input.in-home'); }

        });

    });


</script>
+37 −0
Changes for public/css/app.css: 37 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -845,3 +845,40 @@ form.statut fieldset legend {
    font-size: 12px;
    font-weight: 700;
}







.indicateurs table td.numero {
    width: 5em;
    text-align: center;
}

.indicateurs table th.numero {
    width: 5em;
    text-align: center;
}

.indicateurs .notification {
    width: 12em;
}

.indicateurs .page-accueil {
    width: 2em;
    text-align:center;
}

.indicateurs-result {
    margin-bottom: 1em;
}

.indicateurs-result table {
    margin-bottom: 0px;
}

.indicateurs-result table .cc {
    width: 2em;
}
 No newline at end of file

public/css/indicateur.css

deleted100755 → 0
+0 −31
Changes for public/css/indicateur.css: 0 added lines, 31 removed lines.
Original line number Diff line number Diff line

.indicateurs table td.numero {
    width: 5em;
    text-align: center;
}

.indicateurs table th.numero {
    width: 5em;
    text-align: center;
}

.indicateurs .notification {
    width: 12em;
}

.indicateurs .page-accueil {
    width: 2em;
    text-align:center;
}

.indicateurs-result {
    margin-bottom: 1em;
}

.indicateurs-result table {
    margin-bottom: 0px;
}

.indicateurs-result table .cc {
    width: 2em;
}
 No newline at end of file
+0 −5
Changes for public/js/app.js: 0 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -86,11 +86,6 @@ $(function ()
        WidgetInitializer.includeCss(Url('css/service.css'));
    });

    /* Indicateurs */
    WidgetInitializer.add('indicateur', 'indicateur', function () {
        WidgetInitializer.includeJs(Url('js/indicateur.js'));
        WidgetInitializer.includeCss(Url('css/indicateur.css'));
    });

    /* Pièces jointes */
    //  WidgetInitializer.add('piece-jointe', 'pieceJointe', function(){

public/js/indicateur.js

deleted100755 → 0
+0 −46
Changes for public/js/indicateur.js: 0 added lines, 46 removed lines.
Original line number Diff line number Diff line
$.widget("ose.indicateur", {

    _create: function ()
    {
        var that = this;

        this.getElementNotif().change( function(){ that.abonner(); });
        this.getElementInHome().change( function(){ that.abonner(); });

        this.element.find(".glyphicon.glyphicon-info-sign").tooltip();
    },


    abonner: function()
    {
        var that = this;
        var notif = this.getElementNotif();
        var inHome = this.getElementInHome();

        notif.data('previousValue', notif.val());
        notif.addClass("loading");
        $.ajax({
            type: 'POST',
            url: this.element.data('url'),
            data: {
                notification: notif.val(),
                'in-home': inHome.is(':checked') ? '1' : '0'
            },
            success: function (data, textStatus, jqXHR)
            {
                if (data.status !== "success") {
                    notif.val(notif.data('previousValue'));
                }
                notif.removeClass("loading");
                var infos = $(".indicateur-info", notif.parent()).attr('title', data.infos).tooltip('destroy').tooltip();
                notif.val() ? infos.show() : infos.hide();
                alertFlash(data.message, data.status, 5000);
            }
        });
    },

    getElementNotif: function(){ return this.element.find('select.notif'); },
    getElementInHome: function(){ return this.element.find('input.in-home'); }

});