Commit adf0a4d2 authored by Luc Didry's avatar Luc Didry

Themes system

parent 2ccd065e
......@@ -16,7 +16,7 @@ test:
clean:
rm -rf lufi.db files/
dev: clean
$(CARTON) morbo $(LUFI) --listen http://0.0.0.0:3000
$(CARTON) morbo $(LUFI) --listen http://0.0.0.0:3000 --watch lib/ --watch script/ --watch themes/
devlog:
multitail log/development.log
......
......@@ -11,7 +11,7 @@ sub startup {
my $config = $self->plugin('Config' => {
default => {
provisioning => 100,
provisioning => 100,
provis_step => 5,
length => 10,
token_length => 32,
......@@ -21,11 +21,20 @@ sub startup {
mail => {
how => 'sendmail'
},
mail_sender => 'no-reply@lufi.io'
mail_sender => 'no-reply@lufi.io',
theme => 'default',
}
});
die "You need to provide a contact information in lufi.conf!" unless (defined($config->{contact}));
die "You need to provide a contact information in lufi.conf!" unless (defined($self->config('contact')));
# Themes handling
shift @{$self->app->renderer->paths};
if ($config->{theme} ne 'default') {
my $theme = $self->home->rel_dir('themes/'.$config->{theme});
push @{$self->renderer->paths}, $theme.'/templates' if -d $theme.'/templates';
}
push @{$self->renderer->paths}, $self->home->rel_dir('themes/default/templates');
# Mail config
my $mail_config = {
......@@ -43,7 +52,7 @@ sub startup {
# Debug
$self->plugin('DebugDumperHelper');
$self->secrets($config->{secrets});
$self->secrets($self->config('secrets'));
# Helpers
$self->helper(
......
......@@ -13,11 +13,20 @@ sub startup {
{
file => File::Spec->catfile($Bin, '..' ,'lufi.conf'),
default => {
prefix => '/'
prefix => '/',
theme => 'default',
}
}
);
# Themes handling
shift @{$self->static->paths};
if ($config->{theme} ne 'default') {
my $theme = $self->home->rel_dir('themes/'.$config->{theme});
push @{$self->static->paths}, $theme.'/public' if -d $theme.'/public';
}
push @{$self->static->paths}, $self->home->rel_dir('themes/default/public');
$self->plugin('Mount' => {$config->{prefix} => File::Spec->catfile($Bin, '..', 'script', 'application')});
}
......
......@@ -20,6 +20,10 @@
# optional, default is ['fdjsofjoihrei'], PLEASE, CHANGE IT
#secrets => ['fdjsofjoihrei'],
# choose a theme. See the available themes in `themes` directory
# optional, default is 'default'
#theme => 'default',
# length of the random URL
# optional, default is 8
#length => 8,
......
templates/layouts/default.html.ep
templates/index.html.ep
templates/delays.html.ep
templates/files.html.ep
templates/mail.html.ep
templates/msg.html.ep
templates/render.html.ep
templates/about.html.ep
themes/default/templates/layouts/default.html.ep
themes/default/templates/index.html.ep
themes/default/templates/delays.html.ep
themes/default/templates/files.html.ep
themes/default/templates/mail.html.ep
themes/default/templates/msg.html.ep
themes/default/templates/render.html.ep
themes/default/templates/about.html.ep
lib/Lufi/Controller/Files.pm
lib/Lufi/Controller/Mail.pm
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment