Commit 12cee8a6 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Ajustement mise en page plus compacte

parent c511c5d4
Loading
Loading
Loading
Loading
Loading
+86 −84
Original line number Diff line number Diff line
@@ -6,24 +6,26 @@ use UnicaenPrivilege\Form\Privilege\CategorieFiltreForm;
use UnicaenPrivilege\Provider\Privilege\PrivilegePrivileges;

/**
 * @var string $title
 * @var RoleInterface[] $roles
 * @var array $privilegesByCategorie
 * @var CategorieFiltreForm $form
 * @var ?string $gestion
 *
 * @see AdministrationController::privilegeAction()
 * @see PrivilegeController::indexAction()
 */
?>

<?php $this->headTitle($this->translate($title)) ?>
$this->headTitle("Gestion des privilèges");
?>

<h1 class="page-header">
    <?php echo $title; ?>
    Gestion des privilèges
</h1>

<?php echo $this->messenger()->addMessagesFromFlashMessenger(); ?>


<?php if ($gestion === null or $gestion !== 'off') : ?>
    <div class="row mb-3">
        <div class="col-md-12">
            <?php /** @see PrivilegeCategorieController::indexAction() */ ?>
@@ -34,11 +36,15 @@ use UnicaenPrivilege\Provider\Privilege\PrivilegePrivileges;
            </a>
        </div>
    </div>
<?php endif; ?>


<div class="card border-default mb-3">
<?php if ($form !== null) : ?>
    <div class="card ">
        <div class="card-header bg-default">
        <h2>Filtrer les privilèges</h2>
            <h2>
                <span class="icon icon-filtrer"></span>
                Filtrer les privilèges
            </h2>
        </div>
        <div class="card-body">
            <?php echo $this->form()->openTag($form->prepare()); ?>
@@ -57,26 +63,24 @@ use UnicaenPrivilege\Provider\Privilege\PrivilegePrivileges;
            <?php echo $this->form()->closeTag(); ?>
        </div>
    </div>
<?php endif; ?>


<div class="card border-default mb-3">
    <div class="card-header bg-default">
        <h2>
           Priviléges attribués
        </h2>
    </div>
    <div class="card-body">
<table id="privilege-liste" class="table table-hover table-condensed table-header-rotated">
            <thead>
            <tr>
                <th></th>
            <?php $first = true; foreach( $roles as $role ):?>
                <th class="rotate-45" title="<?php echo $role; ?>"><div<?php if ($first) echo ' class="first"'; ?>><span><?php echo $role; ?></span></div></th>
                <?php $first = true;
                foreach ($roles as $role): ?>
                    <th class="rotate-45" title="<?php echo $role; ?>">
                        <div<?php if ($first) echo ' class="first"'; ?>><span><?php echo $role; ?></span></div>
                    </th>
                    <?php $first = false; endforeach; ?>
                <th></th>
            </tr>
            <tr>
            <th>Privilèges <i title="Afficher / Masquer tous les privilèges" class="hide-privileges fas fa-caret-square-down"></i></th>
                <th>Privilèges <i title="Afficher / Masquer tous les privilèges"
                                  class="hide-privileges fas fa-caret-square-down"></i></th>
                <th colspan="<?php echo count($roles); ?>">Rôles</th>
                <th style="min-width:166px"></th>
            </tr>
@@ -85,7 +89,8 @@ use UnicaenPrivilege\Provider\Privilege\PrivilegePrivileges;
            <?php foreach ($privilegesByCategorie as $libelleCategorie => $privileges) : ?>
                <tr>
                    <th id="<?php echo current($privileges)->getCategorie()->getId(); ?>" class="categorie"
                colspan="<?php echo 1 + count($roles); ?>"><?php echo $libelleCategorie; ?> <i class="fas fa-caret-square-down text-muted"></i></th>
                        colspan="<?php echo 1 + count($roles); ?>"><?php echo $libelleCategorie; ?> <i
                                class="fas fa-caret-square-down text-muted"></i></th>
                </tr>
                <?php /** @var PrivilegeInterface $privilege */ ?>
                <?php foreach ($privileges as $privilege) : ?>
@@ -101,8 +106,6 @@ use UnicaenPrivilege\Provider\Privilege\PrivilegePrivileges;
            <?php endforeach; ?>
            </tbody>
        </table>
    </div>
</div>

<style>
    .table-header-rotated th.rotate-45 {
@@ -111,6 +114,7 @@ use UnicaenPrivilege\Provider\Privilege\PrivilegePrivileges;
        padding: 0;
        white-space: nowrap;
    }

    .table-header-rotated th.rotate-45 > div {
        position: relative;
        top: 0;
@@ -121,9 +125,11 @@ use UnicaenPrivilege\Provider\Privilege\PrivilegePrivileges;
        border-right: 1px solid #ddd;
        z-index: 99;
    }

    .table-header-rotated th.rotate-45 > div.first {
        border-left: 1px solid #ddd;
    }

    .table-header-rotated th.rotate-45 span {
        transform: skew(40deg, 0deg) rotate(310deg);
        position: absolute;
@@ -171,15 +177,13 @@ use UnicaenPrivilege\Provider\Privilege\PrivilegePrivileges;
            });
        });

        $("i.hide-privileges").click(function ()
        {
        $("i.hide-privileges").click(function () {
            if ($(this).hasClass('fa-caret-square-down')) {
                $("tr.privilege").hide();
                $(this)
                    .removeClass('fa-caret-square-down')
                    .addClass('fa-caret-square-up')
            }
            else {
            } else {
                $("tr.privilege").show();
                $(this)
                    .removeClass('fa-caret-square-up')
@@ -187,16 +191,14 @@ use UnicaenPrivilege\Provider\Privilege\PrivilegePrivileges;
            }
        });

        $("th.categorie > i").click(function ()
        {
        $("th.categorie > i").click(function () {
            let categorieId = $(this).parent().attr("id");
            $("tr.categorie-id-" + categorieId).toggle();
            if ($(this).hasClass('fa-caret-square-down')) {
                $(this)
                    .removeClass('fa-caret-square-down')
                    .addClass('fa-caret-square-up')
            }
            else {
            } else {
                $(this)
                    .removeClass('fa-caret-square-up')
                    .addClass('fa-caret-square-down')