Skip to content

Commit 8e378e2

Browse files
committed
Implement tasks
1 parent 0cca53f commit 8e378e2

29 files changed

+403
-60
lines changed

app/Providers/AppServiceProvider.php

+31-9
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,47 @@
22

33
namespace App\Providers;
44

5+
use Carbon\Carbon;
56
use Illuminate\Support\Facades\File;
67
use Illuminate\Support\ServiceProvider;
78
use Statamic\Entries\Entry;
89
use Statamic\Facades\Collection;
910

1011
class AppServiceProvider extends ServiceProvider
1112
{
12-
/**
13-
* Register any application services.
14-
*/
15-
public function register(): void
13+
public function boot(): void
1614
{
17-
//
15+
$this->bootCarbon();
16+
$this->bootCollections();
1817
}
1918

20-
/**
21-
* Bootstrap any application services.
22-
*/
23-
public function boot(): void
19+
protected function bootCarbon(): void
20+
{
21+
Carbon::macro('display', function ($format = 'datetime') {
22+
/** @var Carbon $date */
23+
$date = $this; // @phpstan-ignore-line
24+
25+
switch ($format) {
26+
case 'date-short':
27+
return $date->format('M d, Y');
28+
case 'date':
29+
return $date->format('F d, Y');
30+
case 'time':
31+
return $date->format('H:i');
32+
case 'month':
33+
return $date->format('F Y');
34+
case 'month-short':
35+
return $date->format('M Y');
36+
case 'datetime-short':
37+
return $date->format('M d, Y H:i');
38+
case 'datetime':
39+
default:
40+
return $date->format('F d, Y H:i');
41+
}
42+
});
43+
}
44+
45+
protected function bootCollections(): void
2446
{
2547
Collection::computed('posts', 'summary', function (Entry $entry) {
2648
if (! isset($entry->content) || ! is_string($entry->content)) {

content/collections/comments.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
title: Comments
2+
revisions: false
3+
title_format: '{{task:title}} comment'
4+
slugs: false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
id: reading-musashi-by-eiji-yoshikawa-1
3+
blueprint: comment
4+
title: 'Reading Musashi by Eiji Yoshikawa - 1'
5+
task: 'entry::reading-musashi-by-eiji-yoshikawa'
6+
publication_date: '2018-11-20 13:34:04'
7+
---
8+
9+
Well, it is time. I finished part 6 so I'll now start reading the last one: Book VII - The Perfect Light.
10+
11+
I'll surely miss reading Musashi. Some people don't enjoy long stories, but I'm quite the opposite. Once I become familiar with the characters, as long as it maintains its quality, I wouldn't mind it running forever.
12+
13+
Of course, it's very difficult to maintain quality for long before it starts degrading. That's why I believe authors should end on their own terms, instead of dragging it. And there's no denying the value of a good ending.
14+
15+
Looking forward to the climax!
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
id: reading-musashi-by-eiji-yoshikawa-2
3+
blueprint: comment
4+
title: 'Reading Musashi by Eiji Yoshikawa - 2'
5+
task: 'entry::reading-musashi-by-eiji-yoshikawa'
6+
publication_date: '2018-12-05 02:57:55'
7+
---
8+
9+
I just finished reading this book and it's for sure one of the best I've ever read. I'm even considering replacing my favourite book: the Sherlock Holmes Anthology. But it's too soon to say.
10+
11+
I'm not closing the task yet because I want to review the notes I took and do some summary. The book is very long and there are a ton of gems within, so it's only fair to take some time to digest it.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
id: reading-musashi-by-eiji-yoshikawa-3
3+
blueprint: comment
4+
title: 'Reading Musashi by Eiji Yoshikawa - 3'
5+
task: 'entry::reading-musashi-by-eiji-yoshikawa'
6+
publication_date: '2018-12-14 01:55:41'
7+
---
8+
9+
After looking over my notes, I decided to publish some of them in a [blog post](https://noeldemartin.com/blog/lessons-learned-musashi-by-eiji-yoshikawa). I'd have liked to use some images from the manga Vagabond, but I couldn't find anything good that was available without copyright infringements. So I ended up using the image that's found in Musashi's wikipedia page. But you should [check them out](https://duckduckgo.com/?q=vagabond+takehiko+inoue+illustrations&atb=v1-1&t=h_&iar=images&iax=images&ia=images)!
10+
11+
I see myself coming back to review this book at some point, because it was so awesome. But for now, that's it for this Task.

content/collections/pages/tasks.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
id: tasks
3+
blueprint: page
4+
title: Tasks
5+
template: tasks/index
6+
---

content/collections/posts/starting-something-new.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
id: starting-something-new
33
blueprint: post
44
title: 'Starting Something New'
5-
publication_date: '2014-11-10'
5+
publication_date: '2014-11-10 11:41'
66
---
77

88
There is a feeling I enjoy a lot. The feeling of Starting Something New.

content/collections/projects/beastmasters-project.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: beastmasters-project
33
blueprint: project
4-
title: beastmasters
4+
title: Beast Masters
55
category: discontinued
66
logo: /img/logos/beastmasters.png
77
link: 'entry::beastmasters'

content/collections/tasks.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
title: Tasks
2+
template: tasks/show
3+
mount: tasks
4+
revisions: false
5+
route: '/{mount}/{slug}'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
id: reading-musashi-by-eiji-yoshikawa
3+
blueprint: task
4+
title: 'Reading Musashi by Eiji Yoshikawa'
5+
publication_date: '2018-11-12 18:30:48'
6+
completion_date: '2018-12-14 01:55:56'
7+
---
8+
9+
I first heard about this book on Jocko Willink's podcast [episode 50](http://jockopodcast.com/2016/11/23/50-with-tim-ferriss-darkness-how-to-stay-on-the-path-last-days-of-life-what-to-do-back-up-plans-misconceptions/). Him and Tim Ferriss recommended it effusively. Considering that I enjoy their content and I love japanese culture, I decided to give it a shot.
10+
11+
Man, was it a good choice. The book is very long (1000+ pages), but I'm enjoying it a lot and I don't want it to end. It's divided in 7 parts and I'm currently reading the 6th.
12+
13+
I didn't realize it at first, but turns out one of my favourite manga, [Vagabond](https://en.wikipedia.org/wiki/Vagabond_%28manga%29), is based on the book. I love Takehiko Inoue's artwork, so it's awesome to recall his drawings while reading the book.

content/navigation/main.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
title: Main
2+
collections:
3+
- pages

content/trees/collections/pages.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ tree:
55
children:
66
- entry: beastmasters
77
- entry: geemba
8+
- entry: tasks

content/trees/navigation/main.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
tree:
2+
- id: home-nav
3+
entry: home
4+
- id: blog-nav
5+
entry: blog
6+
- id: projects-nav
7+
entry: projects
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
title: Comment
2+
tabs:
3+
main:
4+
display: Main
5+
sections:
6+
- fields:
7+
- handle: task
8+
field:
9+
collections:
10+
- tasks
11+
type: link
12+
display: Task
13+
validate:
14+
- required
15+
- handle: content
16+
field:
17+
type: markdown
18+
display: Content
19+
antlers: true
20+
- handle: publication_date
21+
field:
22+
type: date
23+
time_enabled: true
24+
time_seconds_enabled: true
25+
required: true
26+
display: 'Publication date'
27+
validate:
28+
- required

resources/blueprints/collections/pages/page.yaml

-7
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,3 @@ tabs:
3838
field:
3939
type: text
4040
display: Icon
41-
- handle: parent
42-
field:
43-
type: entries
44-
collections:
45-
- pages
46-
max_items: 1
47-
listable: false

resources/blueprints/collections/posts/post.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,9 @@ tabs:
2626
- handle: publication_date
2727
field:
2828
type: date
29+
time_enabled: true
30+
time_seconds_enabled: true
31+
required: true
2932
display: 'Publication date'
33+
validate:
34+
- required
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
title: Task
2+
tabs:
3+
main:
4+
display: Main
5+
sections:
6+
- fields:
7+
- handle: title
8+
field:
9+
type: text
10+
required: true
11+
validate:
12+
- required
13+
- handle: content
14+
field:
15+
type: markdown
16+
display: Content
17+
antlers: true
18+
sidebar:
19+
display: Sidebar
20+
sections:
21+
- fields:
22+
- handle: slug
23+
field:
24+
type: slug
25+
validate: 'max:200'
26+
- handle: publication_date
27+
field:
28+
type: date
29+
time_enabled: true
30+
time_seconds_enabled: true
31+
display: 'Publication date'
32+
validate:
33+
- required
34+
- handle: completion_date
35+
field:
36+
type: date
37+
time_enabled: true
38+
time_seconds_enabled: true
39+
display: 'Completion date'

resources/blueprints/default.yaml

-11
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,8 @@ fields:
44
field:
55
type: text
66
required: true
7-
width: 75
87
validate:
98
- required
10-
- handle: show_title
11-
field:
12-
type: toggle
13-
display: 'Show title'
14-
width: 25
15-
default: true
16-
- handle: icon
17-
field:
18-
type: text
19-
display: Icon
209
- handle: content
2110
field:
2211
type: markdown

resources/blueprints/user.yaml

-24
This file was deleted.

resources/css/base.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ main {
5050
}
5151

5252
hr {
53-
@apply bg-grey-dark mt-4 h-px;
53+
@apply border-grey-dark mt-4 h-px;
5454
}
5555

5656
img,

resources/views/blog/index.blade.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
@section('main')
44
<h1 class="sr-only">Blog</h1>
55

6-
<statamic:collection :from="$mount">
6+
<s:collection :from="$mount" sort="publication_date:desc">
77
<x-content-card :$title :$url :date="$publication_date">
88
{!! $summary !!}
99
</x-content-card>
10-
</statamic:collection>
10+
</s:collection>
1111
@endsection
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
@php($tag = $tag ?? 'div')
2+
@php($short = $short ?? false)
3+
4+
<{{ $tag }}
5+
class="{{ $short ? 'md:mb-2 md:flex-row md:items-center' : '' }} mb-4 flex flex-col items-start"
6+
{{ $attributes->only('id') }}
7+
>
8+
<time
9+
class="bg-blue-lighter text-blue-darker flex-shrink-0 self-start rounded-lg px-2 py-1 font-mono text-sm"
10+
datetime="{{ $date->toDateTimeString() }}"
11+
>
12+
@if ($short)
13+
<span class="block md:hidden">
14+
{{ $date->display('datetime') }}
15+
</span>
16+
<span class="hidden md:block">
17+
{{ $date->display('datetime-short') }}
18+
</span>
19+
@else
20+
{{ $date->display('datetime') }}
21+
@endif
22+
</time>
23+
24+
<div
25+
class="{{ $short ? '' : 'md:ml-4' }} ml-2 [&_pre]:max-w-[calc(100vw-2*theme('spacing.4')-theme('spacing.2'))]"
26+
>
27+
{!! $slot !!}
28+
</div>
29+
</{{ $tag }}>

resources/views/components/project-cards.blade.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<h2 class="{{ $titleClass ?? 'mt-8' }} font-bold">{{ $title }}</h2>
22

33
<ul class="ml-0 grid list-none grid-cols-1 gap-4 pl-0 md:grid-cols-2">
4-
<statamic:collection from="projects" :category:is="$category">
4+
<s:collection from="projects" :category:is="$category">
55
<x-card
66
:$title
77
:$state
@@ -15,5 +15,5 @@
1515
{{ content }}
1616
@endantlers
1717
</x-card>
18-
</statamic:collection>
18+
</s:collection>
1919
</ul>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<svg
2+
class="{{ class ?? '' }}"
3+
xmlns="http://www.w3.org/2000/svg"
4+
viewBox="0 0 20 20"
5+
>
6+
<path d="M0 11l2-2 5 5L18 3l2 2L7 18z" />
7+
</svg>

0 commit comments

Comments
 (0)