Commit d68c5bac authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

WIP bootstrap 3 => 4

parent 2ca70d49
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ class UserCurrent extends UserAbstract
		            $selectableRoles = $this->getUserContext()->getSelectableIdentityRoles();
                    $role = current($selectableRoles) ?: $this->getUserContext()->getIdentityRole('user');
                }
                $status .= sprintf(", <small class='role-libelle'>%s</small>", !method_exists($role, '__toString') ? $role->getRoleId() : $role);
                $status .= sprintf("<br/><small class='role-libelle'>%s</small>", !method_exists($role, '__toString') ? $role->getRoleId() : $role);
            }
        
            $userProfileHelper = $this->getView()->plugin('userProfile'); /* @var $userProfileHelper UserProfile */
@@ -77,13 +77,13 @@ class UserCurrent extends UserAbstract
        }

        $out = <<<EOS
<a class="navbar-link" 
<a class="navbar-link dropdown-toggle" 
   id="$id" 
   title="$title" 
   data-placement="bottom" 
   data-toggle="popover" 
   data-html="true" 
   data-content="$content" 
   data-bs-placement="bottom" 
   data-bs-toggle="popover" 
   data-bs-html="true" 
   data-bs-content="$content" 
   href="#">$status<span class="caret"></span></a>
EOS;
        $out .= PHP_EOL;
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ class UserProfile extends UserAbstract
     */
    public function render()
    {
        $title   = _("Profil utilisateur");
        $title   = _("Rôle utilisateur");
        $unknown = _("Inconnu");
        $none    = _("Aucun");

+7 −9
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
namespace UnicaenAuth\View\Helper;

use Zend\Permissions\Acl\Role\RoleInterface;
use Zend\View\Helper\HeadScript;

/**
 * Aide de vue permettant à l'utilisateur de sélectionner son profil courant parmi
@@ -79,18 +80,15 @@ class UserProfileSelect extends UserAbstract
        $url = $this->getView()->url('utilisateur/default', ['action' => 'selectionner-profil']);
        $redirectUrl = $this->getView()->url($this->redirectRoute ?: 'home');

        $html .= <<<EOS
<script>
        $js = <<<EOS
$(function() {
        $("input.$inputClass").change(function() { submitProfile(); }).tooltip({ delay: 500, placement: 'left' });
    });
    function submitProfile()
    {
    $("body").on("change", "input.$inputClass", function() {
        $("body *").css('cursor', 'wait');
        $.post("$url", $(".$formClass").serializeArray(), function() { $(location).attr('href', "$redirectUrl"); });
    }
</script>
    });
});
EOS;
        $this->view->inlineScript(HeadScript::SCRIPT, $js);

        return $html;
    }
+21 −15
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ use Zend\Form\Element\Text;
use Zend\Form\Form;
use Zend\Form\View\Helper\Form as FormHelper;
use Zend\Form\View\Helper\FormElement;
use Zend\View\Helper\HeadScript;
use Zend\View\Renderer\PhpRenderer;

/**
@@ -145,26 +146,30 @@ class UserUsurpationHelper extends UserAbstract
        $html = '';
        $html .= $formHelper->openTag($form);
        $html .= "<div><strong>Usurpation d'identité :</strong></div>";
        $html .= $formControlGroupHelper->__invoke($identity);
        $html .= $formControlGroupHelper->__invoke($submit);
        $html .= '<div class="row">' . PHP_EOL;
        $html .= '<div class="col-sm-9">' . $formControlGroupHelper->__invoke($identity) . '</div>' . PHP_EOL;
        $html .= '<div class="col-sm-3">' . $formControlGroupHelper->__invoke($submit) . '</div>' . PHP_EOL;
        $html .= '</div>' . PHP_EOL;
        $html .= $formHelper->closeTag();

        $formId = $form->getAttribute('id');

        $html .= <<<EOS
<script>
    var form = $("#$formId").submit(function() {
        $js = <<<EOS
$(function() {
    $("body")
        .on("input", ".user-usurpation-input", function() {
            const input = $(this);
            const submit = $(".user-usurpation-submit");
            input.val().length > 0 ? 
                submit.prop("disabled", false) : 
                submit.prop("disabled", true);
        })
        .on("submit", "#$formId", function() {
            $("body *").css('cursor', 'wait');
        });
    var input = form.find(".user-usurpation-input").on('input', function() {
        updateUsurpationSubmit();
});
    function updateUsurpationSubmit() {
        form.find(".user-usurpation-submit").prop("disabled", input.val().length === 0);
    }
    updateUsurpationSubmit();
</script>
EOS;
        $this->view->inlineScript(HeadScript::SCRIPT, $js);

        return $html;
    }
@@ -209,6 +214,7 @@ EOS;
        $submit = new Submit('submit');
        $submit->setValue("Usurper");
        $submit->setAttributes([
            'disabled' => true,
            'class' => 'user-usurpation-submit btn btn-danger',
        ]);

+3 −3
Original line number Diff line number Diff line
@@ -28,10 +28,10 @@ use Zend\Form\Form;

<?php if ($messages = $this->flashMessenger('zfcuser-login-form')): ?>
<?php foreach ($messages as $message): ?>
<div class="messenger alert alert-danger ">
    <button type="button" class="close" title="Fermer cette alerte" data-dismiss="alert">×</button>
    <span class="glyphicon glyphicon-warning-sign"></span>
<div class="messenger alert alert-danger alert-dismissible ">
    <span class="icon icon-avertissement"></span>
        <?php echo $message ?> <br>
    <button type="button" class="btn-close" title="Fermer cette alerte" data-bs-dismiss="alert"></button>
</div>
<?php endforeach ?>
<?php endif ?>
Loading