Revize c66c7237
Přidáno uživatelem Jiří Noháč před téměř 5 roky(ů)
app/Artefact.php | ||
---|---|---|
7 | 7 |
class Artefact extends Model |
8 | 8 |
{ |
9 | 9 |
// Table Name |
10 |
protected $table = 'artafacts';//unnecessery?
|
|
10 |
protected $table = 'artefacts';//unnecessery?
|
|
11 | 11 |
// Primary Key |
12 | 12 |
public $primaryKey = 'id';//unnecessery? |
13 | 13 |
|
app/ArtefactUser.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
namespace App; |
|
4 |
|
|
5 |
use Illuminate\Database\Eloquent\Model; |
|
6 |
|
|
7 |
class ArtefactUser extends Model |
|
8 |
{ |
|
9 |
// Table Name |
|
10 |
protected $table = 'artefact_user';//unnecessery? |
|
11 |
// Primary Key |
|
12 |
public $primaryKey = 'artefact_id';//unnecessery? |
|
13 |
|
|
14 |
/** |
|
15 |
* Indicates if the model should be timestamped. |
|
16 |
* |
|
17 |
* @var bool |
|
18 |
*/ |
|
19 |
public $timestamps = false; |
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
} |
app/Http/Controllers/DetailsController.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
namespace App\Http\Controllers; |
|
4 |
|
|
5 |
use App\ArtefactUser; |
|
6 |
use Illuminate\Http\Request; |
|
7 |
use App\Metadata; |
|
8 |
use App\Artefact; |
|
9 |
|
|
10 |
class DetailsController extends Controller |
|
11 |
{ |
|
12 |
/** |
|
13 |
* Display a listing of the resource. |
|
14 |
* |
|
15 |
* @return \Illuminate\Http\Response |
|
16 |
*/ |
|
17 |
public function index() |
|
18 |
{ |
|
19 |
$data = array( |
|
20 |
'title' => 'Welcome to the MERLOT page', |
|
21 |
); |
|
22 |
//return view('index', compact('title')); |
|
23 |
return view('index') -> with($data); |
|
24 |
} |
|
25 |
|
|
26 |
/** |
|
27 |
* Display the specified resource. |
|
28 |
* |
|
29 |
* @param int $id |
|
30 |
* @return \Illuminate\Http\Response |
|
31 |
*/ |
|
32 |
public function show($id) |
|
33 |
{ |
|
34 |
$data = array( |
|
35 |
'title' => 'Title of the BOOK', |
|
36 |
'id' => $id, |
|
37 |
'arrArtefact' => Artefact::find($id), |
|
38 |
'likes' => ArtefactUser::where('artefact_id', $id)->get(), |
|
39 |
'metadata' => Metadata::where('artefact_id', $id)->get() |
|
40 |
); |
|
41 |
return view('detail.index') -> with($data); |
|
42 |
} |
|
43 |
|
|
44 |
} |
app/Http/Controllers/PagesController.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
namespace App\Http\Controllers; |
|
4 |
|
|
5 |
use Illuminate\Http\Request; |
|
6 |
|
|
7 |
class PagesController extends Controller |
|
8 |
{ |
|
9 |
public function index() |
|
10 |
{ |
|
11 |
$title = 'Welcome to the MERLOT page'; |
|
12 |
//return view('index', compact('title')); |
|
13 |
return view('index') -> with('title', $title); |
|
14 |
} |
|
15 |
|
|
16 |
public function info() |
|
17 |
{ |
|
18 |
$title = 'Info about MERLOT'; |
|
19 |
return view('pages.info') -> with('title', $title); |
|
20 |
} |
|
21 |
|
|
22 |
public function services() |
|
23 |
{ |
|
24 |
$data = array( |
|
25 |
'title' => 'Services', |
|
26 |
'services' => ['Web design', 'Programming', 'SEO'] |
|
27 |
); |
|
28 |
return view('pages.services') -> with($data); |
|
29 |
} |
|
30 |
} |
app/Metadata.php | ||
---|---|---|
28 | 28 |
public $timestamps = false; |
29 | 29 |
|
30 | 30 |
/** |
31 |
* Get the artafact for this single metadata.
|
|
31 |
* Get the artefact for this single metadata.
|
|
32 | 32 |
*/ |
33 | 33 |
public function artefact(){ |
34 | 34 |
return $this->belongsTo('App\Artefact'); |
composer.json | ||
---|---|---|
13 | 13 |
"fruitcake/laravel-cors": "^1.0", |
14 | 14 |
"guzzlehttp/guzzle": "^6.3", |
15 | 15 |
"laravel/framework": "^7.0", |
16 |
"laravel/tinker": "^2.0" |
|
16 |
"laravel/tinker": "^2.0", |
|
17 |
"laravel/ui": "^2.0" |
|
17 | 18 |
}, |
18 | 19 |
"require-dev": { |
19 | 20 |
"facade/ignition": "^2.0", |
composer.lock | ||
---|---|---|
4 | 4 |
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", |
5 | 5 |
"This file is @generated automatically" |
6 | 6 |
], |
7 |
"content-hash": "6558f74828bca9ebecac73d90cea4b1a",
|
|
7 |
"content-hash": "f0dcbdc80776ca79d6311b8f92c5a4b5",
|
|
8 | 8 |
"packages": [ |
9 | 9 |
{ |
10 | 10 |
"name": "asm89/stack-cors", |
... | ... | |
683 | 683 |
"email": "jakub.onderka@gmail.com" |
684 | 684 |
} |
685 | 685 |
], |
686 |
"abandoned": "php-parallel-lint/php-console-color", |
|
686 | 687 |
"time": "2018-09-29T17:23:10+00:00" |
687 | 688 |
}, |
688 | 689 |
{ |
... | ... | |
729 | 730 |
} |
730 | 731 |
], |
731 | 732 |
"description": "Highlight PHP code in terminal", |
733 |
"abandoned": "php-parallel-lint/php-console-highlighter", |
|
732 | 734 |
"time": "2018-09-29T18:48:56+00:00" |
733 | 735 |
}, |
734 | 736 |
{ |
... | ... | |
946 | 948 |
], |
947 | 949 |
"time": "2020-02-05T15:00:44+00:00" |
948 | 950 |
}, |
951 |
{ |
|
952 |
"name": "laravel/ui", |
|
953 |
"version": "v2.0.1", |
|
954 |
"source": { |
|
955 |
"type": "git", |
|
956 |
"url": "https://github.com/laravel/ui.git", |
|
957 |
"reference": "47a0a1dac76f5e73803c86e1f38b2c7e0ae7fa83" |
|
958 |
}, |
|
959 |
"dist": { |
|
960 |
"type": "zip", |
|
961 |
"url": "https://api.github.com/repos/laravel/ui/zipball/47a0a1dac76f5e73803c86e1f38b2c7e0ae7fa83", |
|
962 |
"reference": "47a0a1dac76f5e73803c86e1f38b2c7e0ae7fa83", |
|
963 |
"shasum": "" |
|
964 |
}, |
|
965 |
"require": { |
|
966 |
"illuminate/console": "^7.0", |
|
967 |
"illuminate/filesystem": "^7.0", |
|
968 |
"illuminate/support": "^7.0", |
|
969 |
"php": "^7.2.5" |
|
970 |
}, |
|
971 |
"require-dev": { |
|
972 |
"mockery/mockery": "^1.0", |
|
973 |
"phpunit/phpunit": "^8.0" |
|
974 |
}, |
|
975 |
"type": "library", |
|
976 |
"extra": { |
|
977 |
"laravel": { |
|
978 |
"providers": [ |
|
979 |
"Laravel\\Ui\\UiServiceProvider" |
|
980 |
] |
|
981 |
} |
|
982 |
}, |
|
983 |
"autoload": { |
|
984 |
"psr-4": { |
|
985 |
"Laravel\\Ui\\": "src/", |
|
986 |
"Illuminate\\Foundation\\Auth\\": "auth-backend/" |
|
987 |
} |
|
988 |
}, |
|
989 |
"notification-url": "https://packagist.org/downloads/", |
|
990 |
"license": [ |
|
991 |
"MIT" |
|
992 |
], |
|
993 |
"authors": [ |
|
994 |
{ |
|
995 |
"name": "Taylor Otwell", |
|
996 |
"email": "taylor@laravel.com" |
|
997 |
} |
|
998 |
], |
|
999 |
"description": "Laravel UI utilities and presets.", |
|
1000 |
"keywords": [ |
|
1001 |
"laravel", |
|
1002 |
"ui" |
|
1003 |
], |
|
1004 |
"time": "2020-03-03T20:16:46+00:00" |
|
1005 |
}, |
|
949 | 1006 |
{ |
950 | 1007 |
"name": "league/commonmark", |
951 | 1008 |
"version": "1.3.1", |
... | ... | |
5449 | 5506 |
"platform": { |
5450 | 5507 |
"php": "^7.2.5" |
5451 | 5508 |
}, |
5452 |
"platform-dev": [] |
|
5509 |
"platform-dev": [], |
|
5510 |
"plugin-api-version": "1.1.0" |
|
5453 | 5511 |
} |
package.json | ||
---|---|---|
11 | 11 |
}, |
12 | 12 |
"devDependencies": { |
13 | 13 |
"axios": "^0.19", |
14 |
"bootstrap": "^4.0.0", |
|
14 | 15 |
"cross-env": "^7.0", |
16 |
"jquery": "^3.2", |
|
15 | 17 |
"laravel-mix": "^5.0.1", |
16 | 18 |
"lodash": "^4.17.13", |
19 |
"popper.js": "^1.12", |
|
17 | 20 |
"resolve-url-loader": "^3.1.0", |
18 | 21 |
"sass": "^1.15.2", |
19 | 22 |
"sass-loader": "^8.0.0" |
public/css/global.css | ||
---|---|---|
1 |
body{ |
|
2 |
background-color: #f8fafc; |
|
3 |
} |
resources/js/bootstrap.js | ||
---|---|---|
1 | 1 |
window._ = require('lodash'); |
2 | 2 |
|
3 |
/** |
|
4 |
* We'll load jQuery and the Bootstrap jQuery plugin which provides support |
|
5 |
* for JavaScript based Bootstrap features such as modals and tabs. This |
|
6 |
* code may be modified to fit the specific needs of your application. |
|
7 |
*/ |
|
8 |
|
|
9 |
try { |
|
10 |
window.Popper = require('popper.js').default; |
|
11 |
window.$ = window.jQuery = require('jquery'); |
|
12 |
|
|
13 |
require('bootstrap'); |
|
14 |
} catch (e) {} |
|
15 |
|
|
3 | 16 |
/** |
4 | 17 |
* We'll load the axios HTTP library which allows us to easily issue requests |
5 | 18 |
* to our Laravel back-end. This library automatically handles sending the |
... | ... | |
24 | 37 |
// broadcaster: 'pusher', |
25 | 38 |
// key: process.env.MIX_PUSHER_APP_KEY, |
26 | 39 |
// cluster: process.env.MIX_PUSHER_APP_CLUSTER, |
27 |
// forceTLS: true
|
|
40 |
// encrypted: true
|
|
28 | 41 |
// }); |
resources/sass/app.scss | ||
---|---|---|
1 |
// |
|
1 |
// Fonts |
|
2 |
@import url('https://fonts.googleapis.com/css?family=Nunito'); |
|
3 |
|
|
4 |
// Variables |
|
5 |
@import 'variables'; |
|
6 |
|
|
7 |
// Bootstrap |
|
8 |
@import '~bootstrap/scss/bootstrap'; |
resources/views/detail/index.blade.php | ||
---|---|---|
1 |
@extends('layouts.app') |
|
2 |
|
|
3 |
@section('content') |
|
4 |
<h1>{{$arrArtefact->name}}</h1> |
|
5 |
<p>The id of the book is {{$id}}</p> |
|
6 |
@if(isset($arrArtefact)) |
|
7 |
<p>{{$arrArtefact->author}}, {{$arrArtefact->year}}, {{$arrArtefact->pages}} pages, {{count($likes)}} likes</p> |
|
8 |
{{-- <p><?php dd($metadata); ?></p>--}} |
|
9 |
@if(count($metadata) >= 1) |
|
10 |
<ul class="list-group"> |
|
11 |
@foreach($metadata as $meta) |
|
12 |
<li class="list-group-item"> |
|
13 |
On {{$meta->page}} page:<br> |
|
14 |
{{$meta->noteCZ}}<br> |
|
15 |
{{$meta->noteEN}}<br> |
|
16 |
</li> |
|
17 |
<br> |
|
18 |
@endforeach |
|
19 |
</ul> |
|
20 |
@else |
|
21 |
<ul class="list-group"> |
|
22 |
<li class="list-group-item"> |
|
23 |
<h3>No notes for this BOOK were found!</h3> |
|
24 |
</li> |
|
25 |
</ul> |
|
26 |
@endif |
|
27 |
@else |
|
28 |
<ul class="list-group"> |
|
29 |
<li class="list-group-item"> |
|
30 |
<h3>Not found the Artefact in the database with number id {{$id}}!</h3> |
|
31 |
</li> |
|
32 |
</ul> |
|
33 |
@endif |
|
34 |
@endsection |
resources/views/inc/navbar.blade.php | ||
---|---|---|
1 |
<nav class="navbar navbar-expand-sm bg-dark navbar-dark"> |
|
2 |
<ul class="navbar-nav"> |
|
3 |
<a class="navbar-brand" >{{config('app.name', 'MERLOT')}}</a> |
|
4 |
<li class="nav-item active"> |
|
5 |
<a class="nav-link" href="/">Home</a> |
|
6 |
</li> |
|
7 |
<li class="nav-item"> |
|
8 |
<a class="nav-link" href="/info">Info</a> |
|
9 |
</li> |
|
10 |
<li class="nav-item"> |
|
11 |
<a class="nav-link" href="/services">Services</a> |
|
12 |
</li> |
|
13 |
</ul> |
|
14 |
</nav> |
resources/views/index.blade.php | ||
---|---|---|
1 |
@extends('layouts.app') |
|
2 |
|
|
3 |
@section('content') |
|
4 |
<div class="jumbotron text-center"> |
|
5 |
<h1>{{$title}}</h1> |
|
6 |
<p>This is the laravel application from the MERLOT Group.</p> |
|
7 |
</div> |
|
8 |
@endsection |
resources/views/layouts/app.blade.php | ||
---|---|---|
1 |
<!DOCTYPE html> |
|
2 |
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}"> |
|
3 |
<head> |
|
4 |
<meta charset="utf-8"> |
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|
6 |
<!--<link rel="stylesheet" href="{{asset('css/app.css')}}">--> |
|
7 |
|
|
8 |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|
9 |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"> |
|
10 |
<link rel="stylesheet" href="{{asset('css/global.css')}}"> |
|
11 |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> |
|
12 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script> |
|
13 |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script> |
|
14 |
|
|
15 |
<title>{{config('app.name', 'MERLOT')}}</title> |
|
16 |
</head> |
|
17 |
<body> |
|
18 |
@include('inc.navbar') |
|
19 |
<div class="container"> |
|
20 |
@yield('content') |
|
21 |
</div> |
|
22 |
</body> |
|
23 |
</html> |
resources/views/pages/info.blade.php | ||
---|---|---|
1 |
@extends('layouts.app') |
|
2 |
|
|
3 |
@section('content') |
|
4 |
<h1>{{$title}}</h1> |
|
5 |
<p>This is the laravel application from the MERLOT Group.</p> |
|
6 |
@endsection |
resources/views/pages/services.blade.php | ||
---|---|---|
1 |
@extends('layouts.app') |
|
2 |
|
|
3 |
@section('content') |
|
4 |
<h1>{{$title}}</h1> |
|
5 |
@if(count($services) > 0) |
|
6 |
<ul class="list-group"> |
|
7 |
@foreach($services as $service) |
|
8 |
<li class="list-group-item">{{$service}}</li> |
|
9 |
@endforeach |
|
10 |
</ul> |
|
11 |
@endif |
|
12 |
@endsection |
routes/web.php | ||
---|---|---|
13 | 13 |
| |
14 | 14 |
*/ |
15 | 15 |
|
16 |
Route::get('/', function () { |
|
17 |
return view('welcome'); |
|
16 |
/* |
|
17 |
Route::get('/users/{id}', function ($id) { |
|
18 |
return 'Thhis is user ' . $id; |
|
19 |
}); |
|
20 |
|
|
21 |
Route::get('/detail', function () { |
|
22 |
return view('pages.detail'); |
|
18 | 23 |
}); |
24 |
*/ |
|
25 |
|
|
26 |
Route::get('/', 'PagesController@index'); |
|
27 |
Route::get('/info', 'PagesController@info'); |
|
28 |
Route::get('/services', 'PagesController@services'); |
|
29 |
Route::resource('/detail', 'DetailsController', array('only' => array('index', 'show'))); |
|
30 |
|
|
31 |
|
Také k dispozici: Unified diff
Issue #7697 @5h
Prvotni vytvoreni detailu konkretnich metada k artefaktu plus navazani na bootstrap 4.0. Web jiz obsahuje "velmi zakladni" homepage, nasledne dve genericke stranky a pak hlavni stranku 'detail', ktera po predani id artefaktu nasledne zobrazi metadata. Viz. example 'localhost/detail/id'