Commit 843db6ac authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Correction changement de structure pour un rôle

parent a1ee72fd
Loading
Loading
Loading
Loading
+1 −15
Original line number Diff line number Diff line
@@ -40,24 +40,10 @@ class UserProfileSelectRadioItem extends UnicaenAuthViewHelper
                ->setValueOptions($this->getStructures())
                ->setValue($this->getStructure() ? $this->getStructure()->getId() : null)
                ->setAttribute('class', $selectClass)
                ->setAttribute('onchange', 'Util.userProfileStructureChange(this)')
                ->setAttribute('title', "Cliquez pour sélectionner la structure associée au profil $this->role");

            $html .= ' ' . $this->getView()->formSelect($select);

            $html .= <<<EOS
<script>
    $(function() {
        $("select.$selectClass").tooltip({ delay: 500, placement: 'right' }).change(function() {
            var roleInput = $(this).parent().find('input.user-profile-select-input');
            if (roleInput.attr("checked")) {
                submitProfile();
            }else{
                roleInput.attr("checked", "checked");
            }
        });
    });
</script>
EOS;
        }

        return $html;
+12 −0
Original line number Diff line number Diff line
@@ -311,6 +311,18 @@ Util = {



    userProfileStructureChange: function (select)
    {
        var roleInput = $(select).parent().find('input.user-profile-select-input');
        if (!roleInput.attr("checked")) {
            roleInput.attr("checked", "checked");
        }
        var event = new Event('change', {bubbles: true});
        roleInput[0].dispatchEvent(event);
    },

    

    filterSelectPicker: function (select, values)
    {
        var ul = select.parent().find('ul');