Adaptation du layout au statut connecté / non connecté de l'utilisateur.refactoring
<div class="text"> | <div class="text"> | ||||
<div class="bap">La boîte à pain</div> | <div class="bap">La boîte à pain</div> | ||||
<div class="plateforme">Plateforme de réservation | <div class="plateforme">Plateforme de réservation | ||||
<?php if(YII_ENV == 'dev' || YII_ENV == 'demo'): ?><?php if(YII_ENV == 'dev'): ?>(dév)<?php elseif(YII_ENV == 'demo'): ?>(démo)<?php endif; ?></div><?php endif; ?></div> | |||||
<?php if(YII_ENV == 'dev' || YII_ENV == 'demo'): ?><?php if(YII_ENV == 'dev'): ?>(dév)<?php elseif(YII_ENV == 'demo'): ?>(démo)<?php endif; ?><?php endif; ?></div> | |||||
</div> | </div> | ||||
</a> | </a> | ||||
public $css = []; | public $css = []; | ||||
public $js = []; | public $js = []; | ||||
public $depends = [ | public $depends = [ | ||||
'yii\web\YiiAsset', | |||||
'yii\bootstrap\BootstrapAsset', | |||||
]; | ]; | ||||
public function __construct() { | public function __construct() { | ||||
$this->addAsset('css','css/screen.css'); | $this->addAsset('css','css/screen.css'); | ||||
// js | // js | ||||
$this->addAsset('js','js/boulange.js'); | |||||
} | } | ||||
} | } |
<body class=""> | <body class=""> | ||||
<?php $this->beginBody() ?> | <?php $this->beginBody() ?> | ||||
<div id="header-bap"> | |||||
<div class="container"> | |||||
<a id="logo" href="<?= Url::frontend(); ?>"> | |||||
<img class="icon" src="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/laboulange3.png" alt="" /> | |||||
<span class="text">La boîte à pain</span> | |||||
</a> | |||||
<?php | |||||
echo Nav::widget([ | |||||
'encodeLabels' => false, | |||||
'items' => [ | |||||
[ | |||||
'label' => '<span class="glyphicon glyphicon-user"></span> Inscription', | |||||
'url' => Url::frontend('site/signup'), | |||||
'visible' => Yii::$app->user->isGuest | |||||
], | |||||
[ | |||||
'label' => '<span class="glyphicon glyphicon-log-in"></span> Connexion', | |||||
'url' => Url::frontend('site/login'), | |||||
'visible' => Yii::$app->user->isGuest | |||||
], | |||||
[ | |||||
'label' => '<span class="glyphicon glyphicon-user"></span> '.((!Yii::$app->user->isGuest) ? Html::encode(Yii::$app->user->identity->prenom .' '.strtoupper(substr(Yii::$app->user->identity->nom, 0, 1))) : '').'. ', | |||||
'options' => ['id' => 'label1'], | |||||
'url' => '#', | |||||
'items' => [ | |||||
[ | |||||
'label' => 'Profil', | |||||
'url' => Url::frontend('user/update'), | |||||
], | |||||
[ | |||||
'label' => '<span class="glyphicon glyphicon-off"></span> Déconnexion', | |||||
'url' => Url::frontend('site/logout'), | |||||
] | |||||
], | |||||
'visible' => !Yii::$app->user->isGuest | |||||
], | |||||
], | |||||
'options' => ['id' =>'nav-bap'], | |||||
]); | |||||
?> | |||||
</div> | |||||
</div> | |||||
<header id="header"> | <header id="header"> | ||||
<div class="container"> | <div class="container"> | ||||
<h1><?= Html::encode($producer->nom); ?></h1> | <h1><?= Html::encode($producer->nom); ?></h1> | ||||
<h2>Boulangerie à <?= Html::encode($producer->ville); ?> (<?= Html::encode($producer->code_postal); ?>)</h2> | <h2>Boulangerie à <?= Html::encode($producer->ville); ?> (<?= Html::encode($producer->code_postal); ?>)</h2> | ||||
<div id="credit"><span>Crédit :</span> 31,90 €</div> | |||||
<?php if(!Yii::$app->user->isGuest): ?> | |||||
<?php | |||||
$user_etablissement = UserEtablissement::findOne(['id_user' => Yii::$app->user->identity->id, 'id_etablissement' => $producer->id ]) ; | |||||
if($user_etablissement): | |||||
?> | |||||
<div id="credit"><span>Crédit :</span> <?= number_format($user_etablissement->credit, 2); ?> €</div> | |||||
<?php endif; ?> | |||||
<?php endif; ?> | |||||
</div> | </div> | ||||
</header> | </header> | ||||
<div id="main"> | <div id="main"> | ||||
<div class="container"> | <div class="container"> | ||||
<nav id="main-nav"> | <nav id="main-nav"> | ||||
<a id="user" href="#"><span class="glyphicon glyphicon-user"></span> <span class="caret"></span></a> | |||||
<ul class="nav nav-pills"> | |||||
<li><a href="<?php echo Yii::$app->urlManager->createUrl(['producer/index']); ?>"><span class="glyphicon glyphicon-th-large"></span> Accueil</a></li> | |||||
<li><a href="<?php echo Yii::$app->urlManager->createUrl('commande/index'); ?>"><span class="glyphicon glyphicon-plus"></span> Commander</a></li> | |||||
<li><a href="<?php echo Yii::$app->urlManager->createUrl('producer/index'); ?>"><span class="glyphicon glyphicon-folder-open"></span> Historique</a></li> | |||||
<li><a href="<?php echo Yii::$app->urlManager->createUrl('producer/index'); ?>"><span class="glyphicon glyphicon-euro"></span> Crédit</a></li> | |||||
<li><a href="<?php echo Yii::$app->urlManager->createUrl('producer/index'); ?>"><span class="glyphicon glyphicon-cog"></span> Paramètres</a></li> | |||||
<li><a href="<?php echo Yii::$app->urlManager->createUrl('producer/index'); ?>"><span class="glyphicon glyphicon-envelope"></span> Contact</a></li> | |||||
</ul> | |||||
<?php | |||||
echo Nav::widget([ | |||||
'encodeLabels' => false, | |||||
'options' => ['class' =>'nav nav-pills'], | |||||
'items' => [ | |||||
[ | |||||
'label' => '<span class="glyphicon glyphicon-th-large"></span> Accueil', | |||||
'url' => Yii::$app->urlManager->createUrl(['producer/index']), | |||||
], | |||||
[ | |||||
'label' => '<span class="glyphicon glyphicon-plus"></span> Commander', | |||||
'url' => Yii::$app->urlManager->createUrl(['commande/index']), | |||||
'visible' => !Yii::$app->user->isGuest | |||||
], | |||||
[ | |||||
'label' => '<span class="glyphicon glyphicon-folder-open"></span> Historique', | |||||
'url' => Yii::$app->urlManager->createUrl(['commande/historique']), | |||||
'visible' => !Yii::$app->user->isGuest | |||||
], | |||||
[ | |||||
'label' => '<span class="glyphicon glyphicon-envelope"></span> Contact', | |||||
'url' => Yii::$app->urlManager->createUrl(['producer/contact']), | |||||
], | |||||
], | |||||
]); | |||||
?> | |||||
</nav> | </nav> | ||||
<section id="content"> | <section id="content"> | ||||
<?php if (Yii::$app->session->hasFlash('error')): ?> | <?php if (Yii::$app->session->hasFlash('error')): ?> | ||||
<div class="alert alert-danger" role="alert"> | <div class="alert alert-danger" role="alert"> | ||||
<div class="container"> | <div class="container"> | ||||
<div class="overflow"></div> | <div class="overflow"></div> | ||||
<div class="content"> | <div class="content"> | ||||
<p>Propulsé par <a href="#">La boîte à pain</a></p> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
</footer> | </footer> | ||||
} | } | ||||
/* line 9, ../sass/_layout.scss */ | /* line 9, ../sass/_layout.scss */ | ||||
#header-bap { | |||||
background-color: #F8F1DD; | |||||
padding-top: 7px; | |||||
padding-bottom: 7px; | |||||
} | |||||
/* line 14, ../sass/_layout.scss */ | |||||
#header-bap .container { | |||||
padding-left: 0px; | |||||
padding-right: 0px; | |||||
} | |||||
/* line 19, ../sass/_layout.scss */ | |||||
#header-bap #logo { | |||||
color: black; | |||||
text-decoration: none; | |||||
position: relative; | |||||
top: 3px; | |||||
} | |||||
/* line 25, ../sass/_layout.scss */ | |||||
#header-bap #logo img { | |||||
width: 25px; | |||||
} | |||||
/* line 28, ../sass/_layout.scss */ | |||||
#header-bap #logo .text { | |||||
font-size: 17px; | |||||
font-family: "comfortaalight"; | |||||
position: relative; | |||||
bottom: 6px; | |||||
left: 3px; | |||||
} | |||||
/* line 37, ../sass/_layout.scss */ | |||||
#header-bap ul#nav-bap { | |||||
float: right; | |||||
} | |||||
/* line 40, ../sass/_layout.scss */ | |||||
#header-bap ul#nav-bap li { | |||||
float: right; | |||||
} | |||||
/* line 42, ../sass/_layout.scss */ | |||||
#header-bap ul#nav-bap li a { | |||||
color: black; | |||||
font-size: 15px; | |||||
color: #BB8757; | |||||
} | |||||
/* line 47, ../sass/_layout.scss */ | |||||
#header-bap ul#nav-bap li a:hover, #header-bap ul#nav-bap li a:focus { | |||||
color: #333; | |||||
color: #BB8757; | |||||
background: none; | |||||
} | |||||
/* line 54, ../sass/_layout.scss */ | |||||
#header-bap ul#nav-bap li ul { | |||||
background-color: #F8F1DD; | |||||
border-top: solid 2px #BB8757; | |||||
} | |||||
/* line 58, ../sass/_layout.scss */ | |||||
#header-bap ul#nav-bap li ul li a { | |||||
text-transform: uppercase; | |||||
font-size: 13px; | |||||
} | |||||
/* line 68, ../sass/_layout.scss */ | |||||
#header { | #header { | ||||
background-color: #BB8757; | background-color: #BB8757; | ||||
text-align: center; | text-align: center; | ||||
padding-bottom: 70px; | padding-bottom: 70px; | ||||
border-bottom: solid 1px #e0e0e0; | border-bottom: solid 1px #e0e0e0; | ||||
} | } | ||||
/* line 16, ../sass/_layout.scss */ | |||||
/* line 75, ../sass/_layout.scss */ | |||||
#header .container { | #header .container { | ||||
position: relative; | position: relative; | ||||
} | } | ||||
/* line 20, ../sass/_layout.scss */ | |||||
/* line 79, ../sass/_layout.scss */ | |||||
#header h1, #header h2 { | #header h1, #header h2 { | ||||
color: white; | color: white; | ||||
} | } | ||||
/* line 24, ../sass/_layout.scss */ | |||||
/* line 83, ../sass/_layout.scss */ | |||||
#header h1 { | #header h1 { | ||||
text-transform: uppercase; | text-transform: uppercase; | ||||
font-family: "myriadpro-regular"; | font-family: "myriadpro-regular"; | ||||
padding-bottom: 10px; | padding-bottom: 10px; | ||||
font-weight: bold; | font-weight: bold; | ||||
} | } | ||||
/* line 32, ../sass/_layout.scss */ | |||||
/* line 91, ../sass/_layout.scss */ | |||||
#header h2 { | #header h2 { | ||||
font-family: "myriadpro-it"; | font-family: "myriadpro-it"; | ||||
font-size: 18px; | font-size: 18px; | ||||
} | } | ||||
/* line 37, ../sass/_layout.scss */ | |||||
/* line 96, ../sass/_layout.scss */ | |||||
#header #credit { | #header #credit { | ||||
position: absolute; | position: absolute; | ||||
top: 0px; | top: 0px; | ||||
border-bottom: solid 1px white; | border-bottom: solid 1px white; | ||||
padding: 7px 10px; | padding: 7px 10px; | ||||
} | } | ||||
/* line 46, ../sass/_layout.scss */ | |||||
/* line 105, ../sass/_layout.scss */ | |||||
#header #credit span { | #header #credit span { | ||||
font-family: "myriadpro-light"; | font-family: "myriadpro-light"; | ||||
} | } | ||||
/* line 52, ../sass/_layout.scss */ | |||||
/* line 111, ../sass/_layout.scss */ | |||||
#main { | #main { | ||||
background-color: #FAFAFA; | |||||
background-color: #F8F1DD; | |||||
} | } | ||||
/* line 55, ../sass/_layout.scss */ | |||||
/* line 114, ../sass/_layout.scss */ | |||||
#main #main-nav { | #main #main-nav { | ||||
width: 100%; | width: 100%; | ||||
position: relative; | position: relative; | ||||
background-color: white; | background-color: white; | ||||
border-bottom: solid 1px #e0e0e0; | border-bottom: solid 1px #e0e0e0; | ||||
} | } | ||||
/* line 64, ../sass/_layout.scss */ | |||||
/* line 123, ../sass/_layout.scss */ | |||||
#main #main-nav ul li a { | #main #main-nav ul li a { | ||||
color: #BB8757; | color: #BB8757; | ||||
text-transform: uppercase; | text-transform: uppercase; | ||||
font-family: "myriadpro-regular"; | font-family: "myriadpro-regular"; | ||||
border-right: solid 1px #e0e0e0; | border-right: solid 1px #e0e0e0; | ||||
} | } | ||||
/* line 73, ../sass/_layout.scss */ | |||||
/* line 132, ../sass/_layout.scss */ | |||||
#main #main-nav #user { | #main #main-nav #user { | ||||
color: #BB8757; | color: #BB8757; | ||||
float: right; | float: right; | ||||
padding: 10px; | padding: 10px; | ||||
} | } | ||||
/* line 80, ../sass/_layout.scss */ | |||||
/* line 139, ../sass/_layout.scss */ | |||||
#main .container { | #main .container { | ||||
padding: 0px; | padding: 0px; | ||||
background-color: white; | background-color: white; | ||||
border-left: solid 1px #e0e0e0; | border-left: solid 1px #e0e0e0; | ||||
border-right: solid 1px #e0e0e0; | border-right: solid 1px #e0e0e0; | ||||
} | } | ||||
/* line 88, ../sass/_layout.scss */ | |||||
/* line 147, ../sass/_layout.scss */ | |||||
#main #content { | #main #content { | ||||
padding: 0px 20px 20px 20px; | padding: 0px 20px 20px 20px; | ||||
} | } | ||||
/* line 93, ../sass/_layout.scss */ | |||||
/* line 152, ../sass/_layout.scss */ | |||||
#footer { | #footer { | ||||
background-color: #BB8757; | background-color: #BB8757; | ||||
height: 100px; | height: 100px; | ||||
} | } | ||||
/* line 97, ../sass/_layout.scss */ | |||||
/* line 156, ../sass/_layout.scss */ | |||||
#footer .container { | #footer .container { | ||||
padding: 0px; | padding: 0px; | ||||
} | } | ||||
/* line 99, ../sass/_layout.scss */ | |||||
/* line 158, ../sass/_layout.scss */ | |||||
#footer .container .overflow { | #footer .container .overflow { | ||||
height: 30px; | height: 30px; | ||||
background-color: white; | background-color: white; | ||||
border-right: solid 1px #e0e0e0; | border-right: solid 1px #e0e0e0; | ||||
border-bottom: solid 1px #e0e0e0; | border-bottom: solid 1px #e0e0e0; | ||||
} | } | ||||
/* line 107, ../sass/_layout.scss */ | |||||
/* line 166, ../sass/_layout.scss */ | |||||
#footer .container .content { | #footer .container .content { | ||||
padding-top: 20px; | padding-top: 20px; | ||||
color: white; | color: white; | ||||
} | } | ||||
/* line 111, ../sass/_layout.scss */ | |||||
/* line 170, ../sass/_layout.scss */ | |||||
#footer .container .content a { | #footer .container .content a { | ||||
color: white; | color: white; | ||||
text-decoration: underline; | text-decoration: underline; |
$(document).ready(function() | $(document).ready(function() | ||||
{ | { | ||||
producer_dropdown() ; | |||||
boulange_signup() ; | boulange_signup() ; | ||||
boulange_add_boulangerie() ; | boulange_add_boulangerie() ; | ||||
}); | }); | ||||
function producer_dropdown() { | |||||
$(".dropdown-toggle").dropdown(); | |||||
} | |||||
function boulange_scroll(id) { | function boulange_scroll(id) { | ||||
if($("#"+id).size()) | if($("#"+id).size()) | ||||
$('html,body').animate({ | $('html,body').animate({ |
font-family: 'Arial' ; | font-family: 'Arial' ; | ||||
} | } | ||||
#header-bap { | |||||
background-color: $color2 ; | |||||
padding-top: 7px ; | |||||
padding-bottom: 7px ; | |||||
.container { | |||||
padding-left: 0px ; | |||||
padding-right: 0px ; | |||||
} | |||||
#logo { | |||||
color: black ; | |||||
text-decoration: none ; | |||||
position: relative ; | |||||
top: 3px ; | |||||
img { | |||||
width: 25px ; | |||||
} | |||||
.text { | |||||
font-size: 17px ; | |||||
font-family: 'comfortaalight' ; | |||||
position: relative ; | |||||
bottom: 6px ; | |||||
left: 3px ; | |||||
} | |||||
} | |||||
ul#nav-bap { | |||||
float: right ; | |||||
li { | |||||
float: right ; | |||||
a { | |||||
color: black ; | |||||
font-size: 15px ; | |||||
color: $color1 ; | |||||
&:hover, &:focus { | |||||
color: #333 ; | |||||
color: $color1 ; | |||||
background: none ; | |||||
} | |||||
} | |||||
ul { | |||||
background-color: $color2 ; | |||||
border-top: solid 2px $color1 ; | |||||
li { | |||||
a { | |||||
text-transform: uppercase ; | |||||
font-size: 13px ; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
#header { | #header { | ||||
background-color: $color1 ; | background-color: $color1 ; | ||||
text-align: center ; | text-align: center ; | ||||
} | } | ||||
#main { | #main { | ||||
background-color: #FAFAFA ; | |||||
background-color: $color2 ; | |||||
#main-nav { | #main-nav { | ||||
width: 100% ; | width: 100% ; |