Revize bfa73340
Přidáno uživatelem Adam Mištera před téměř 5 roky(ů)
app/Http/Controllers/ArtefactController.php | ||
---|---|---|
5 | 5 |
use App\Artefact; |
6 | 6 |
use App\ArtefactCategory; |
7 | 7 |
use App\Category; |
8 |
use App\Metadata; |
|
9 |
use App\User; |
|
8 | 10 |
use Illuminate\Http\Request; |
11 |
use Illuminate\Support\Facades\Auth; |
|
9 | 12 |
use Illuminate\Support\Facades\DB; |
10 | 13 |
|
11 | 14 |
class ArtefactController extends Controller |
... | ... | |
61 | 64 |
{ |
62 | 65 |
$artefact = Artefact::find($id); |
63 | 66 |
$artefact['likes'] = Artefact::find($id)->users()->count(); |
67 |
$artefact['favourite'] = is_null(User::find(Auth::id())->likesArtefacts()->find($id)) ? false : true; |
|
64 | 68 |
|
65 | 69 |
return view('artefact.view', ['artefact' => $artefact]); |
66 | 70 |
} |
71 |
|
|
72 |
/** |
|
73 |
* Likes metadata given by its id. |
|
74 |
* |
|
75 |
* @param $id int id of metadata |
|
76 |
* @return \Illuminate\Http\RedirectResponse |
|
77 |
*/ |
|
78 |
public function like($id) |
|
79 |
{ |
|
80 |
$user = User::find(Auth::id()); |
|
81 |
$artefact = Artefact::find($id); |
|
82 |
|
|
83 |
$user->likesArtefacts()->attach($artefact); |
|
84 |
|
|
85 |
return back()->withInput(); |
|
86 |
} |
|
87 |
|
|
88 |
/** |
|
89 |
* Unlikes metadata given by its id. |
|
90 |
* |
|
91 |
* @param $id int id of metadata |
|
92 |
* @return \Illuminate\Http\RedirectResponse |
|
93 |
*/ |
|
94 |
public function unlike($id) |
|
95 |
{ |
|
96 |
$user = User::find(Auth::id()); |
|
97 |
$artefact = Artefact::find($id); |
|
98 |
|
|
99 |
$user->likesArtefacts()->detach($artefact); |
|
100 |
|
|
101 |
return back()->withInput(); |
|
102 |
} |
|
67 | 103 |
} |
public/css/app.css | ||
---|---|---|
11308 | 11308 |
} |
11309 | 11309 |
|
11310 | 11310 |
body .artefact-area .inter_like:before { |
11311 |
background-image: url(/images/Hearth_Empty_Small.png?252b4c7a69920aa18f2fc75a93aaa90a); |
|
11312 |
width: 25px; |
|
11313 |
height: 19px; |
|
11311 |
background-image: url(/images/Heart_Empty.svg?974f069a126736e569df0f463d68c026); |
|
11312 |
width: 1.563rem; |
|
11313 |
height: 1.25rem; |
|
11314 |
} |
|
11315 |
|
|
11316 |
body .artefact-area .inter_like_filled:before { |
|
11317 |
background-image: url(/images/Heart_Filled.svg?e5b962dc0fd67a2042277b9826016c9c); |
|
11318 |
width: 1.563rem; |
|
11319 |
height: 1.25rem; |
|
11314 | 11320 |
} |
11315 | 11321 |
|
11316 | 11322 |
body .artefact-area .inter_info { |
... | ... | |
11318 | 11324 |
} |
11319 | 11325 |
|
11320 | 11326 |
body .artefact-area .inter_info:before { |
11321 |
background-image: url(/images/Button_Info_Small.png?9bc35ac07e9ec5a6b75d9af964e80512);
|
|
11322 |
width: 29px;
|
|
11323 |
height: 29px;
|
|
11327 |
background-image: url(/images/Button_Info.svg?92f55a6c483b585543ec80f3fd3461de);
|
|
11328 |
width: 1.875rem;
|
|
11329 |
height: 1.875rem;
|
|
11324 | 11330 |
} |
11325 | 11331 |
|
11326 | 11332 |
body .artefact-area .artefact-likes { |
... | ... | |
11440 | 11446 |
box-shadow: none !important; |
11441 | 11447 |
} |
11442 | 11448 |
|
11449 |
body .modal { |
|
11450 |
font-weight: 400; |
|
11451 |
color: #ddd1b9; |
|
11452 |
font-size: 8pt; |
|
11453 |
} |
|
11454 |
|
|
11455 |
body .modal .modal-header { |
|
11456 |
border-bottom: 1px solid #ddd1b9; |
|
11457 |
} |
|
11458 |
|
|
11459 |
body .modal .modal-header .close { |
|
11460 |
color: #ddd1b9; |
|
11461 |
text-shadow: none; |
|
11462 |
} |
|
11463 |
|
|
11464 |
body .modal .modal-content { |
|
11465 |
background-color: #272727; |
|
11466 |
} |
|
11467 |
|
|
11468 |
body .modal .modal-footer { |
|
11469 |
border-top: 1px solid #ddd1b9; |
|
11470 |
} |
|
11471 |
|
|
11472 |
body .modal .modal-footer .btn { |
|
11473 |
background-color: #ddd1b9; |
|
11474 |
color: #272727; |
|
11475 |
} |
|
11476 |
|
|
11477 |
body .image-modal .close { |
|
11478 |
font-size: 24pt; |
|
11479 |
color: #ddd1b9; |
|
11480 |
text-shadow: none; |
|
11481 |
position: absolute; |
|
11482 |
top: 1rem; |
|
11483 |
right: 0.125rem; |
|
11484 |
opacity: 1; |
|
11485 |
cursor: pointer; |
|
11486 |
pointer-events: initial; |
|
11487 |
} |
|
11488 |
|
|
11443 | 11489 |
body .cat-col-md-2 { |
11444 | 11490 |
margin: 2%; |
11445 | 11491 |
} |
public/images/Button_Info.svg | ||
---|---|---|
1 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.17 14.17"><defs><style>.cls-1{fill:#ead4b0;}.cls-2{fill:#1d1d1b;}</style></defs><title>Datový zdroj 1</title><g id="Vrstva_2" data-name="Vrstva 2"><g id="Vrstva_1-2" data-name="Vrstva 1"><circle class="cls-1" cx="7.09" cy="7.09" r="7.09"/><path class="cls-2" d="M6.47,4.1a.74.74,0,0,1,.24-.56.74.74,0,0,1,.56-.24.76.76,0,0,1,.56.24.73.73,0,0,1,.23.56.79.79,0,0,1-.79.79.73.73,0,0,1-.56-.23A.76.76,0,0,1,6.47,4.1Zm.11,1.4H8V9.93H6.58Z"/></g></g></svg> |
public/images/Heart_Empty.svg | ||
---|---|---|
1 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30.14 23.15"><defs><style>.cls-1{fill:none;stroke:#f7dbc0;stroke-miterlimit:10;}</style></defs><title>Datový zdroj 1</title><g id="Vrstva_2" data-name="Vrstva 2"><g id="Vrstva_1-2" data-name="Vrstva 1"><path class="cls-1" d="M15.07,22.53s12.44-9.37,13.31-10.78c2.15-3.54,2-9.09-4-10.93-5.44-1.68-9.3,3.84-9.3,3.84S11.21-.86,5.77.82c-6,1.84-6.16,7.39-4,10.93C2.63,13.16,15.07,22.53,15.07,22.53Z"/></g></g></svg> |
resources/images/interface/Button_Info.svg | ||
---|---|---|
1 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.17 14.17"><defs><style>.cls-1{fill:#ead4b0;}.cls-2{fill:#1d1d1b;}</style></defs><title>Datový zdroj 1</title><g id="Vrstva_2" data-name="Vrstva 2"><g id="Vrstva_1-2" data-name="Vrstva 1"><circle class="cls-1" cx="7.09" cy="7.09" r="7.09"/><path class="cls-2" d="M6.47,4.1a.74.74,0,0,1,.24-.56.74.74,0,0,1,.56-.24.76.76,0,0,1,.56.24.73.73,0,0,1,.23.56.79.79,0,0,1-.79.79.73.73,0,0,1-.56-.23A.76.76,0,0,1,6.47,4.1Zm.11,1.4H8V9.93H6.58Z"/></g></g></svg> |
resources/sass/_custom.scss | ||
---|---|---|
350 | 350 |
} |
351 | 351 |
} |
352 | 352 |
|
353 |
|
|
353 |
// Artefact area |
|
354 | 354 |
.artefact-area { |
355 | 355 |
|
356 | 356 |
.card-cus-bottom { |
... | ... | |
381 | 381 |
display: block; |
382 | 382 |
|
383 | 383 |
&:before { |
384 |
background-image: url(../images/interface/Hearth_Empty_Small.png); |
|
385 |
width: 25px; |
|
386 |
height: 19px; |
|
384 |
background-image: url(../images/interface/Heart_Empty.svg); |
|
385 |
width: 1.563rem; |
|
386 |
height: 1.25rem; |
|
387 |
} |
|
388 |
} |
|
389 |
|
|
390 |
.inter_like_filled { |
|
391 |
&:before { |
|
392 |
background-image : url(../images/interface/Heart_Filled.svg); |
|
393 |
width: 1.563rem; |
|
394 |
height: 1.25rem; |
|
387 | 395 |
} |
388 | 396 |
} |
389 | 397 |
|
... | ... | |
391 | 399 |
|
392 | 400 |
padding-right: 1rem; |
393 | 401 |
&:before { |
394 |
background-image: url(../images/interface/Button_Info_Small.png);
|
|
395 |
width: 29px;
|
|
396 |
height: 29px;
|
|
402 |
background-image: url(../images/interface/Button_Info.svg);
|
|
403 |
width: 1.875rem;
|
|
404 |
height: 1.875rem;
|
|
397 | 405 |
} |
398 | 406 |
} |
399 | 407 |
|
... | ... | |
522 | 530 |
} |
523 | 531 |
} |
524 | 532 |
|
533 |
// Modal |
|
534 |
.modal { |
|
535 |
font-weight: $font-weight-one; |
|
536 |
color: $theme-color-two; |
|
537 |
font-size: 8pt; |
|
538 |
|
|
539 |
.modal-header { |
|
540 |
border-bottom: 1px solid $theme-color-two; |
|
541 |
|
|
542 |
.close { |
|
543 |
color: $theme-color-two; |
|
544 |
text-shadow: none; |
|
545 |
} |
|
546 |
} |
|
547 |
|
|
548 |
.modal-content { |
|
549 |
background-color: $theme-color-five; |
|
550 |
} |
|
551 |
|
|
552 |
.modal-footer { |
|
553 |
border-top: 1px solid $theme-color-two; |
|
554 |
|
|
555 |
.btn { |
|
556 |
background-color: $theme-color-two; |
|
557 |
color: $theme-color-five; |
|
558 |
|
|
559 |
} |
|
560 |
} |
|
561 |
} |
|
562 |
|
|
563 |
.image-modal { |
|
564 |
.close { |
|
565 |
font-size: 24pt; |
|
566 |
color: $theme-color-two; |
|
567 |
text-shadow: none; |
|
568 |
position: absolute; |
|
569 |
top: 1rem; |
|
570 |
right: 0.125rem; |
|
571 |
opacity: 1; |
|
572 |
cursor: pointer; |
|
573 |
pointer-events: initial; |
|
574 |
} |
|
575 |
} |
|
576 |
|
|
525 | 577 |
/*.content { |
526 | 578 |
position: relative; |
527 | 579 |
|
... | ... | |
553 | 605 |
} |
554 | 606 |
}*/ |
555 | 607 |
|
556 |
|
|
557 |
|
|
558 | 608 |
//CATEGORIES - ROW BLOCK |
559 | 609 |
.cat-col-md-2 |
560 | 610 |
{ |
resources/views/artefact/view.blade.php | ||
---|---|---|
18 | 18 |
@else |
19 | 19 |
<div class="artefact-area mb-5"> |
20 | 20 |
<div class="card"> |
21 |
<a href="{{ url('/artefact/' . $artefact->id) }}">
|
|
21 |
<a href="#imageModal" data-toggle="modal">
|
|
22 | 22 |
<img class="card-img-top" src="{{asset('images/artefacts/book_cover_01.jpg')}}" width="100%" height=auto alt="book_cover"> |
23 | 23 |
</a> |
24 | 24 |
<div class="card-cus-bottom"> |
... | ... | |
28 | 28 |
</div> |
29 | 29 |
<div class="col-xs-2 float-right right_panel_info"> |
30 | 30 |
<div class="float-left"> |
31 |
<button id="info_butt_{{$artefact->id}}" type="button" class="btn btn-primary button-image inter_info"></button>
|
|
31 |
<button type="button" class="btn btn-primary button-image inter_info" data-toggle="modal" data-target="#informationModal"></button>
|
|
32 | 32 |
</div> |
33 | 33 |
<div class="float-right text-center"> |
34 |
<button id="like_butt_{{$artefact->id}}" type="button" class="btn btn-primary button-image inter_like"></button> |
|
34 |
@if ($artefact->favourite) |
|
35 |
<a href="{{ action('ArtefactController@unlike', ['id' => $artefact->id]) }}"> |
|
36 |
<button id="like_butt_{{$artefact->id}}" type="button" class="btn btn-primary button-image inter_like_filled"></button> |
|
37 |
</a> |
|
38 |
@else |
|
39 |
<a href="{{ action('ArtefactController@like', ['id' => $artefact->id]) }}"> |
|
40 |
<button id="like_butt_{{$artefact->id}}" type="button" class="btn btn-primary button-image inter_like"></button> |
|
41 |
</a> |
|
42 |
|
|
43 |
@endif |
|
35 | 44 |
<h6 class="artefact-likes">{{$artefact->likes}}</h6> |
36 | 45 |
</div> |
37 | 46 |
</div> |
... | ... | |
40 | 49 |
</div> |
41 | 50 |
@endif |
42 | 51 |
</div> |
52 |
|
|
53 |
<!-- Image modal --> |
|
54 |
<div class="modal image-modal fade" id="imageModal" tabindex="-1" role="dialog"> |
|
55 |
<div class="modal-dialog modal-dialog-centered" role="document"> |
|
56 |
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|
57 |
<span aria-hidden="true">×</span> |
|
58 |
</button> |
|
59 |
<div class="modal-content"> |
|
60 |
<img class="card-img-top" src="{{asset('images/artefacts/book_cover_01.jpg')}}" width="100%" height=auto alt="book_cover"> |
|
61 |
</div> |
|
62 |
</div> |
|
63 |
</div> |
|
64 |
|
|
65 |
<!-- Information modal --> |
|
66 |
<div class="modal fade" id="informationModal" tabindex="-1" role="dialog"> |
|
67 |
<div class="modal-dialog modal-dialog-centered" role="document"> |
|
68 |
<div class="modal-content"> |
|
69 |
<div class="modal-header"> |
|
70 |
<h5 class="modal-title">{{$artefact->name}} - {{$artefact->author}}</h5> |
|
71 |
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
|
72 |
<span aria-hidden="true">×</span> |
|
73 |
</button> |
|
74 |
</div> |
|
75 |
<div class="modal-body"> |
|
76 |
Addition information about book. |
|
77 |
</div> |
|
78 |
<div class="modal-footer"> |
|
79 |
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> |
|
80 |
</div> |
|
81 |
</div> |
|
82 |
</div> |
|
83 |
</div> |
|
43 | 84 |
@endsection |
routes/web.php | ||
---|---|---|
17 | 17 |
|
18 | 18 |
Route::get('/artefact', 'ArtefactController@default'); |
19 | 19 |
Route::get('/artefact/{id}', 'ArtefactController@view'); |
20 |
Route::get('/artefact/like/{id}', 'ArtefactController@like'); |
|
21 |
Route::get('/artefact/unlike/{id}', 'ArtefactController@unlike'); |
|
20 | 22 |
Route::get('/category/{id}', 'ArtefactController@showCategory'); |
21 | 23 |
Route::resource('/detail', 'DetailsController', array('only' => array('index', 'show'))); |
22 | 24 |
Route::resource('/categories', 'CategoriesController', array('only' => array('index'))); |
Také k dispozici: Unified diff
Issue #7997 @2h
[+] Přidání vektorového tlačítka informace
[+] Zprovoznění likování artefaktů
[+] Přidán modal pro obálku knihy
[+] Přidán modal pro informace o knize
[+] Refraktoring