Commit 6c66c02eb1bb9ffff1bc64c33884fc8883573036
1 parent
07a62660
big commti
Showing
7 changed files
with
49 additions
and
59 deletions
Show diff stats
frontend/assets/AppAsset.php
... | ... | @@ -23,8 +23,7 @@ class AppAsset extends AssetBundle |
23 | 23 | 'http://fonts.googleapis.com/css?family=Roboto:400,300,700&subset=latin,cyrillic-ext', |
24 | 24 | ]; |
25 | 25 | public $js = [ |
26 | - //'js/js_head.js', | |
27 | - //'js/js_footer.js', | |
26 | + | |
28 | 27 | '/js/artbox_basket.js', |
29 | 28 | 'js/script.js', |
30 | 29 | 'js/new_script.js', | ... | ... |
frontend/assets/FlipclockAsset.php
... | ... | @@ -23,6 +23,7 @@ class FlipclockAsset extends AssetBundle |
23 | 23 | 'flipclock/compiled/flipclock.min.js' |
24 | 24 | ]; |
25 | 25 | public $jsOptions = array( |
26 | - 'position' => \yii\web\View::POS_END | |
26 | + 'position' => \yii\web\View::POS_END, | |
27 | + 'depends' => ['yii\web\JqueryAsset'] | |
27 | 28 | ); |
28 | 29 | } | ... | ... |
frontend/config/main.php
... | ... | @@ -19,7 +19,13 @@ return [ |
19 | 19 | |
20 | 20 | ], |
21 | 21 | 'components' => [ |
22 | - | |
22 | + 'assetManager' => [ | |
23 | + 'bundles' => [ | |
24 | + 'yii\web\JqueryAsset' =>[ | |
25 | + 'jsOptions' => ['position' => \yii\web\View::POS_END] | |
26 | + ] | |
27 | + ], | |
28 | + ], | |
23 | 29 | 'authManager' => [ |
24 | 30 | 'class' => 'yii\rbac\DbManager', |
25 | 31 | ], | ... | ... |
frontend/views/catalog/product.php
1 | 1 | <?php |
2 | 2 | /** |
3 | 3 | * @var $product Product |
4 | + * @var $this View | |
4 | 5 | */ |
5 | 6 | use common\components\artboximage\ArtboxImageHelper; |
6 | 7 | use common\models\Orders; |
... | ... | @@ -11,6 +12,7 @@ use frontend\assets\FotoramaAsset; |
11 | 12 | use yii\bootstrap\ActiveForm; |
12 | 13 | use yii\bootstrap\Html; |
13 | 14 | use yii\helpers\Url; |
15 | +use yii\web\View; | |
14 | 16 | use yii\widgets\MaskedInput; |
15 | 17 | use frontend\assets\FlipclockAsset; |
16 | 18 | FotoramaAsset::register($this); |
... | ... | @@ -176,13 +178,11 @@ use frontend\assets\FlipclockAsset; |
176 | 178 | <div class="event_title"> <?= Html::a('Акция!!! '.$event->name,Url::to(['event/show','alias'=>$event->alias,'id'=>$event->primaryKey]))?></div> |
177 | 179 | <div class="event_time">До конца осталось:</div> |
178 | 180 | <div class="clock_<?= $event->primaryKey ?> clock_product_first "></div> |
179 | - <script type="text/javascript"> | |
180 | - var clock; | |
181 | - | |
182 | - $(document).ready(function() { | |
181 | + <?php | |
182 | + $js = " | |
183 | 183 | var clock; |
184 | 184 | |
185 | - clock = $('.clock_<?= $event->primaryKey ?>').FlipClock({ | |
185 | + clock = $('.clock_$event->primaryKey').FlipClock({ | |
186 | 186 | clockFace: 'DailyCounter', |
187 | 187 | language: 'ru', |
188 | 188 | classes: { |
... | ... | @@ -197,12 +197,13 @@ use frontend\assets\FlipclockAsset; |
197 | 197 | }, |
198 | 198 | }); |
199 | 199 | |
200 | - clock.setTime(<?= strtotime($event->end_at) - strtotime(date("Y-m-d H:i:s"))?>); | |
200 | + clock.setTime( ".strtotime($event->end_at) - strtotime(date('Y-m-d H:i:s'))."); | |
201 | 201 | clock.setCountdown(true); |
202 | 202 | clock.start(); |
203 | + "; | |
204 | + $this->registerJs($js,['position'=>View::POS_END]) | |
205 | + ?> | |
203 | 206 | |
204 | - }); | |
205 | - </script> | |
206 | 207 | |
207 | 208 | </div> |
208 | 209 | <?php endif; ?> | ... | ... |
frontend/views/event/_objects.php
1 | 1 | <?php |
2 | 2 | use yii\helpers\Html; |
3 | -use frontend\helpers\TextHelper; | |
4 | 3 | use yii\helpers\Url; |
5 | 4 | use frontend\components\Text; |
6 | 5 | use frontend\assets\FlipclockAsset; |
6 | +use yii\web\View; | |
7 | + | |
7 | 8 | FlipclockAsset::register($this); |
8 | 9 | ?> |
9 | 10 | <div class="news_item"> |
... | ... | @@ -23,13 +24,9 @@ FlipclockAsset::register($this); |
23 | 24 | if(!empty($model->end_at) && strtotime($model->end_at) > strtotime(date("Y-m-d"))){ |
24 | 25 | ?> |
25 | 26 | <div class="clock_style clock_<?= $model->primaryKey ?>"></div> |
26 | - <script type="text/javascript"> | |
27 | - var clock; | |
28 | - | |
29 | - $(document).ready(function() { | |
30 | - var clock; | |
31 | 27 | |
32 | - clock = $('.clock_<?= $model->primaryKey ?>').FlipClock({ | |
28 | + <?php $js = "var clock; | |
29 | + clock = $('.clock_". $model->primaryKey ."').FlipClock({ | |
33 | 30 | clockFace: 'DailyCounter', |
34 | 31 | language: 'ru', |
35 | 32 | classes: { |
... | ... | @@ -44,21 +41,14 @@ FlipclockAsset::register($this); |
44 | 41 | }, |
45 | 42 | }); |
46 | 43 | |
47 | - clock.setTime(<?= strtotime($model->end_at) - strtotime(date("Y-m-d H:i:s"))?>); | |
44 | + clock.setTime(".strtotime($model->end_at) - strtotime(date('Y-m-d H:i:s'))."); | |
48 | 45 | clock.setCountdown(true); |
49 | - clock.start(); | |
50 | - | |
51 | - }); | |
52 | - </script> | |
46 | + clock.start();"; | |
47 | + $this->registerJs($js,['position'=>View::POS_END]) ?> | |
53 | 48 | |
54 | - | |
55 | - <?php | |
56 | - } | |
57 | - | |
58 | - ?> | |
49 | + <?php}?> | |
59 | 50 | </div> |
60 | - <div class="both"></div> | |
61 | - | |
51 | + <div class="both"></div> | |
62 | 52 | |
63 | 53 | |
64 | 54 | ... | ... |
frontend/views/layouts/main.php
... | ... | @@ -30,7 +30,7 @@ use common\models\Event; |
30 | 30 | <link type="image/ico" href="http://www.linija-svitla.ua/images/icon.ico" rel="SHORTCUT ICON"/> |
31 | 31 | <link rel="icon" href="http://www.linija-svitla.ua/images/icon.ico" type="image/x-icon"/> |
32 | 32 | |
33 | - <script language="JavaScript" type="text/JavaScript" src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script> | |
33 | + | |
34 | 34 | <meta name="google-site-verification" content="m60Ax2153voy05Xdtit_bnBVjuZG-fv0Zu14jLjb4Tk"/> |
35 | 35 | |
36 | 36 | ... | ... |
frontend/widgets/views/slider.php
... | ... | @@ -20,33 +20,26 @@ FlipclockAsset::register($this); |
20 | 20 | if(!empty($image->end_at) && strtotime($image->end_at) > strtotime(date("Y-m-d"))){ |
21 | 21 | ?> |
22 | 22 | <div class="clock_style clock_<?= $image->primaryKey ?>"></div> |
23 | - <script type="text/javascript"> | |
24 | - var clock; | |
25 | - | |
26 | - $(document).ready(function() { | |
27 | - var clock; | |
28 | - | |
29 | - clock = $('.clock_<?= $image->primaryKey ?>').FlipClock({ | |
30 | - clockFace: 'DailyCounter', | |
31 | - language: 'ru', | |
32 | - classes: { | |
33 | - active: 'flip-clock-active', | |
34 | - before: 'flip-clock-before', | |
35 | - divider: 'flip-clock-divider', | |
36 | - dot: 'flip-clock-dot', | |
37 | - label: 'flip-clock-label', | |
38 | - flip: 'flip', | |
39 | - play: 'play', | |
40 | - wrapper: 'flip-clock-wrapper' | |
41 | - }, | |
42 | - }); | |
43 | - | |
44 | - clock.setTime(<?= strtotime($image->end_at) - strtotime(date("Y-m-d H:i:s"))?>); | |
45 | - clock.setCountdown(true); | |
46 | - clock.start(); | |
47 | - | |
48 | - }); | |
49 | - </script> | |
23 | + <?php $js = "var clock; | |
24 | + clock = $('.clock_". $image->primaryKey ."').FlipClock({ | |
25 | + clockFace: 'DailyCounter', | |
26 | + language: 'ru', | |
27 | + classes: { | |
28 | + active: 'flip-clock-active', | |
29 | + before: 'flip-clock-before', | |
30 | + divider: 'flip-clock-divider', | |
31 | + dot: 'flip-clock-dot', | |
32 | + label: 'flip-clock-label', | |
33 | + flip: 'flip', | |
34 | + play: 'play', | |
35 | + wrapper: 'flip-clock-wrapper' | |
36 | + }, | |
37 | + }); | |
38 | + | |
39 | + clock.setTime(".strtotime($model->end_at) - strtotime(date('Y-m-d H:i:s'))."); | |
40 | + clock.setCountdown(true); | |
41 | + clock.start();"; | |
42 | + $this->registerJs($js,['position'=>View::POS_END]) ?> | |
50 | 43 | |
51 | 44 | |
52 | 45 | <?php | ... | ... |