Projekt

Obecné

Profil

« Předchozí | Další » 

Revize fb354d59

Přidáno uživatelem Jiří Noháč před asi 4 roky(ů)

Issue #7957 @3h

Issue #7957 @3h

Opraveni prekryti tlacitek. Opraveni rozdeleni tlacitek po 6 do novych "rows". Odstraneni tlacitka "Enter" a pridani po stisknuti na konkretni kategorii zobrazeni vsech artefaktu prirazenych do konkretni kategorie.

Zobrazit rozdíly:

app/ArtefactCategory.php
1
<?php
2

  
3

  
4
namespace App;
5

  
6

  
7
use Illuminate\Database\Eloquent\Model;
8

  
9
class ArtefactCategory extends Model
10
{
11
    // Table Name
12
    protected $table = 'artefact_category';
13
    // Primary Key
14
    public $primaryKey = 'artefact_id';
15

  
16
    /**
17
     * Indicates if the model should be timestamped.
18
     *
19
     * @var bool
20
     */
21
    public $timestamps = false;
22
}
app/ArtefactUser.php
1
<?php
2

  
3

  
4
namespace App;
5

  
6

  
7
class ArtefactUser extends Model
8
{
9
    // Table Name
10
    protected $table = 'artefact_user';
11
    // Primary Key
12
    public $primaryKey = 'artefact_id';
13

  
14
    /**
15
     * Indicates if the model should be timestamped.
16
     *
17
     * @var bool
18
     */
19
    public $timestamps = false;
20
}
app/Http/Controllers/ArtefactController.php
3 3
namespace App\Http\Controllers;
4 4

  
5 5
use App\Artefact;
6
use App\ArtefactCategory;
7
use App\Category;
6 8
use Illuminate\Http\Request;
7 9
use Illuminate\Support\Facades\DB;
8 10

  
......
25 27
        return view('artefact.default', ['artefacts' => $artefacts]);
26 28
    }
27 29

  
30
    /**
31
     * Returns view of artefacts related to the chosen category
32
     *
33
     * @param $id       id of the category
34
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
35
     */
36
    public function showCategory($id)
37
    {
38
        $cateogryArtefacts = ArtefactCategory::where('category_id', $id)->get();
39
        if(count($cateogryArtefacts) > 0)
40
        {
41
            $artefacts = array();
42
            foreach($cateogryArtefacts as $ar)
43
            {
44
                array_push($artefacts, Artefact::where('id', $ar->artefact_id)->get());
45
            }
46
            return view('artefact.category', ['artefacts' => $artefacts]);
47
        }
48
        else
49
        {
50
            return view('artefact.category', ['artefacts' => array()]);
51
        }
52
    }
53

  
28 54
    /**
29 55
     * Returns view of single artefact given by its id.
30 56
     *
resources/sass/_custom.scss
395 395
        }
396 396
    }
397 397

  
398
    //CATEGORIES - ROW BLOCK
399
    .cat-col-md-2
400
    {
401
        margin: 2%;
402
    }
403

  
398 404
    //CATEGORIES - TILES
399 405
    .btn.btn-dark.cat-tile
400 406
    {
......
414 420
        word-wrap: break-word;
415 421

  
416 422
        //SPACING
417
        margin: 10pt 32pt;
418 423
        height: 40mm;
419
        width: 86%;
424
        width: 100%;
420 425

  
421 426
        &:active, &:focus
422 427
        {
......
428 433
        }
429 434
    }
430 435

  
431
    //CATEGORIES - enter button
432
    .btn.button-square.cat-enter-butt
436
    //CATEGORY/{id} -h2 title NO ARTEFACTS
437
    .category-h2
433 438
    {
434
        position: fixed;
435
        bottom: 8%;
436
        right: 40%;
437
        display: none;
439
        color: $theme-color-four;
438 440
    }
439

  
440 441
}
441 442

  
442 443
.arrow{
......
522 523
    {
523 524
        font-size: 23pt;
524 525
        padding-top: 50pt;
525
        margin-left: 36pt;
526 526
        white-space: nowrap;
527 527

  
528 528
    }
resources/views/artefact/category.blade.php
1
@extends('layouts.app')
2

  
3
@section('title', 'Artefacts')
4

  
5
@section('breadcrumb')
6
    <li class="breadcrumb-item"><a href="{{ url('/') }}">Home</a></li>
7
    <li class="breadcrumb-item active" aria-current="page">Artefacts</li>
8
@endsection
9

  
10

  
11
@section('content')
12
    <div class="container">
13
        <div class="jumbotron mt-5">
14
            <div class="text-center">
15
                <h1>Artefact list</h1>
16
                <p>
17
                    Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
18
                    Mauris dolor felis, sagittis at, luctus sed, aliquam non, tellus.
19
                    Fusce tellus odio, dapibus id fermentum quis, suscipit id erat.
20
                    Morbi scelerisque luctus velit. Vivamus porttitor turpis ac leo.
21
                    Morbi scelerisque luctus velit.
22
                    Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
23
                </p>
24
            </div>
25
        </div>
26

  
27
        @if (count($artefacts) === 0)
28
            <div class="text-center category-h2">
29
                <h2>Currently no artefacts available.</h2>
30
            </div>
31
        @else
32
            @foreach($artefacts as $artefact)
33
                <div class="artefacts-area mb-5">
34
                    <div class="card">
35
                        <svg class="bd-placeholder-img card-img-top" width="100%" height="180" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" focusable="false" role="img" aria-label="Placeholder: Image cap"><title>Placeholder</title><rect width="100%" height="100%" fill="#868e96"></rect><text x="45%" y="50%" fill="#dee2e6" dy=".3em">Artefact image</text></svg>
36
                        <div class="card-body">
37
                            <h5 class="card-title"><a href="{{ url('/artefact/' . $artefact[0]->id) }}">{{$artefact[0]->name}}</a> - {{$artefact[0]->author}}</h5>
38
                            <h6 class="card-subtitle mb-2 text-muted">{{$artefact[0]->year}}, {{$artefact[0]->pages}} pages</h6>
39
                            <p class="card-text">
40
                                Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
41
                                Mauris dolor felis, sagittis at, luctus sed, aliquam non, tellus.
42
                                Fusce tellus odio, dapibus id fermentum quis, suscipit id erat.
43
                                Morbi scelerisque luctus velit. Vivamus porttitor turpis ac leo.
44
                                Morbi scelerisque luctus velit.
45
                                Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
46
                            </p>
47
                        </div>
48
                    </div>
49
                </div>
50
            @endforeach
51
        @endif
52
    </div>
53

  
54
@endsection
resources/views/categories/index.blade.php
7 7
        {{--<p><?php dd($categories); ?></p>--}}
8 8
        <div class="cat-main-div" onclick="resetEnter()">
9 9
            <div class="head-title text-center">
10
                <h1>choose a few topics</h1>
10
                <h1>choose a topic</h1>
11 11
            </div>
12
            <div class="row">
13
                {{--@for($k = 1; $k <= count($categories);$k++)--}}
14
                @for($k = 0; $k < $count;$k++)
15
                    <div class="col-md-2">
16
                        <button class="btn btn-dark cat-tile" onclick="showEnterButton({{$categoryNames[$k]->id}})">
17
                            {{$categoryNames[$k]->nameCZ}}
18
                        </button>
12
            {{--@for($k = 1; $k <= count($categories);$k++)--}}
13
            @for($k = 0; $k < $count;$k++)
14
                @if($k % 6 == 0)
15
                    <div class="row">
16
                @endif
17
                    <div class="col-md-2 cat-col-md-2">
18
                        <a href="{{ url('/category/' . $categoryNames[$k]->id) }}">
19
                            <button class="btn btn-dark cat-tile">
20
                                {{$categoryNames[$k]->nameCZ}}
21
                            </button>
22
                        </a>
19 23
                    </div>
20
                @endfor
21
            </div>
22
            <div class="carousel-button">
23
                <a class="btn button-square cat-enter-butt" role="button">enter</a>
24
            </div>
24
                @if($k % 6 == 5 || $k + 1 == $count)
25
                    </div>
26
                @endif
27
            @endfor
25 28
        </div>
26
        <script>
27
            var catId = -1;
28
            var show = 0;
29

  
30
            function showEnterButton(id)
31
            {
32
                catId = id;
33
                show = 1;
34
                $(".cat-enter-butt").css('display', "inline");
35
            }
36

  
37
            function resetEnter()
38
            {
39
                if(show == 0)
40
                {
41
                    catId = -1;
42
                    $(".cat-enter-butt").css('display', "none");
43
                }
44
                show = 0;
45
            }
46
        </script>
47 29
    @else
48 30
        <ul class="list-group">
49 31
            <li class="list-group-item">
routes/web.php
17 17

  
18 18
Route::get('/artefact', 'ArtefactController@default');
19 19
Route::get('/artefact/{id}', 'ArtefactController@view');
20
Route::get('/category/{id}', 'ArtefactController@showCategory');
20 21
Route::resource('/detail', 'DetailsController', array('only' => array('index', 'show')));
21 22
Route::resource('/categories', 'CategoriesController', array('only' => array('index')));
22
Route::resource('/favartefacts', 'FavoriteArtefactsController', array('only' => array('index', 'show')));
23
Route::resource('/favartefacts', 'FavoriteArtefactsController', array('only' => array('index', 'show', 'store')));
23 24
Route::get('/favmetadata', 'FavoriteMetadataController@index');
24 25

  
26

  
25 27
Auth::routes();
26 28

  
27 29
Route::get('/home', 'HomeController@index')->name('home');

Také k dispozici: Unified diff