1 package App::SCS::Plugin::Core;
3 use Module::Runtime qw(use_module);
6 no warnings::illegalproto;
9 with 'App::SCS::Role::Plugin';
11 has templates => (is => 'lazy');
13 sub _build_templates {
15 return use_module('App::SCS::PageSet')->new(
16 base_dir => io->dir($self->app->share_dir)->catdir('templates'),
18 plugin_map => $self->app->page_plugin_config->{plugin_map}
23 has includes => (is => 'lazy');
27 return use_module('App::SCS::PageSet')->new(
28 base_dir => io->dir($self->app->config->{share_dir})->catdir('includes'),
34 PageList => 'App::SCS::Plugin::Core::PagePlugin::PageList',
35 RemovePlugin => 'App::SCS::Plugin::Core::PagePlugin::RemovePlugin',
37 class => 'App::SCS::Plugin::Core::PagePlugin::Template',
38 config => sub { templates => $self->templates },
41 class => 'App::SCS::Plugin::Core::PagePlugin::Include',
42 config => sub { includes => $self->includes },
44 PageData => 'App::SCS::Plugin::Core::PagePlugin::PageData',
47 sub default_page_plugins {
54 sub page_dispatchers {
57 $self->pages->get({ path => 'index' });
60 [ 302, [ 'Location' => "/$_[1]/" ], [] ]
63 $self->pages->get({ %_ })
67 ->get({ path => 'error_404' })
68 ->$_call_if_object(with_plugin_config => Status => 404);
74 "/", map "$_/", $self->pages->all_paths;