detail_new.blade.php
5.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
@extends('layout.frontend', ['title' => $title.' - РекаМоре'])
@section('scripts')
<script>
$(document).on('change', '#sort_ajax', function() {
var this_ = $(this);
var val_ = this_.val();
console.log('sort items '+val_);
$.ajax({
type: "GET",
url: "{{ route('education') }}",
data: "sort="+val_+"&block=1",
success: function (data) {
console.log('Выбор сортировки');
console.log(data);
$('#block').html(data);
history.pushState({}, '', "{{ route('education') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif");
},
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
error: function (data) {
data = JSON.stringify(data);
console.log('Error: ' + data);
}
});
});
$(document).ready(function(){
var sel = $('#select2-sort_ajax-container');
var key = getUrlParameter('sort');
console.log(sel);
console.log(key);
if (key !=='') {
console.log(key);
switch (key) {
case "default": sel.html('Сортировка (по умолчанию)'); break;
case "name_up": sel.html('По имени (возрастание)'); break;
case "name_down": sel.html('По дате (убывание)'); break;
case "created_at_up": sel.html('По дате (возрастание)'); break;
case "created_at_down": sel.html('По дате (убывание)'); break;
}
}
});
</script>
@endsection
@section('content')
<section class="thing">
<div class="container">
<div class="thing__body">
<ul class="breadcrumbs thing__breadcrumbs">
<li><a href="{{ route('index') }}">Главная</a></li>
<li><a href="{{ route('news') }}">Новости и статьи</a></li>
<li><b>{{ $title }}</b></li>
</ul>
@if (empty($Query[0]->image))
<img src="{{ asset('/images/default_ship.jpg') }}" alt="{{ $title }}" class="thing__pic thing__pic_two">
@else
<img src="{{ asset(Storage::url($Query[0]->image)) }}" alt="{{ $title }}" class="thing__pic thing__pic_two">
@endif
<time class="thing__date">{{ date('d.m.Y H:i:s', strtotime($Query[0]->created_at)) }}</time>
<h1 class="thing__title">{{ $title }}</h1>
<p class="thing__text">{!! mb_strimwidth($Query[0]->text, 0, 100, "...") !!}</p>
</div>
</div>
</section>
<main class="main">
<div class="container">
<div class="main__content">
<div class="main__content-item">
<h2>{{ $Query[0]->title }}</h2>
<p>{!! $Query[0]->text !!}</p>
</div>
</div>
</div>
</main>
<section class="news">
<div class="container">
<div class="news__toper">
<div class="title">Новости и статьи</div>
<div class="navs">
<button class="js-news-swiper-button-prev">
<svg class="rotate180">
<use xlink:href="images/sprite.svg#arrow"></use>
</svg>
</button>
<button class="js-news-swiper-button-next">
<svg>
<use xlink:href="images/sprite.svg#arrow"></use>
</svg>
</button>
</div>
</div>
<div class="swiper js-news-swiper">
<div class="swiper-wrapper">
@if ($All_Query->count())
@foreach($All_Query as $Q_item)
<div class="swiper-slide">
<div class="news__item">
<img src="{{ asset(Storage::url($Q_item->image)) }}" alt="{{ $Q_item->title }}" class="news__item-pic">
<div class="news__item-body">
<time datetime="{{ date('d.m.Y H:i:s', strtotime($Q_item->created_at)) }}" class="news__item-date">{{ date('d.m.Y H:i:s', strtotime($Q_item->created_at)) }}</time>
<span class="news__item-title">{{ $Q_item->title }}</span>
<span class="news__item-text">{!! $Q_item->text !!}</span>
<a href="{{ route('detail_new', ['new' => $Q_item->id]) }}" class="news__item-more button button_light">Читать далее</a>
</div>
</div>
</div>
@endforeach
@endif
</div>
<div class="swiper-pagination"></div>
</div>
<a href="{{ route('news') }}" class="news__all button button_light">Все новости</a>
</div>
</section>
</div>
@endsection