Commit 107b4cd0 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Amélioration du TabAjax : possibilité de fournir un tab par défaut et il se...

Amélioration du TabAjax : possibilité de fournir un tab par défaut et il se charge tout seul en AJAX si son contenu n'était pas initialisé.
parent 35fe2ffe
Loading
Loading
Loading
Loading
Loading
+4
Changes for CHANGELOG.md: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
CHANGELOG
=========
3.1.10 (17/06/2020)
-------------------
Amélioration du TabAjax : possibilité de fournir un tab par défaut et il se charge tout seul en AJAX si son contenu n'était pas initialisé.

3.1.9 (17/06/2020)
------------------
Correction de bug : ne pas prendre ne compte l'option label_options pour le Bootstrap DateTimePicker
+x+19 −1
Changes for public/unicaen/app/js/unicaen.js: 19 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -855,16 +855,34 @@ $.widget("unicaen.tabAjax", {
        return this;
    },

    _create: function ()
    getContent: function(tab)
    {
        var that = this;

        tab = this.getTab(tab);
        tid = tab.attr('data-target');
        return that.element.find(".tab-pane" + tid).html();
    },

    getSelected: function()
    {
        var sel = this.element.find('.tab-pane.active').attr('id');

        return sel;
    },

    _create: function ()
    {
        var that = this;
        this.element.find('.nav-tabs a').on('click', function (e)
        {
            e.preventDefault();
            that.select($(this));
            return false;
        });
        if (!that.getContent(that.getSelected())){
            that.select(that.getSelected());
        }
    },

});
+5 −1
Changes for src/UnicaenApp/View/Helper/TabAjax/TabAjaxViewHelper.php: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -186,13 +186,17 @@ class TabAjaxViewHelper extends AbstractHtmlElement
     *
     * @return self
     */
    public function __invoke( $tabs=null )
    public function __invoke( $tabs=null, $selected=null )
    {
        if (is_array($tabs)){
            foreach( $tabs as $tab ){
                $this->addTab($tab);
            }
        }
        if ($selected){
            $this->setSelected($selected);
        }

        return $this;
    }