Revize eadc983d
Přidáno uživatelem Jiří Noháč před téměř 5 roky(ů)
app/Http/Controllers/ArtefactController.php | ||
---|---|---|
53 | 53 |
} |
54 | 54 |
} |
55 | 55 |
|
56 |
/** |
|
57 |
* Returns view of artefacts related to the chosen category |
|
58 |
* |
|
59 |
* @param $id string with categories ids |
|
60 |
* @return Factory|View |
|
61 |
*/ |
|
62 |
public function showCategories($id) |
|
63 |
{ |
|
64 |
$textWithIds = $id; |
|
65 |
$pieces = explode(",", $textWithIds); |
|
66 |
$artefacts = array(); |
|
67 |
for($i = 0;$i < count($pieces); $i++) |
|
68 |
{ |
|
69 |
if($pieces[$i] == null || !strcmp($pieces[$i], "")) |
|
70 |
{ |
|
71 |
continue; |
|
72 |
} |
|
73 |
|
|
74 |
$categoryArtefacts = ArtefactCategory::where('category_id', $pieces[$i])->get(); |
|
75 |
if(count($categoryArtefacts) > 0) |
|
76 |
{ |
|
77 |
foreach($categoryArtefacts as $ar) |
|
78 |
{ |
|
79 |
array_push($artefacts, Artefact::where('id', $ar->artefact_id)->get()); |
|
80 |
} |
|
81 |
} |
|
82 |
} |
|
83 |
|
|
84 |
if(count($artefacts) > 0) |
|
85 |
{ |
|
86 |
return view('artefact.category', ['artefacts' => $artefacts]); |
|
87 |
} |
|
88 |
else |
|
89 |
{ |
|
90 |
return view('artefact.category', ['artefacts' => array()]); |
|
91 |
} |
|
92 |
} |
|
93 |
|
|
56 | 94 |
/** |
57 | 95 |
* Returns view of single artefact given by its id. |
58 | 96 |
* |
resources/lang/en/general.php | ||
---|---|---|
30 | 30 |
'register' => 'register', |
31 | 31 |
'topics' => 'topics', |
32 | 32 |
'artefacts' => 'books', |
33 |
'favourite_artefacts' => 'my books',
|
|
34 |
'favourite_metadata' => 'my notes',
|
|
33 |
'favourite_artefacts' => 'likes',
|
|
34 |
'favourite_metadata' => 'notes', |
|
35 | 35 |
'charts' => 'charts', |
36 | 36 |
|
37 | 37 |
/* |
resources/sass/_custom.scss | ||
---|---|---|
713 | 713 |
} |
714 | 714 |
} |
715 | 715 |
|
716 |
.btn-dark:not(:disabled):not(.disabled).active{ |
|
717 |
background-color: $theme-color-four; |
|
718 |
color:white; |
|
719 |
border-color: $theme-color-five; |
|
720 |
} |
|
721 |
|
|
716 | 722 |
//CATEGORY/{id} -h2 title NO ARTEFACTS |
717 | 723 |
.category-h2 { |
718 | 724 |
color: $theme-color-four; |
... | ... | |
726 | 732 |
} |
727 | 733 |
} |
728 | 734 |
|
735 |
//CATEGORIES - Main menu |
|
736 |
.cat-main-menu{ |
|
737 |
font-size: 1.75rem; |
|
738 |
text-align: center; |
|
739 |
margin-bottom: 30pt; |
|
740 |
|
|
741 |
a,a:visited{ |
|
742 |
color: $theme-color-two; |
|
743 |
text-decoration: none; |
|
744 |
} |
|
745 |
|
|
746 |
a:hover{ |
|
747 |
color: $theme-color-four; |
|
748 |
} |
|
749 |
|
|
750 |
} |
|
751 |
|
|
752 |
//CATEGORIES - Wrapper around Enter button |
|
753 |
.cat-wrapper{ |
|
754 |
margin:auto; |
|
755 |
display:block; |
|
756 |
//align-content: center; |
|
757 |
//margin:auto; |
|
758 |
//display:block; |
|
759 |
} |
|
760 |
|
|
761 |
//CATEGORIES - Enter button |
|
762 |
.btn.button-square.cat-enter-butt { |
|
763 |
font-size: 8pt; |
|
764 |
background-color: grey; |
|
765 |
color: $theme-color-one; |
|
766 |
border: 0.5pt solid $theme-color-one; |
|
767 |
border-radius: 0; |
|
768 |
bottom: 5%; |
|
769 |
position: fixed; |
|
770 |
left: 50%; |
|
771 |
transform: translateX(-50%); |
|
772 |
width: 6.5rem; |
|
773 |
height: 2rem; |
|
774 |
font-weight: $font-weight-one; |
|
775 |
|
|
776 |
&:active, &:focus, &:visited, &:hover { |
|
777 |
outline: none; |
|
778 |
box-shadow: none; |
|
779 |
color: $theme-color-one; |
|
780 |
} |
|
781 |
|
|
782 |
&:hover { |
|
783 |
color: $theme-color-four; |
|
784 |
} |
|
785 |
} |
|
786 |
|
|
729 | 787 |
//VERIFY - main text |
730 | 788 |
.ver-text{ |
731 | 789 |
|
resources/views/categories/index.blade.php | ||
---|---|---|
5 | 5 |
@section('content') |
6 | 6 |
<div class="container"> |
7 | 7 |
@if(isset($user)) |
8 |
{{--<p><?php dd($categories); ?></p>--}} |
|
9 |
<div class="cat-main-div" onclick="resetEnter()"> |
|
8 |
<div class="row"> |
|
9 |
<div class="col cat-main-menu"> |
|
10 |
<a href="{{ url('/') }}"> |
|
11 |
{{ __('general.home') }} |
|
12 |
</a> |
|
13 |
</div> |
|
14 |
<div class="col cat-main-menu"> |
|
15 |
<a href="{{ url('/categories') }}"> |
|
16 |
{{ __('general.topics') }} |
|
17 |
</a> |
|
18 |
</div> |
|
19 |
<div class="col cat-main-menu"> |
|
20 |
<a href="{{ url('/artefact') }}"> |
|
21 |
{{ __('general.artefacts') }} |
|
22 |
</a> |
|
23 |
</div> |
|
24 |
<div class="col cat-main-menu"> |
|
25 |
<a href="{{ url('/favartefacts') }}"> |
|
26 |
{{ __('general.favourite_artefacts') }} |
|
27 |
</a> |
|
28 |
</div> |
|
29 |
<div class="col cat-main-menu"> |
|
30 |
<a href="{{ url('/favmetadata') }}"> |
|
31 |
{{ __('general.favourite_metadata') }} |
|
32 |
</a> |
|
33 |
</div> |
|
34 |
<div class="col cat-main-menu"> |
|
35 |
<a href="{{ url('/charts') }}"> |
|
36 |
{{ __('general.charts') }} |
|
37 |
</a> |
|
38 |
</div> |
|
39 |
<div class="col cat-main-menu"> |
|
40 |
<a href="{{ url('/czech') }}"> |
|
41 |
{{ __('general.cs') }} |
|
42 |
</a> |
|
43 |
</div> |
|
44 |
</div> |
|
45 |
<div class="cat-main-div" {{--onclick="resetEnter()"--}}> |
|
10 | 46 |
<div class="head-title text-center cat-main-topic"> |
11 | 47 |
<h1>choose a topic</h1> |
12 | 48 |
</div> |
13 |
<div class="d-flex flex-wrap justify-content-around"> |
|
49 |
<div class="d-flex flex-wrap justify-content-around btn-group" data-toggle="buttons">
|
|
14 | 50 |
@for($k = 0; $k < $count;$k++) |
15 |
{{-- <div class="d-flex cat-col-md-2">--}} |
|
16 | 51 |
<div class="d-flex col-sm-12 col-md-6 col-lg-4 col-xl-3"> |
17 |
<a href="{{ url('/category/' . $categoryNames[$k]->id) }}"
|
|
18 |
class="btn btn-dark cat-tile w-100 mt-4"> |
|
52 |
<a id="cat-but-id{{$categoryNames[$k]->id}}"{{--href="{{ url('/category/' . $categoryNames[$k]->id) }}"--}}
|
|
53 |
class="btn btn-dark cat-tile w-100 mt-4">
|
|
19 | 54 |
{{$categoryNames[$k]->nameCZ}} |
20 | 55 |
</a> |
21 | 56 |
</div> |
... | ... | |
30 | 65 |
</ul> |
31 | 66 |
@endif |
32 | 67 |
</div> |
68 |
<div class="cat-wrapper"> |
|
69 |
<a class="btn button-square cat-enter-butt" onclick="test()" role="button">enter</a> |
|
70 |
</div> |
|
71 |
<div class="row justify-content-md-center"> |
|
72 |
<div class="col-md-auto"> |
|
73 |
{{-- |
|
74 |
<a class="btn button-square cat-enter-butt" onclick="test()" role="button">enter</a> |
|
75 |
--}} |
|
76 |
</div> |
|
77 |
</div> |
|
78 |
<script> |
|
79 |
function test() |
|
80 |
{ |
|
81 |
var btns = $(".btn-dark:not(:disabled):not(.disabled).active"); |
|
82 |
if(btns.length > 0) |
|
83 |
{ |
|
84 |
var text = ""; |
|
85 |
for(var i = 0; i < btns.length;i++) |
|
86 |
{ |
|
87 |
var idE = btns[i].id; |
|
88 |
var num = idE.substring(10, idE.length); |
|
89 |
text += num + ","; |
|
90 |
} |
|
91 |
window.location.href = "{{url('/category/multi/')}}/" + text; |
|
92 |
} |
|
93 |
} |
|
94 |
</script> |
|
33 | 95 |
@endsection |
routes/web.php | ||
---|---|---|
21 | 21 |
Route::post('/artefact/like/{id}', 'ArtefactController@like'); |
22 | 22 |
Route::post('/artefact/unlike/{id}', 'ArtefactController@unlike'); |
23 | 23 |
Route::get('/category/{id}', 'ArtefactController@showCategory'); |
24 |
Route::get('/category/multi/{id}', 'ArtefactController@showCategories'); |
|
24 | 25 |
Route::get('/detail/like/{id}', 'DetailsController@like'); |
25 | 26 |
Route::get('/detail/unlike/{id}', 'DetailsController@unlike'); |
26 | 27 |
Route::resource('/detail', 'DetailsController', array('only' => array('index', 'show'))); |
Také k dispozici: Unified diff
Issue #8010 @3h
Uprava "Categories" podle specifikovaneho navrhu. Predelany ssytem vyberu categories, kde lze vybrat vice kategorii najednou a po stisknuti tlacitka ENTER se uzivatel prenese do seznamu vsech vybranych artefaktu.