Commit 36a8dd6051631f08c5ff675d561e78ee060ada9c

Authored by Mihail
1 parent 19746059

add pjax to goods page

backend/views/parser/index.php
... ... @@ -12,8 +12,8 @@ if ( $model->mode ) {
12 12 $mode = 0;
13 13 $button_label = 'Прочитать';
14 14 }
15   -
16 15 ?>
  16 +
17 17 <div class="row">
18 18 <div class="col-lg-5">
19 19 <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data',],'action'=>['parser/results', 'mode' => $mode]]);
... ...
frontend/views/goods/index.php
1 1 <?php
2 2 use yii\data\Sort;
3 3 use \yii\helpers\Html;
  4 +use \yii\widgets\Pjax;
4 5  
5 6 $sort = new Sort([
6 7 'attributes' => [
... ... @@ -17,8 +18,9 @@ $sort = new Sort([
17 18 $this->registerCssFile('/css/BC2_catalog_zapchasti.css');
18 19 $this->registerJsFile('/js/jquery.tablesorter.min.js');
19 20 $this->registerJsFile('/js/goods.js');
  21 +
20 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-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
113 115 <td class="right_large row_name link_sort arrow_up"><?= $sort->link('box_or') ?></td>
114 116 <td class="right_small row_name link_sort arrow_up"><?= $sort->link('delivery_or') ?></td>
115 117 <td class="right_medium row_name link_sort arrow_up"><?= $sort->link('price_or') ?></td>
116   -
117 118 </tr>
118 119 <?php
119 120 echo \yii\widgets\ListView::widget([
... ... @@ -141,7 +142,6 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
141 142 <td class="right_large row_name link_sort arrow_up"><?= $sort->link('box_cross') ?></td>
142 143 <td class="right_small row_name link_sort arrow_up"><?= $sort->link('delivery_cross') ?></td>
143 144 <td class="right_medium row_name link_sort arrow_up"><?= $sort->link('price_cross') ?></td>
144   -
145 145 </tr>
146 146 <?php
147 147 echo \yii\widgets\ListView::widget([
... ... @@ -160,7 +160,9 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
160 160 </div>
161 161  
162 162 </div>
163   -
  163 +<?php
  164 +Pjax::end();
  165 +?>
164 166 <script type="text/javascript">
165 167 function changeText() {
166 168 e = document.getElementById('button_grey_card');
... ... @@ -179,12 +181,8 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
179 181 })
180 182 </script>
181 183  
182   -<?php
183   -\yii\widgets\Pjax::end();
184   -?>
185   -
186 184 <div class="modal fade" id="details_content_block" >
187   - <div class="modal-dialog">
  185 + <div class="modal-dialog table_details">
188 186 <div class="modal-content">
189 187 <div class="modal-header">
190 188 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
... ...
frontend/views/goods/one_item.php
1 1 <?php
2 2 use \yii\helpers\Html;
3   -$this->registerCssFile('/css/BC2_catalog_zapchasti.css');
4 3 // если товар один и тот же то выводим только цену и кол-во
5 4 // иначе всю информацию
6 5 $new_good = false;
... ... @@ -25,9 +24,9 @@ $cross_prefix = ( empty($model-&gt;crosses) )? &#39;&#39;: &#39;_cross&#39;;
25 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 25 <a href="" id="go_photo"><img src="/images/icon_cam.png"></a>
27 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 32 <tr style="border-bottom: 0;border-top: 0;">
... ...
frontend/web/js/goods.js
1 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 2 // для таблицы кроссов, классы обозначаются через cross_
12 3 var cross_prefix = '';
13 4  
... ... @@ -15,52 +6,23 @@ $( document ).ready(function() {
15 6 var show_currency = ['usd'];
16 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 26 setVisiblePrice();
65 27 }
66 28  
... ... @@ -68,8 +30,8 @@ $( document ).ready(function() {
68 30 // элементы с классами из show_currency отобразим
69 31 for( var i = 0; i < show_currency.length; i++ ){
70 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 35 if( arr_elements[j].classList.contains('hidden') )
74 36 arr_elements[j].classList.remove('hidden');
75 37 }
... ...
frontend/web/js/script.js
... ... @@ -578,12 +578,6 @@ $(&#39;.menu_block_center2 .by_articul .menu_search_down&#39;).hover(function(){
578 578 function(){
579 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 583 $('.menu_block_center .menu_item').hover(function(){
... ...