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

WIP bootstrap 4 => 5

parent f1decefc
Pipeline #10983 passed with stage
in 22 seconds
......@@ -36,7 +36,7 @@ class UserProfile extends UserAbstract
*/
public function render()
{
$title = _("Profil utilisateur");
$title = _("Rôle utilisateur");
$unknown = _("Inconnu");
$none = _("Aucun");
......
......@@ -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>
$(function() {
$("input.$inputClass").on("change", function() { submitProfile(); }).tooltip({ delay: 500, placement: 'left' });
});
function submitProfile()
{
$js = <<<EOS
$(function() {
$("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;
}
......
......@@ -146,29 +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');
$this->view->inlineScript(HeadScript::SCRIPT, <<<EOS
$js = <<<EOS
$(function() {
/////////////////////// BIEN CHARGÉ MAIS NE FONCTIONNE PAS !!
// const form = $("#$formId");
// form.submit(function() {
// $("body *").css('cursor', 'wait');
// });
// const input = form.find(".user-usurpation-input").on('input', function() {
// updateUsurpationSubmit();
// });
// function updateUsurpationSubmit() {
// form.find(".user-usurpation-submit").prop("disabled", input.val().length === 0);
// }
// updateUsurpationSubmit();
$("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');
});
});
EOS
);
EOS;
$this->view->inlineScript(HeadScript::SCRIPT, $js);
return $html;
}
......@@ -213,6 +214,7 @@ EOS;
$submit = new Submit('submit');
$submit->setValue("Usurper");
$submit->setAttributes([
'disabled' => true,
'class' => 'user-usurpation-submit btn btn-danger',
]);
......
......@@ -14,7 +14,7 @@ $canEdit = $this->isAllowed(Privileges::getResourceId(Privileges::DROIT_PRIVILEG
<a href="javascript:void(0)" data-action="refuser"
title="Privilège '<?php echo $privilege->getCategorie() ?> > '<?php echo $privilege ?>' accordé au rôle '<?php echo $role ?>'. Cliquez pour le retirer.">
<?php endif; ?>
<span class="icon iconly icon-ok text-success"></span>
<span class="icon iconly icon-oui text-success"></span>
<?php if ($canEdit): ?>
</a>
<?php endif; ?>
......@@ -25,7 +25,7 @@ $canEdit = $this->isAllowed(Privileges::getResourceId(Privileges::DROIT_PRIVILEG
<a href="javascript:void(0)" data-action="accorder"
title="Privilège '<?php echo $privilege->getCategorie() ?> > <?php echo $privilege ?>' refusé au rôle '<?php echo $role ?>'. Cliquez pour l'accorder.">
<?php endif; ?>
<span class="icon iconly icon-supprimer text-danger refuse"></span>
<span class="icon iconly icon-non text-danger refuse"></span>
<?php if ($canEdit): ?>
</a>
<?php endif; ?>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment