32 lines
757 B
Raku
32 lines
757 B
Raku
use v6.e.PREVIEW
|
|
|
|
use Pandoc;
|
|
use JSON::Class:auth<zef:vrurg>;
|
|
|
|
use DB::Post;
|
|
|
|
#| An empty placeholder post
|
|
unit class PlaceholderPost does Post is json(:pretty);
|
|
|
|
#| Marker for disambiguation between post types in json representation, the
|
|
#| cheaty way
|
|
has Bool:D $.placeholder = True;
|
|
|
|
method title(--> Str:D) {
|
|
"Placeholder Article"
|
|
}
|
|
|
|
#| Shortcut for creating an empty placeholder post
|
|
method empty(--> PlaceholderPost:D) {
|
|
PlaceholderPost.new(
|
|
source => "/dev/null".IO,
|
|
posted-at => DateTime.now,
|
|
hidden => True,
|
|
)
|
|
}
|
|
|
|
# Override the all-slugs method to return an empty array, we don't want the
|
|
# placeholder article to be refered to as anything but its id
|
|
method all-slugs(--> Array[Str:D]) {
|
|
Array[Str:D].new
|
|
}
|