Commit 8fd380e9ecb23fec8f81ff17c5309dc07bbb735d

Authored by Андрей Ларионов
Exists in master

Merge branch 'master' of http://gitlab.nologostudio.ru/alarionov/rekamore-su

Showing 4 changed files Side-by-side Diff

app/Http/Controllers/EducationController.php
... ... @@ -26,6 +26,8 @@ class EducationController extends Controller
26 26 case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break;
27 27 default: $educations = $educations->orderBy('id')->orderby('updated_at'); break;
28 28 }
  29 + } else {
  30 + $educations->orderBy('name');
29 31 }
30 32  
31 33 $count_edu = $educations->count();
resources/views/ajax/education.blade.php
... ... @@ -4,11 +4,6 @@
4 4 <div class="main__ads-item">
5 5 <div class="main__ads-item-pic">
6 6 <img src="@if (!empty($edu->image)) {{ asset(Storage::url($edu->image)) }} @else {{ asset('images/education.jpg') }} @endif" alt="{{ $edu->name }}">
7   - <span>
8   - <svg>
9   - <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use>
10   - </svg>
11   - </span>
12 7 </div>
13 8 <div class="main__ads-item-body">
14 9 <b>{{ $edu->name }}</b>
resources/views/education/index.blade.php
... ... @@ -2,7 +2,6 @@
2 2  
3 3 @section('scripts')
4 4 <script>
5   - console.log('Test system');
6 5 $(document).on('change', '#sort_ajax', function() {
7 6 var this_ = $(this);
8 7 var val_ = this_.val();
... ... @@ -31,11 +30,8 @@
31 30 $(document).ready(function(){
32 31 var sel = $('#select2-sort_ajax-container');
33 32 var key = getUrlParameter('sort');
34   - console.log(sel);
35   - console.log(key);
36 33  
37 34 if (key !=='') {
38   - console.log(key);
39 35 switch (key) {
40 36 case "default": sel.html('Сортировка (по умолчанию)'); break;
41 37 case "name_up": sel.html('По имени (возрастание)'); break;
... ... @@ -94,11 +90,6 @@
94 90 <div class="main__ads-item">
95 91 <div class="main__ads-item-pic">
96 92 <img src="@if (!empty($edu->image)) {{ asset(Storage::url($edu->image)) }} @else {{ asset('images/education.jpg') }} @endif" alt="{{ $edu->name }}">
97   - <span>
98   - <svg>
99   - <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use>
100   - </svg>
101   - </span>
102 93 </div>
103 94 <div class="main__ads-item-body">
104 95 <b>{{ $edu->name }}</b>
resources/views/education/show.blade.php
... ... @@ -3,7 +3,22 @@
3 3 @section('scripts')
4 4 <script>
5 5 $(function(){
6   - $( ".accordion").accordion();
  6 + $('ul.accordion > li.accordion-item').click(function(e){
  7 + if (e.target.closest('.accordion-sub')) {
  8 + return;
  9 + }
  10 +
  11 + var this_li = $(this);
  12 + var thumb = this_li.find('> .accordion-thumb');
  13 +
  14 + if (thumb.hasClass('ui-state-active')){
  15 + thumb.removeClass('ui-state-active');
  16 + this_li.find('> .accordion-panel').hide(500);
  17 + } else {
  18 + thumb.addClass('ui-state-active');
  19 + this_li.find('> .accordion-panel').show(500);
  20 + }
  21 + });
7 22  
8 23 $('ul.accordion-sub li.accordion-item').click(function(){
9 24 var this_li = $(this);
... ... @@ -16,12 +31,12 @@
16 31 added_height = 0;
17 32 }
18 33  
19   - parent_ul.find('.accordion-panel').hide(500);
20   -
21 34 if (thumb.hasClass('ui-state-active')){
  35 + this_li.find('.accordion-panel').hide(500);
22 36 thumb.removeClass('ui-state-active');
23 37  
24   - var panel_height = panel.height() - parseInt(added_height);
  38 + var reduce_height = this_li.find('.accordion-panel').height() + 20;
  39 + var panel_height = panel.height() - parseInt(reduce_height);
25 40 panel.animate({height: panel_height + "px"}, {
26 41 easing: 'swing',
27 42 duration: 500,
... ... @@ -29,13 +44,17 @@
29 44 panel.css('height', 'auto');
30 45 }
31 46 });
32   - panel.data('added-height', 0);
  47 +
  48 + added_height = parseInt(added_height) - parseInt(reduce_height);
  49 + if (added_height < 0){
  50 + added_height = 0;
  51 + }
  52 + panel.data('added-height', added_height);
33 53 } else {
34   - parent_ul.find('.accordion-thumb').removeClass('ui-state-active');
35 54 thumb.addClass('ui-state-active');
36 55  
37 56 var add_height = this_li.find('.accordion-panel').height() + 20;
38   - var panel_height = panel.height() + parseInt(add_height) - parseInt(added_height);
  57 + var panel_height = panel.height() + parseInt(add_height);
39 58 panel.animate({height: panel_height + "px"}, {
40 59 easing: 'swing',
41 60 duration: 500,
... ... @@ -44,7 +63,9 @@
44 63 }
45 64 });
46 65 this_li.find('.accordion-panel').show(500);
47   - panel.data('added-height', add_height);
  66 +
  67 + added_height = parseInt(added_height) + parseInt(add_height);
  68 + panel.data('added-height', added_height);
48 69 }
49 70 });
50 71 });
... ... @@ -92,7 +113,7 @@
92 113 @foreach($levels_education_programs as $level_name => $education_programs)
93 114 <li class="accordion-item">
94 115 <h3 class="accordion-thumb">{{$level_name}}</h3>
95   - <div class="accordion-panel pb-20">
  116 + <div class="accordion-panel hide pb-20">
96 117 <div>
97 118 <ul class="accordion-sub">
98 119 @foreach($education_programs as $education_program)