Skip to content

Commit 10fe70b

Browse files
committed
PoC para página de autores de artigos;
1 parent 17b3676 commit 10fe70b

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<div class="box">
2+
<article class="media">
3+
<div class="media-left">
4+
<figure class="image is-64x64">
5+
<?php $emailHash = md5(strtolower(trim($author->authorEmail))); ?>
6+
<img class="is-rounded" src="https://www.gravatar.com/avatar/{{$emailHash}}?s=64&d=retro&r=g"
7+
alt="Gravatar de {{ $author->author }}">
8+
</figure>
9+
<div class="content">
10+
<p>{{ $authorsPostsCount[$author->author] }} <?php echo $authorsPostsCount[$author->author] > 1 ? 'artigos':'artigo'; ?></p>
11+
</div>
12+
</div>
13+
<div class="media-content">
14+
<div class="content">
15+
<p>
16+
<strong>{{ $author->author }}</strong>
17+
<small>@johnsmith</small>
18+
<small>31m</small>
19+
<br>
20+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean efficitur sit amet massa
21+
fringilla egestas. Nullam condimentum luctus turpis.
22+
</p>
23+
</div>
24+
</div>
25+
</article>
26+
</div>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
$authors = [];
3+
$authorsPostsCount = [];
4+
5+
foreach ($posts as $post) {
6+
if (!array_key_exists($post->author, $authorsPostsCount)) {
7+
$authorsPostsCount[$post->author] = 0;
8+
$authors[] = (object)[
9+
'author' => $post->author,
10+
'authorEmail' => $post->authorEmail,
11+
];
12+
}
13+
14+
++$authorsPostsCount[$post->author];
15+
}
16+
17+
$columns = 3;
18+
$count = 0;
19+
?>
20+
@if (count($authors) > 0)
21+
<div class="tile is-ancestor">
22+
@foreach ($authors as $author)
23+
<div class="tile is-parent is-4">
24+
@include('_partials.content.authors.grid-item', ['author' => $author, 'postCount' => $authorsPostsCount])
25+
</div>
26+
@if(++$count % $columns === 0)
27+
</div>
28+
<div class="tile is-ancestor">
29+
@endif
30+
@endforeach
31+
</div>
32+
@endif

source/autores.blade.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
?>
4+
@extends('_layouts.master')
5+
6+
@section('body')
7+
8+
<section class="section">
9+
<div class="content">
10+
<h1 class="title is-1">Autores</h1>
11+
@include('_partials.content.authors.grid')
12+
</div>
13+
14+
{{-- @include('_partials.layout.pagination')--}}
15+
</section>
16+
@endsection
17+

0 commit comments

Comments
 (0)