Themes system

This commit is contained in:
Luc Didry 2015-10-06 02:10:12 +02:00
parent 2ccd065e1d
commit adf0a4d2f2
57 changed files with 38 additions and 14 deletions

View File

@ -16,7 +16,7 @@ test:
clean: clean:
rm -rf lufi.db files/ rm -rf lufi.db files/
dev: clean 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: devlog:
multitail log/development.log multitail log/development.log

View File

@ -11,7 +11,7 @@ sub startup {
my $config = $self->plugin('Config' => { my $config = $self->plugin('Config' => {
default => { default => {
provisioning => 100, provisioning => 100,
provis_step => 5, provis_step => 5,
length => 10, length => 10,
token_length => 32, token_length => 32,
@ -21,11 +21,20 @@ sub startup {
mail => { mail => {
how => 'sendmail' 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 # Mail config
my $mail_config = { my $mail_config = {
@ -43,7 +52,7 @@ sub startup {
# Debug # Debug
$self->plugin('DebugDumperHelper'); $self->plugin('DebugDumperHelper');
$self->secrets($config->{secrets}); $self->secrets($self->config('secrets'));
# Helpers # Helpers
$self->helper( $self->helper(

View File

@ -13,11 +13,20 @@ sub startup {
{ {
file => File::Spec->catfile($Bin, '..' ,'lufi.conf'), file => File::Spec->catfile($Bin, '..' ,'lufi.conf'),
default => { 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')}); $self->plugin('Mount' => {$config->{prefix} => File::Spec->catfile($Bin, '..', 'script', 'application')});
} }

View File

@ -20,6 +20,10 @@
# optional, default is ['fdjsofjoihrei'], PLEASE, CHANGE IT # optional, default is ['fdjsofjoihrei'], PLEASE, CHANGE IT
#secrets => ['fdjsofjoihrei'], #secrets => ['fdjsofjoihrei'],
# choose a theme. See the available themes in `themes` directory
# optional, default is 'default'
#theme => 'default',
# length of the random URL # length of the random URL
# optional, default is 8 # optional, default is 8
#length => 8, #length => 8,

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 961 B

After

Width:  |  Height:  |  Size: 961 B

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1 @@
toto

View File

@ -0,0 +1 @@
toto

View File

@ -1,10 +1,10 @@
templates/layouts/default.html.ep themes/default/templates/layouts/default.html.ep
templates/index.html.ep themes/default/templates/index.html.ep
templates/delays.html.ep themes/default/templates/delays.html.ep
templates/files.html.ep themes/default/templates/files.html.ep
templates/mail.html.ep themes/default/templates/mail.html.ep
templates/msg.html.ep themes/default/templates/msg.html.ep
templates/render.html.ep themes/default/templates/render.html.ep
templates/about.html.ep themes/default/templates/about.html.ep
lib/Lufi/Controller/Files.pm lib/Lufi/Controller/Files.pm
lib/Lufi/Controller/Mail.pm lib/Lufi/Controller/Mail.pm