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.
refactoring
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

@@ -250,23 +250,23 @@ class SiteController extends FrontendController {
$model_signup->id_etablissement = $id;
$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 ($model_login->load(Yii::$app->request->post()) && $model_login->login()) {
Etablissement::addUser(Yii::$app->user->id, $id) ;
$this->redirect($url_redirect);
$this->redirect($return_url);
}

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

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

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

@@ -106,6 +106,12 @@ $producer = $this->context->getProducer() ;
'visible' => !Yii::$app->user->isGuest,
'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',
'url' => Yii::$app->urlManager->createUrl(['commande/historique']),

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

@@ -11,6 +11,10 @@ else
$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">
<?php if(strlen($producer->photo)): ?>
<div class="photo <?= $col_size ?>">
@@ -64,6 +68,15 @@ else
],
'nom',
'description',
[
'attribute' => 'poids',
'value' => function($model) {
if(strlen($model->poids)) {
return $model->poids.'g' ;
}
return '' ;
}
],
],
]); ?>
</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

@@ -354,30 +354,33 @@ ul.pagination li a:hover, ul.pagination li a:focus, ul.pagination li a:active {
background-color: #BB8757;
padding: 10px 20px;
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 {
font-size: 20px;
}
/* line 305, ../sass/_layout.scss */
/* line 309, ../sass/_layout.scss */
#main #content h5 {
font-size: 18px;
}
/* line 309, ../sass/_layout.scss */
/* line 313, ../sass/_layout.scss */
#main #content h6 {
font-size: 16px;
}

/* line 315, ../sass/_layout.scss */
/* line 319, ../sass/_layout.scss */
#footer {
background-color: #BB8757;
height: 100px;
}
/* line 319, ../sass/_layout.scss */
/* line 323, ../sass/_layout.scss */
#footer .container {
padding: 0px;
}
/* line 321, ../sass/_layout.scss */
/* line 325, ../sass/_layout.scss */
#footer .container .overflow {
height: 30px;
background-color: white;
@@ -385,28 +388,33 @@ ul.pagination li a:hover, ul.pagination li a:focus, ul.pagination li a:active {
border-right: solid 1px #e0e0e0;
border-bottom: solid 1px #e0e0e0;
}
/* line 329, ../sass/_layout.scss */
/* line 333, ../sass/_layout.scss */
#footer .container .content {
padding-top: 20px;
color: white;
}
/* line 333, ../sass/_layout.scss */
/* line 337, ../sass/_layout.scss */
#footer .container .content a {
color: white;
text-decoration: underline;
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 {
text-align: center;
}
/* line 6, ../sass/site/_index.scss */
/* line 11, ../sass/site/_index.scss */
.site-index #presentation .photo .img-photo {
width: 100%;
max-width: 500px;
}
/* line 13, ../sass/site/_index.scss */
/* line 18, ../sass/site/_index.scss */
.site-index #produits img.photo-produit {
width: 100px;
height: auto;

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

@@ -295,6 +295,10 @@ ul.pagination {
background-color: $color1 ;
padding: 10px 20px ;
padding-top: 14px ;
background-color: $color2 ;
color: $color1 ;
border: dotted 1px $color1 ;
}
}

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

@@ -1,5 +1,10 @@

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

Loading…
Cancel
Save