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

unicaen etat : badge quand etat === null

parent 389baa96
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
namespace UnicaenEtat\View\Helper;

use Application\View\Renderer\PhpRenderer;
use UnicaenEtat\Entity\Db\EtatType;
use UnicaenEtat\Entity\Db\Etat;
use Zend\View\Helper\AbstractHelper;
use Zend\View\Helper\Partial;
use Zend\View\Resolver\TemplatePathStack;
@@ -11,11 +11,11 @@ use Zend\View\Resolver\TemplatePathStack;
class EtatBadgeViewHelper extends AbstractHelper
{
    /**
     * @param EtatType $etat
     * @param Etat|null $etat
     * @param array $options
     * @return string|Partial
     */
    public function __invoke($etat, $options = [])
    public function __invoke(?Etat $etat, $options = [])
    {
        /** @var PhpRenderer $view */
        $view = $this->getView();
+40 −18
Original line number Diff line number Diff line
@@ -9,6 +9,27 @@ use UnicaenEtat\Entity\Db\Etat;

?>

<?php if ($etat === null) : ?>
    <span class="label leftpart" title="État inconnu">
            <i class="fa fa-question-circle" aria-hidden="true"></i>
        </span>
    <span class="label rightpart" title="Type inconnu">
            <i class="fa fa-question-circle" aria-hidden="true"></i>
        </span>

    <style>
        .leftpart {
            background: #8e7c7c;
            position:relative;
            left:0.5rem;
        }
        .rightpart {
            position:relative;
            left:-0.25rem;
            background: linear-gradient(90deg, transparent 2px, #7f8e7c 0);
        }
    </style>
<?php else : ?>
    <span class="label leftpart<?php echo $etat->getId(); ?>" title="<?php echo $etat->getLibelle(); ?>">
            <i class="<?php echo ($etat->getIcone())?:"fa fa-question-circle"; ?>" aria-hidden="true"></i>
        </span>
@@ -28,3 +49,4 @@ use UnicaenEtat\Entity\Db\Etat;
            background: linear-gradient(90deg, transparent 2px, <?php echo ($etat->getType()->getCouleur())?:"#7f8e7c"; ?> 0);
        }
    </style>
<?php endif; ?>
 No newline at end of file