Commit 36a8dd6051631f08c5ff675d561e78ee060ada9c
1 parent
19746059
add pjax to goods page
Showing
5 changed files
with
26 additions
and
73 deletions
Show diff stats
backend/views/parser/index.php
| @@ -12,8 +12,8 @@ if ( $model->mode ) { | @@ -12,8 +12,8 @@ if ( $model->mode ) { | ||
| 12 | $mode = 0; | 12 | $mode = 0; |
| 13 | $button_label = 'Прочитать'; | 13 | $button_label = 'Прочитать'; |
| 14 | } | 14 | } |
| 15 | - | ||
| 16 | ?> | 15 | ?> |
| 16 | + | ||
| 17 | <div class="row"> | 17 | <div class="row"> |
| 18 | <div class="col-lg-5"> | 18 | <div class="col-lg-5"> |
| 19 | <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data',],'action'=>['parser/results', 'mode' => $mode]]); | 19 | <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data',],'action'=>['parser/results', 'mode' => $mode]]); |
frontend/views/goods/index.php
| 1 | <?php | 1 | <?php |
| 2 | use yii\data\Sort; | 2 | use yii\data\Sort; |
| 3 | use \yii\helpers\Html; | 3 | use \yii\helpers\Html; |
| 4 | +use \yii\widgets\Pjax; | ||
| 4 | 5 | ||
| 5 | $sort = new Sort([ | 6 | $sort = new Sort([ |
| 6 | 'attributes' => [ | 7 | 'attributes' => [ |
| @@ -17,8 +18,9 @@ $sort = new Sort([ | @@ -17,8 +18,9 @@ $sort = new Sort([ | ||
| 17 | $this->registerCssFile('/css/BC2_catalog_zapchasti.css'); | 18 | $this->registerCssFile('/css/BC2_catalog_zapchasti.css'); |
| 18 | $this->registerJsFile('/js/jquery.tablesorter.min.js'); | 19 | $this->registerJsFile('/js/jquery.tablesorter.min.js'); |
| 19 | $this->registerJsFile('/js/goods.js'); | 20 | $this->registerJsFile('/js/goods.js'); |
| 21 | + | ||
| 20 | $this->params['breadcrumbs'][] = $this->title; | 22 | $this->params['breadcrumbs'][] = $this->title; |
| 21 | -\yii\widgets\Pjax::begin(); | 23 | +Pjax::begin(); |
| 22 | ?> | 24 | ?> |
| 23 | 25 | ||
| 24 | 26 | ||
| @@ -113,7 +115,6 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -113,7 +115,6 @@ $this->params['breadcrumbs'][] = $this->title; | ||
| 113 | <td class="right_large row_name link_sort arrow_up"><?= $sort->link('box_or') ?></td> | 115 | <td class="right_large row_name link_sort arrow_up"><?= $sort->link('box_or') ?></td> |
| 114 | <td class="right_small row_name link_sort arrow_up"><?= $sort->link('delivery_or') ?></td> | 116 | <td class="right_small row_name link_sort arrow_up"><?= $sort->link('delivery_or') ?></td> |
| 115 | <td class="right_medium row_name link_sort arrow_up"><?= $sort->link('price_or') ?></td> | 117 | <td class="right_medium row_name link_sort arrow_up"><?= $sort->link('price_or') ?></td> |
| 116 | - | ||
| 117 | </tr> | 118 | </tr> |
| 118 | <?php | 119 | <?php |
| 119 | echo \yii\widgets\ListView::widget([ | 120 | echo \yii\widgets\ListView::widget([ |
| @@ -141,7 +142,6 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -141,7 +142,6 @@ $this->params['breadcrumbs'][] = $this->title; | ||
| 141 | <td class="right_large row_name link_sort arrow_up"><?= $sort->link('box_cross') ?></td> | 142 | <td class="right_large row_name link_sort arrow_up"><?= $sort->link('box_cross') ?></td> |
| 142 | <td class="right_small row_name link_sort arrow_up"><?= $sort->link('delivery_cross') ?></td> | 143 | <td class="right_small row_name link_sort arrow_up"><?= $sort->link('delivery_cross') ?></td> |
| 143 | <td class="right_medium row_name link_sort arrow_up"><?= $sort->link('price_cross') ?></td> | 144 | <td class="right_medium row_name link_sort arrow_up"><?= $sort->link('price_cross') ?></td> |
| 144 | - | ||
| 145 | </tr> | 145 | </tr> |
| 146 | <?php | 146 | <?php |
| 147 | echo \yii\widgets\ListView::widget([ | 147 | echo \yii\widgets\ListView::widget([ |
| @@ -160,7 +160,9 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -160,7 +160,9 @@ $this->params['breadcrumbs'][] = $this->title; | ||
| 160 | </div> | 160 | </div> |
| 161 | 161 | ||
| 162 | </div> | 162 | </div> |
| 163 | - | 163 | +<?php |
| 164 | +Pjax::end(); | ||
| 165 | +?> | ||
| 164 | <script type="text/javascript"> | 166 | <script type="text/javascript"> |
| 165 | function changeText() { | 167 | function changeText() { |
| 166 | e = document.getElementById('button_grey_card'); | 168 | e = document.getElementById('button_grey_card'); |
| @@ -179,12 +181,8 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -179,12 +181,8 @@ $this->params['breadcrumbs'][] = $this->title; | ||
| 179 | }) | 181 | }) |
| 180 | </script> | 182 | </script> |
| 181 | 183 | ||
| 182 | -<?php | ||
| 183 | -\yii\widgets\Pjax::end(); | ||
| 184 | -?> | ||
| 185 | - | ||
| 186 | <div class="modal fade" id="details_content_block" > | 184 | <div class="modal fade" id="details_content_block" > |
| 187 | - <div class="modal-dialog"> | 185 | + <div class="modal-dialog table_details"> |
| 188 | <div class="modal-content"> | 186 | <div class="modal-content"> |
| 189 | <div class="modal-header"> | 187 | <div class="modal-header"> |
| 190 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | 188 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> |
frontend/views/goods/one_item.php
| 1 | <?php | 1 | <?php |
| 2 | use \yii\helpers\Html; | 2 | use \yii\helpers\Html; |
| 3 | -$this->registerCssFile('/css/BC2_catalog_zapchasti.css'); | ||
| 4 | // если товар один и тот же то выводим только цену и кол-во | 3 | // если товар один и тот же то выводим только цену и кол-во |
| 5 | // иначе всю информацию | 4 | // иначе всю информацию |
| 6 | $new_good = false; | 5 | $new_good = false; |
| @@ -25,9 +24,9 @@ $cross_prefix = ( empty($model->crosses) )? '': '_cross'; | @@ -25,9 +24,9 @@ $cross_prefix = ( empty($model->crosses) )? '': '_cross'; | ||
| 25 | <a class="tecdoc_id_info" data-toggle="modal" data-target="#details_content_block" data-id="<?= $model->tecdoc_id ?>" href=""><img src="/images/gear.png"></a> | 24 | <a class="tecdoc_id_info" data-toggle="modal" data-target="#details_content_block" data-id="<?= $model->tecdoc_id ?>" href=""><img src="/images/gear.png"></a> |
| 26 | <a href="" id="go_photo"><img src="/images/icon_cam.png"></a> | 25 | <a href="" id="go_photo"><img src="/images/icon_cam.png"></a> |
| 27 | </td> | 26 | </td> |
| 28 | -<?php $this->endBlock(); ?> | ||
| 29 | - | ||
| 30 | - <?php $this->beginBlock('empty_details'); | 27 | +<?php |
| 28 | + $this->endBlock(); | ||
| 29 | + $this->beginBlock('empty_details'); | ||
| 31 | // иначе пустой блок | 30 | // иначе пустой блок |
| 32 | ?> | 31 | ?> |
| 33 | <tr style="border-bottom: 0;border-top: 0;"> | 32 | <tr style="border-bottom: 0;border-top: 0;"> |
frontend/web/js/goods.js
| 1 | $( document ).ready(function() { | 1 | $( document ).ready(function() { |
| 2 | - // кнопки с переключателями валюты с основной таблицы | ||
| 3 | - var btn_eur = document.getElementById('euro'); | ||
| 4 | - var btn_uah = document.getElementById('grivna'); | ||
| 5 | - var btn_usd = document.getElementById('dollars'); | ||
| 6 | - // кнопки с переключателями валюты таблицы с кроссами | ||
| 7 | - var cross_btn_eur = document.getElementById('cross_euro'); | ||
| 8 | - var cross_btn_uah = document.getElementById('cross_grivna'); | ||
| 9 | - var cross_btn_usd = document.getElementById('cross_dollars'); | ||
| 10 | - | ||
| 11 | // для таблицы кроссов, классы обозначаются через cross_ | 2 | // для таблицы кроссов, классы обозначаются через cross_ |
| 12 | var cross_prefix = ''; | 3 | var cross_prefix = ''; |
| 13 | 4 | ||
| @@ -15,52 +6,23 @@ $( document ).ready(function() { | @@ -15,52 +6,23 @@ $( document ).ready(function() { | ||
| 15 | var show_currency = ['usd']; | 6 | var show_currency = ['usd']; |
| 16 | var hidden_currency = ['uah','eur']; | 7 | var hidden_currency = ['uah','eur']; |
| 17 | 8 | ||
| 18 | - // назначим события кнопкам переключателей валюты | ||
| 19 | - if(btn_eur) | ||
| 20 | - btn_eur.onclick = changeEUR; | ||
| 21 | - if(btn_uah) | ||
| 22 | - btn_uah.onclick = changeUAH; | ||
| 23 | - if(btn_usd) | ||
| 24 | - btn_usd.onclick = changeUSD; | ||
| 25 | - if(cross_btn_eur) | ||
| 26 | - cross_btn_eur.onclick = changeEUR; | ||
| 27 | - if(cross_btn_uah) | ||
| 28 | - cross_btn_uah.onclick = changeUAH; | ||
| 29 | - if(cross_btn_usd) | ||
| 30 | - cross_btn_usd.onclick = changeUSD; | ||
| 31 | - | ||
| 32 | - | ||
| 33 | - function changeEUR(){ | ||
| 34 | - //if( $(this).hasClass('cross_currency') ){ | ||
| 35 | - // cross_prefix = '_cross'; | ||
| 36 | - //}else{ | ||
| 37 | - // cross_prefix = ''; | ||
| 38 | - //} | 9 | + $( document ).on( "click", ".currency", changeCurrency ); |
| 39 | 10 | ||
| 40 | - show_currency = ['eur']; | ||
| 41 | - hidden_currency = ['uah','usd']; | ||
| 42 | - setVisiblePrice(); | ||
| 43 | - } | ||
| 44 | - function changeUAH(){ | ||
| 45 | - //if( $(this).hasClass('cross_currency') ){ | ||
| 46 | - // cross_prefix = '_cross'; | ||
| 47 | - //}else{ | ||
| 48 | - // cross_prefix = ''; | ||
| 49 | - //} | 11 | + function changeCurrency(){ |
| 50 | 12 | ||
| 51 | - show_currency = ['uah']; | ||
| 52 | - hidden_currency = ['eur','usd']; | ||
| 53 | - setVisiblePrice(); | ||
| 54 | - } | ||
| 55 | - function changeUSD(){ | ||
| 56 | - //if( $(this).hasClass('cross_currency') ){ | ||
| 57 | - // cross_prefix = '_cross'; | ||
| 58 | - //}else{ | ||
| 59 | - // cross_prefix = ''; | ||
| 60 | - //} | 13 | + if( $(this).attr('id') === 'grivna' ){ |
| 14 | + show_currency = ['uah']; | ||
| 15 | + hidden_currency = ['eur','usd']; | ||
| 16 | + }else if( $(this).attr('id') === 'euro' ) { | ||
| 17 | + show_currency = ['eur']; | ||
| 18 | + hidden_currency = ['uah','usd']; | ||
| 19 | + }else if( $(this).attr('id') === 'dollars' ) { | ||
| 20 | + show_currency = ['usd']; | ||
| 21 | + hidden_currency = ['uah','eur']; | ||
| 22 | + } | ||
| 23 | + $('.currency').removeClass('active_button_purple1'); | ||
| 24 | + $(this).addClass('active_button_purple1'); | ||
| 61 | 25 | ||
| 62 | - show_currency = ['usd']; | ||
| 63 | - hidden_currency = ['uah','eur']; | ||
| 64 | setVisiblePrice(); | 26 | setVisiblePrice(); |
| 65 | } | 27 | } |
| 66 | 28 | ||
| @@ -68,8 +30,8 @@ $( document ).ready(function() { | @@ -68,8 +30,8 @@ $( document ).ready(function() { | ||
| 68 | // элементы с классами из show_currency отобразим | 30 | // элементы с классами из show_currency отобразим |
| 69 | for( var i = 0; i < show_currency.length; i++ ){ | 31 | for( var i = 0; i < show_currency.length; i++ ){ |
| 70 | var arr_elements = document.getElementsByClassName(show_currency[i] + cross_prefix); | 32 | var arr_elements = document.getElementsByClassName(show_currency[i] + cross_prefix); |
| 71 | - for(var j = 0; j < arr_elements.length; j++ ){ | ||
| 72 | 33 | ||
| 34 | + for(var j = 0; j < arr_elements.length; j++ ){ | ||
| 73 | if( arr_elements[j].classList.contains('hidden') ) | 35 | if( arr_elements[j].classList.contains('hidden') ) |
| 74 | arr_elements[j].classList.remove('hidden'); | 36 | arr_elements[j].classList.remove('hidden'); |
| 75 | } | 37 | } |
frontend/web/js/script.js
| @@ -578,12 +578,6 @@ $('.menu_block_center2 .by_articul .menu_search_down').hover(function(){ | @@ -578,12 +578,6 @@ $('.menu_block_center2 .by_articul .menu_search_down').hover(function(){ | ||
| 578 | function(){ | 578 | function(){ |
| 579 | $(this).find('a:first-child').css({'color':'#6b84b5'}); | 579 | $(this).find('a:first-child').css({'color':'#6b84b5'}); |
| 580 | } | 580 | } |
| 581 | -); | ||
| 582 | -$('.currency').click(function(){ | ||
| 583 | - $('.currency').removeClass('active_button_purple1'); | ||
| 584 | - $(this).addClass('active_button_purple1'); | ||
| 585 | - | ||
| 586 | -} | ||
| 587 | ); | 581 | ); |
| 588 | 582 | ||
| 589 | $('.menu_block_center .menu_item').hover(function(){ | 583 | $('.menu_block_center .menu_item').hover(function(){ |