Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions source/_partials/content/authors/grid-item.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<div class="box">
<article class="media">
<div class="media-left">
<figure class="image is-64x64">
<?php $emailHash = md5(strtolower(trim($author->authorEmail))); ?>
<img class="is-rounded" src="https://www.gravatar.com/avatar/{{$emailHash}}?s=64&d=retro&r=g"
alt="Gravatar de {{ $author->author }}">
</figure>
<div class="content">
<p>{{ $authorsPostsCount[$author->author] }} <?php echo $authorsPostsCount[$author->author] > 1 ? 'artigos':'artigo'; ?></p>
</div>
</div>
<div class="media-content">
<div class="content">
<p>
<strong>{{ $author->author }}</strong>
<small>@johnsmith</small>
<small>31m</small>
<br>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean efficitur sit amet massa
fringilla egestas. Nullam condimentum luctus turpis.
</p>
</div>
</div>
</article>
</div>
32 changes: 32 additions & 0 deletions source/_partials/content/authors/grid.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
$authors = [];
$authorsPostsCount = [];

foreach ($posts as $post) {
if (!array_key_exists($post->author, $authorsPostsCount)) {
$authorsPostsCount[$post->author] = 0;
$authors[] = (object)[
'author' => $post->author,
'authorEmail' => $post->authorEmail,
];
}

++$authorsPostsCount[$post->author];
}

$columns = 3;
$count = 0;
?>
@if (count($authors) > 0)
<div class="tile is-ancestor">
@foreach ($authors as $author)
<div class="tile is-parent is-4">
@include('_partials.content.authors.grid-item', ['author' => $author, 'postCount' => $authorsPostsCount])
</div>
@if(++$count % $columns === 0)
</div>
<div class="tile is-ancestor">
@endif
@endforeach
</div>
@endif
17 changes: 17 additions & 0 deletions source/autores.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

?>
@extends('_layouts.master')

@section('body')

<section class="section">
<div class="content">
<h1 class="title is-1">Autores</h1>
@include('_partials.content.authors.grid')
</div>

{{-- @include('_partials.layout.pagination')--}}
</section>
@endsection