Commit 94fc00a8dbf82c513d2de85d38b8968e732004c1

Authored by Eugeny Galkovskiy
1 parent 502affc2

main page + carousel + contacts

common/models/Carousel.php 0 → 100644
  1 +<?php
  2 +/**
  3 + * @link http://www.yiiframework.com/
  4 + * @copyright Copyright (c) 2008 Yii Software LLC
  5 + * @license http://www.yiiframework.com/license/
  6 + */
  7 +
  8 +namespace common\models;
  9 +
  10 +use yii\base\InvalidConfigException;
  11 +use yii\helpers\ArrayHelper;
  12 +
  13 +/**
  14 + * Carousel renders a carousel bootstrap javascript component.
  15 + *
  16 + * For example:
  17 + *
  18 + * ```php
  19 + * echo Carousel::widget([
  20 + * 'items' => [
  21 + * // the item contains only the image
  22 + * '<img src="http://twitter.github.io/bootstrap/assets/img/bootstrap-mdo-sfmoma-01.jpg"/>',
  23 + * // equivalent to the above
  24 + * ['content' => '<img src="http://twitter.github.io/bootstrap/assets/img/bootstrap-mdo-sfmoma-02.jpg"/>'],
  25 + * // the item contains both the image and the caption
  26 + * [
  27 + * 'content' => '<img src="http://twitter.github.io/bootstrap/assets/img/bootstrap-mdo-sfmoma-03.jpg"/>',
  28 + * 'caption' => '<h4>This is title</h4><p>This is the caption text</p>',
  29 + * 'options' => [...],
  30 + * ],
  31 + * ]
  32 + * ]);
  33 + * ```
  34 + *
  35 + * @see http://getbootstrap.com/javascript/#carousel
  36 + * @author Antonio Ramirez <amigo.cobos@gmail.com>
  37 + * @since 2.0
  38 + */
  39 +class Carousel extends \yii\bootstrap\Widget
  40 +{
  41 + /**
  42 + * @var array|boolean the labels for the previous and the next control buttons.
  43 + * If false, it means the previous and the next control buttons should not be displayed.
  44 + */
  45 + public $controls = ['<i class="fa fa-angle-left" aria-hidden="true"></i>', '<i class="fa fa-angle-right" aria-hidden="true"></i>'];
  46 + /**
  47 + * @var boolean
  48 + * If false carousel indicators (<ol> tag with anchors to items) should not be displayed.
  49 + */
  50 + public $showIndicators = false;
  51 + /**
  52 + * @var array list of slides in the carousel. Each array element represents a single
  53 + * slide with the following structure:
  54 + *
  55 + * ```php
  56 + * [
  57 + * // required, slide content (HTML), such as an image tag
  58 + * 'content' => '<img src="http://twitter.github.io/bootstrap/assets/img/bootstrap-mdo-sfmoma-01.jpg"/>',
  59 + * // optional, the caption (HTML) of the slide
  60 + * 'caption' => '<h4>This is title</h4><p>This is the caption text</p>',
  61 + * // optional the HTML attributes of the slide container
  62 + * 'options' => [],
  63 + * ]
  64 + * ```
  65 + */
  66 + public $items = [];
  67 +
  68 +
  69 + /**
  70 + * Initializes the widget.
  71 + */
  72 + public function init()
  73 + {
  74 + parent::init();
  75 + \yii\bootstrap\Html::addCssClass($this->options, ['widget' => 'carousel']);
  76 + }
  77 +
  78 + /**
  79 + * Renders the widget.
  80 + */
  81 + public function run()
  82 + {
  83 + $this->registerPlugin('carousel');
  84 + return implode("\n", [
  85 + \yii\bootstrap\Html::beginTag('div', $this->options),
  86 + $this->renderIndicators(),
  87 + $this->renderItems(),
  88 + $this->renderControls(),
  89 + \yii\bootstrap\Html::endTag('div')
  90 + ]) . "\n";
  91 + }
  92 +
  93 + /**
  94 + * Renders carousel indicators.
  95 + * @return string the rendering result
  96 + */
  97 + public function renderIndicators()
  98 + {
  99 + if ($this->showIndicators === false) {
  100 + return '';
  101 + }
  102 + $indicators = [];
  103 + for ($i = 0, $count = count($this->items); $i < $count; $i++) {
  104 + $options = ['data-target' => '#' . $this->options['id'], 'data-slide-to' => $i];
  105 + if ($i === 0) {
  106 + \yii\bootstrap\Html::addCssClass($options, 'active');
  107 + }
  108 + $indicators[] = Html::tag('li', '', $options);
  109 + }
  110 +
  111 + return \yii\bootstrap\Html::tag('ol', implode("\n", $indicators), ['class' => 'carousel-indicators']);
  112 + }
  113 +
  114 + /**
  115 + * Renders carousel items as specified on [[items]].
  116 + * @return string the rendering result
  117 + */
  118 + public function renderItems()
  119 + {
  120 + $items = [];
  121 + for ($i = 0, $count = count($this->items); $i < $count; $i++) {
  122 + $items[] = $this->renderItem($this->items[$i], $i);
  123 + }
  124 +
  125 + return \yii\bootstrap\Html::tag('div', implode("\n", $items), ['class' => 'carousel-inner']);
  126 + }
  127 +
  128 + /**
  129 + * Renders a single carousel item
  130 + * @param string|array $item a single item from [[items]]
  131 + * @param int $index the item index as the first item should be set to `active`
  132 + * @return string the rendering result
  133 + * @throws InvalidConfigException if the item is invalid
  134 + */
  135 + public function renderItem($item, $index)
  136 + {
  137 + if (is_string($item)) {
  138 + $content = $item;
  139 + $caption = null;
  140 + $options = [];
  141 + } elseif (isset($item['content'])) {
  142 + $content = $item['content'];
  143 + $caption = ArrayHelper::getValue($item, 'caption');
  144 + if ($caption !== null) {
  145 + $caption = \yii\bootstrap\Html::tag('div', $caption, ['class' => 'carousel-caption']);
  146 + }
  147 + $options = ArrayHelper::getValue($item, 'options', []);
  148 + } else {
  149 + throw new InvalidConfigException('The "content" option is required.');
  150 + }
  151 +
  152 + \yii\bootstrap\Html::addCssClass($options, ['widget' => 'item']);
  153 + if ($index === 0) {
  154 + \yii\bootstrap\Html::addCssClass($options, 'active');
  155 + }
  156 +
  157 + return \yii\bootstrap\Html::tag('div', $content . "\n" . $caption, $options);
  158 + }
  159 +
  160 + /**
  161 + * Renders previous and next control buttons.
  162 + * @throws InvalidConfigException if [[controls]] is invalid.
  163 + */
  164 + public function renderControls()
  165 + {
  166 + if (isset($this->controls[0], $this->controls[1])) {
  167 + return \yii\bootstrap\Html::a($this->controls[0], '#' . $this->options['id'], [
  168 + 'class' => 'left carousel-control',
  169 + 'data-slide' => 'prev',
  170 + ]) . "\n"
  171 + . \yii\bootstrap\Html::a($this->controls[1], '#' . $this->options['id'], [
  172 + 'class' => 'right carousel-control',
  173 + 'data-slide' => 'next',
  174 + ]);
  175 + } elseif ($this->controls === false) {
  176 + return '';
  177 + } else {
  178 + throw new InvalidConfigException('The "controls" property must be either false or an array of two elements.');
  179 + }
  180 + }
  181 +}
... ...
frontend/views/layouts/main.php
... ... @@ -453,7 +453,7 @@ _________________________________________________________ --&gt;
453 453  
454 454 <footer id="footer">
455 455 <div class="container">
456   - <div class="col-md-4 col-sm-12">
  456 + <div class="col-md-5 col-sm-12">
457 457 <?php
458 458 if (!empty($settings->about)) {
459 459 ?>
... ... @@ -463,9 +463,13 @@ _________________________________________________________ --&gt;
463 463 }
464 464 ?>
465 465 <a href="#" class="btn btn-template-transparent-primary" data-toggle="modal" data-target="#feedback-modal"><?php echo \Yii::t('app', 'Contact us'); ?></a>
  466 + <div class="bottom-text-in hidden-sm hidden-xs">
  467 + <p class="pull-left">&copy; <?= date('Y') ?>. <?= $settings->name; ?>. Все права защищены.<br />
  468 + Использование материалов сайта возможно только со ссылкой на источник.</p>
  469 + </div>
466 470 </div>
467 471  
468   - <div class="col-md-5 col-sm-12">
  472 + <div class="col-md-4 col-sm-12">
469 473  
470 474 <h4><?php echo \Yii::t('app', 'Contact'); ?></h4>
471 475  
... ... @@ -523,7 +527,7 @@ _________________________________________________________ --&gt;
523 527 </div>
524 528  
525 529  
526   - <div class="col-md-12 bottom-text">
  530 + <div class="col-md-12 bottom-text hidden-md hidden-lg">
527 531 <p class="pull-left">&copy; <?= date('Y') ?>. <?= $settings->name; ?>. Все права защищены.<br />
528 532 Использование материалов сайта возможно только со ссылкой на источник.</p>
529 533 </div>
... ...
frontend/views/site/contact.php
... ... @@ -35,12 +35,10 @@ JS;
35 35 <div class="col-md-12">
36 36 <section>
37 37 <div class="heading">
38   - <h2>We are here to help you</h2>
  38 + <h2>Как нас найти</h2>
39 39 </div>
40 40  
41   - <p class="lead">Are you curious about something? Do you have some kind of problem with our products? As am hastily invited settled at limited civilly fortune me. Really spring in extent an by. Judge but built gay party world. Of so am
42   - he remember although required. Bachelor unpacked be advanced at. Confined in declared marianne is vicinity.</p>
43   - <p>Please feel free to contact us, our customer service center is working for you 24/7.</p>
  41 + <p class="lead">Наш офис находится в Дарницком районе, по ул. Н. Бажана 1-М. По всем возникшим вопросам обращайтесь по телефону, даже в таком режиме наш разговор будет намного продуктивнее чем просто письма.</p>
44 42 </section>
45 43 </div>
46 44 </div>
... ... @@ -54,7 +52,7 @@ JS;
54 52 <div class="icon">
55 53 <i class="fa fa-map-marker"></i>
56 54 </div>
57   - <h3>Address</h3>
  55 + <h3>Адрес</h3>
58 56 <p>
59 57 <?php
60 58 if (!empty( $settings->street )) {
... ... @@ -85,8 +83,8 @@ JS;
85 83 <div class="icon">
86 84 <i class="fa fa-phone"></i>
87 85 </div>
88   - <h3> Call center </h3>
89   - <p class="text-muted"> This number is toll free if calling from Great Britain otherwise we advise you to use the electronic form of communication .</p>
  86 + <h3> Телефон </h3>
  87 + <p class="text-muted"> Контактный телефон</p>
90 88 <p>
91 89 <?php
92 90 echo Html::a(Html::tag('strong', $settings->phone), 'tel:' . $settings->phone);
... ... @@ -108,8 +106,7 @@ JS;
108 106 <div class="icon">
109 107 <i class="fa fa-envelope"></i>
110 108 </div>
111   - <h3> Electronic support </h3>
112   - <p class="text-muted"> Please feel free to write an email to us or to use our electronic ticketing system .</p>
  109 + <h3> Электронная почта </h3>
113 110 <ul class="list-style-none">
114 111 <li>
115 112 <?php
... ... @@ -136,7 +133,7 @@ JS;
136 133  
137 134 <div class="col-md-12">
138 135 <div class="heading">
139   - <h2> Contact form </h2>
  136 + <h2> Связаться с нами </h2>
140 137 </div>
141 138 </div>
142 139  
... ... @@ -151,16 +148,16 @@ JS;
151 148 <div class="row">
152 149 <div class="col-sm-12">
153 150 <?= $form->field($contact, 'name')
154   - ->textInput(); ?>
  151 + ->textInput()->label('Имя'); ?>
155 152 </div>
156 153  
157 154 <div class="col-sm-6">
158 155 <?= $form->field($contact, 'email')
159   - ->textInput(); ?>
  156 + ->textInput()->label('Email'); ?>
160 157 </div>
161 158 <div class="col-sm-6">
162 159 <?= $form->field($contact, 'phone')
163   - ->textInput(); ?>
  160 + ->textInput()->label('Тема'); ?>
164 161 </div>
165 162 <div class="col-sm-12">
166 163 <?= $form->field($contact, 'message')
... ... @@ -168,12 +165,12 @@ JS;
168 165 [
169 166 'rows' => 3,
170 167 ]
171   - ); ?>
  168 + )->label('Сообщение'); ?>
172 169 </div>
173 170  
174 171 <div class="col-sm-12 text-center">
175 172 <?= Html::submitButton(
176   - '<i class="fa fa-envelope-o"></i> Send message',
  173 + '<i class="fa fa-envelope-o"></i> Отправить сообщение',
177 174 [
178 175 'class' => 'btn btn-template-main',
179 176 ]
... ... @@ -194,7 +191,16 @@ JS;
194 191 <!-- /#contact.container -->
195 192 </div>
196 193 <!-- /#content -->
197   -
  194 +<div id="get-it">
  195 + <div class="container">
  196 + <div class="col-md-8 col-sm-12">
  197 + <h3>ХОТИТЕ ЗАКАЗАТЬ ОБРАТНЫЙ ЗВОНОК?</h3>
  198 + </div>
  199 + <div class="col-md-4 col-sm-12">
  200 + <a href="#" class="btn btn-template-transparent-primary" data-toggle="modal" data-target="#feedback-modal">Позвоните мне</a>
  201 + </div>
  202 + </div>
  203 +</div>
198 204 <div id="map">
199 205  
200 206 </div>
201 207 \ No newline at end of file
... ...
frontend/views/site/index.php
... ... @@ -31,21 +31,24 @@ $this-&gt;registerJs($js, View::POS_END);
31 31 $slideItems[] = $slide->lang->image->getImg();
32 32 }
33 33 }
34   - echo \yii\bootstrap\Carousel::widget(
  34 + echo \common\models\Carousel::widget(
35 35 [
36 36 'items' => $slideItems
37 37 ]
38 38 );
39 39 ?>
  40 + <div class="box-simple">
  41 + <a href="#" class="btn button1 icon_phone modaled init-button-consultation" data-title="Заказать консультацию" data-toggle="modal" data-target="#feedback-modal">Получить <span>консультацию специалиста</span></a>
  42 + </div>
40 43 <!-- тут место для слайдера -->
41 44 </section>
42 45  
43 46 <section class="blue-fon why-us-wr no-mg">
44 47 <div class="container">
45   - <div class="heading text-left">
  48 + <div class="heading text-center">
46 49 <h2 class="big-text">Почему мы</h2>
47 50 </div>
48   - <div class="why-us row">
  51 + <div class="why-us container">
49 52 <div class="col-md-12 row">
50 53 <div class="col-xs-12 col-sm-4">
51 54 <div class="box-simple">
... ... @@ -109,7 +112,7 @@ $this-&gt;registerJs($js, View::POS_END);
109 112 <section class="bar background-white objects-main-wr">
110 113 <div class="container">
111 114 <div class="col-md-12">
112   - <div class="heading text-left">
  115 + <div class="heading text-center">
113 116 <h2>Наши объекты</h2>
114 117 </div>
115 118  
... ... @@ -219,7 +222,7 @@ $this-&gt;registerJs($js, View::POS_END);
219 222 </section>
220 223 <section class="blue-fon no-mg economy-wr">
221 224 <div class="container">
222   - <div class="heading text-left">
  225 + <div class="heading text-center">
223 226 <h2 class="big-text">Как заказать электростанцию <br/>и начать экономить уже сегодня?</h2>
224 227 </div>
225 228 <div class="row">
... ... @@ -285,7 +288,7 @@ $this-&gt;registerJs($js, View::POS_END);
285 288 </section>
286 289 <section class="bar background-white no-mg">
287 290 <div class="container">
288   - <div class="heading text-left">
  291 + <div class="heading text-center">
289 292 <h2>СМИ о нас</h2>
290 293 </div>
291 294 <div class="about row">
... ...
frontend/web/css/main.css
... ... @@ -368,17 +368,15 @@ footer .social-logos a:hover {
368 368 position: relative;
369 369 height: 100%;
370 370 }
371   -.carousel-control{
  371 +.carousel-control {
372 372 display: flex;
373 373 justify-content: center;
374 374 align-items: center;
375   - font-size: 11.5vw;
376   -}
377   -.economy-wr h2.big-text{
378   - text-align: center;
379   - width: 100%;
380   - border: none;
  375 + font-size: 7.5vw;
  376 + width:20%;
381 377 }
  378 +#get-it {padding: 30px 0 10px;}
  379 +#main-page .blue-fon .heading h2{border:none;}
382 380 .main-slider .carousel-inner, .main-slider .carousel-inner > .item {height:100%;width:100%;position:relative;}
383 381 .main-slider .img-responsive, .thumbnail > img, .main-slider .thumbnail a > img, .carousel-inner > .item > img, .main-slider .carousel-inner > .item > a > img {
384 382 width: 100%;
... ... @@ -391,10 +389,31 @@ footer .social-logos a:hover {
391 389 font-size: 12px;
392 390 padding-bottom: 0;
393 391 }
  392 +.bottom-text-in{
  393 + font-size: 12px;
  394 + position: absolute;
  395 + bottom: -72px;
  396 +}
394 397 #map {
395 398 height: 560px;
396 399 background-image: url(../img/map.jpg);
397 400 }
  401 +.main-slider .carousel-control{
  402 + background:none!important;
  403 +}
  404 +#main-page .main-slider .box-simple{
  405 + position: absolute;
  406 + width: 100%;
  407 + bottom: 0;
  408 +}
  409 +#main-page .main-slider .box-simple .button1{
  410 + width: 235px;
  411 + padding: 8px 0;
  412 + padding-top: 10px;
  413 + font-size: 13px;
  414 + background-size: 9%;
  415 + padding-left: 30px;
  416 +}
398 417  
399 418 @media(min-width:992px) and (max-width:1199px){
400 419 .pr_cover {
... ...