Browse Source

Bouton Commander

Mise en avant du bouton "Commander" même lorsque l'utilisateur n'est pas connecté.
Si non connecté, mise en place d'un lien vers une page de connexion/inscription avec redirection vers la page de commande.
dev
keun 6 years ago
parent
commit
f4830e99a3
8 changed files with 51 additions and 15 deletions
  1. +4
    -4
      frontend/controllers/SiteController.php
  2. +6
    -0
      producer/views/layouts/main.php
  3. +13
    -0
      producer/views/site/index.php
  4. BIN
      producer/web/.sass-cache/66263a48087a904211dee8da4b068fa8f43a96db/_index.scssc
  5. BIN
      producer/web/.sass-cache/df296f4d5446ec0f190b7ff1f23eb998ea1b56e7/_layout.scssc
  6. +19
    -11
      producer/web/css/screen.css
  7. +4
    -0
      producer/web/sass/_layout.scss
  8. +5
    -0
      producer/web/sass/site/_index.scss

+ 4
- 4
frontend/controllers/SiteController.php View File

$model_signup->id_etablissement = $id; $model_signup->id_etablissement = $id;
$model_signup->option_client_boulanger = 'client'; $model_signup->option_client_boulanger = 'client';
$url_redirect = Yii::$app->urlManagerProducer->createAbsoluteUrl(['site/index','slug_producer' => $etablissement->slug]) ;
$return_url = Yii::$app->request->get('return_url', Yii::$app->urlManagerProducer->createAbsoluteUrl(['site/index','slug_producer' => $etablissement->slug]));
if (Yii::$app->user->isGuest) { if (Yii::$app->user->isGuest) {
if ($model_login->load(Yii::$app->request->post()) && $model_login->login()) { if ($model_login->load(Yii::$app->request->post()) && $model_login->login()) {
Etablissement::addUser(Yii::$app->user->id, $id) ; Etablissement::addUser(Yii::$app->user->id, $id) ;
$this->redirect($url_redirect);
$this->redirect($return_url);
} }


if ($model_signup->load(Yii::$app->request->post())) { if ($model_signup->load(Yii::$app->request->post())) {
if ($user = $model_signup->signup()) { if ($user = $model_signup->signup()) {
if (Yii::$app->getUser()->login($user)) { if (Yii::$app->getUser()->login($user)) {
$this->redirect($url_redirect);
$this->redirect($return_url);
} }
} }
} }
} else { } else {
$this->redirect($url_redirect);
$this->redirect($return_url);
} }


return $this->render('producer', [ return $this->render('producer', [

+ 6
- 0
producer/views/layouts/main.php View File

'visible' => !Yii::$app->user->isGuest, 'visible' => !Yii::$app->user->isGuest,
'active' => $this->getControllerAction() == 'commande/create' || $this->getControllerAction() == 'commande/update', 'active' => $this->getControllerAction() == 'commande/create' || $this->getControllerAction() == 'commande/update',
], ],
[
'label' => '<span class="glyphicon glyphicon-plus"></span> Commander',
'url' => Yii::$app->urlManagerFrontend->createUrl(['site/producer','id' => $this->context->getProducer()->id,'return_url' => Yii::$app->urlManagerProducer->createAbsoluteUrl(['commande/create','slug_producer' => $this->context->getProducer()->slug])]),
'visible' => Yii::$app->user->isGuest,
'active' => $this->getControllerAction() == 'commande/create' || $this->getControllerAction() == 'commande/update',
],
[ [
'label' => '<span class="glyphicon glyphicon-folder-open"></span> Historique', 'label' => '<span class="glyphicon glyphicon-folder-open"></span> Historique',
'url' => Yii::$app->urlManager->createUrl(['commande/historique']), 'url' => Yii::$app->urlManager->createUrl(['commande/historique']),

+ 13
- 0
producer/views/site/index.php View File

$col_size = 'col-md-12' ; $col_size = 'col-md-12' ;
?> ?>


<section id="commander">
<a class="btn btn-primary btn-lg" href="<?php if(Yii::$app->user->isGuest): echo Yii::$app->urlManagerFrontend->createUrl(['site/producer','id' => $this->context->getProducer()->id,'return_url' => Yii::$app->urlManagerProducer->createAbsoluteUrl(['commande/create','slug_producer' => $this->context->getProducer()->slug])]); else: echo Yii::$app->urlManager->createUrl(['commande/create']); endif; ?>"><span class="glyphicon glyphicon-plus"></span> Passer une commande</a>
</section>

<section id="presentation"> <section id="presentation">
<?php if(strlen($producer->photo)): ?> <?php if(strlen($producer->photo)): ?>
<div class="photo <?= $col_size ?>"> <div class="photo <?= $col_size ?>">
], ],
'nom', 'nom',
'description', 'description',
[
'attribute' => 'poids',
'value' => function($model) {
if(strlen($model->poids)) {
return $model->poids.'g' ;
}
return '' ;
}
],
], ],
]); ?> ]); ?>
</section> </section>

BIN
producer/web/.sass-cache/66263a48087a904211dee8da4b068fa8f43a96db/_index.scssc View File


BIN
producer/web/.sass-cache/df296f4d5446ec0f190b7ff1f23eb998ea1b56e7/_layout.scssc View File


+ 19
- 11
producer/web/css/screen.css View File

background-color: #BB8757; background-color: #BB8757;
padding: 10px 20px; padding: 10px 20px;
padding-top: 14px; padding-top: 14px;
background-color: #F8F1DD;
color: #BB8757;
border: dotted 1px #BB8757;
} }
/* line 301, ../sass/_layout.scss */
/* line 305, ../sass/_layout.scss */
#main #content h4 { #main #content h4 {
font-size: 20px; font-size: 20px;
} }
/* line 305, ../sass/_layout.scss */
/* line 309, ../sass/_layout.scss */
#main #content h5 { #main #content h5 {
font-size: 18px; font-size: 18px;
} }
/* line 309, ../sass/_layout.scss */
/* line 313, ../sass/_layout.scss */
#main #content h6 { #main #content h6 {
font-size: 16px; font-size: 16px;
} }


/* line 315, ../sass/_layout.scss */
/* line 319, ../sass/_layout.scss */
#footer { #footer {
background-color: #BB8757; background-color: #BB8757;
height: 100px; height: 100px;
} }
/* line 319, ../sass/_layout.scss */
/* line 323, ../sass/_layout.scss */
#footer .container { #footer .container {
padding: 0px; padding: 0px;
} }
/* line 321, ../sass/_layout.scss */
/* line 325, ../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 329, ../sass/_layout.scss */
/* line 333, ../sass/_layout.scss */
#footer .container .content { #footer .container .content {
padding-top: 20px; padding-top: 20px;
color: white; color: white;
} }
/* line 333, ../sass/_layout.scss */
/* line 337, ../sass/_layout.scss */
#footer .container .content a { #footer .container .content a {
color: white; color: white;
text-decoration: underline; text-decoration: underline;
margin-right: 10px; margin-right: 10px;
} }


/* line 4, ../sass/site/_index.scss */
/* line 3, ../sass/site/_index.scss */
.site-index #commander {
margin-bottom: 40px;
text-align: center;
}
/* line 9, ../sass/site/_index.scss */
.site-index #presentation .photo { .site-index #presentation .photo {
text-align: center; text-align: center;
} }
/* line 6, ../sass/site/_index.scss */
/* line 11, ../sass/site/_index.scss */
.site-index #presentation .photo .img-photo { .site-index #presentation .photo .img-photo {
width: 100%; width: 100%;
max-width: 500px; max-width: 500px;
} }
/* line 13, ../sass/site/_index.scss */
/* line 18, ../sass/site/_index.scss */
.site-index #produits img.photo-produit { .site-index #produits img.photo-produit {
width: 100px; width: 100px;
height: auto; height: auto;

+ 4
- 0
producer/web/sass/_layout.scss View File

background-color: $color1 ; background-color: $color1 ;
padding: 10px 20px ; padding: 10px 20px ;
padding-top: 14px ; padding-top: 14px ;
background-color: $color2 ;
color: $color1 ;
border: dotted 1px $color1 ;
} }
} }

+ 5
- 0
producer/web/sass/site/_index.scss View File



.site-index { .site-index {
#commander {
margin-bottom: 40px ;
text-align: center ;
}
#presentation { #presentation {
.photo { .photo {
text-align: center ; text-align: center ;

Loading…
Cancel
Save