diff --git a/Makefile b/Makefile index 9f991dc..0b85e7a 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/lib/Lufi.pm b/lib/Lufi.pm index fb818ce..58096ab 100644 --- a/lib/Lufi.pm +++ b/lib/Lufi.pm @@ -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( diff --git a/lib/Mounter.pm b/lib/Mounter.pm index 3b2c3cf..58f350e 100644 --- a/lib/Mounter.pm +++ b/lib/Mounter.pm @@ -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')}); } diff --git a/lufi.conf.template b/lufi.conf.template index 9d60070..ceeee68 100644 --- a/lufi.conf.template +++ b/lufi.conf.template @@ -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, diff --git a/public/bootstrap-config.json b/themes/default/public/bootstrap-config.json similarity index 100% rename from public/bootstrap-config.json rename to themes/default/public/bootstrap-config.json diff --git a/public/css/animation.css b/themes/default/public/css/animation.css similarity index 100% rename from public/css/animation.css rename to themes/default/public/css/animation.css diff --git a/public/css/bootstrap-theme.css b/themes/default/public/css/bootstrap-theme.css similarity index 100% rename from public/css/bootstrap-theme.css rename to themes/default/public/css/bootstrap-theme.css diff --git a/public/css/bootstrap-theme.min.css b/themes/default/public/css/bootstrap-theme.min.css similarity index 100% rename from public/css/bootstrap-theme.min.css rename to themes/default/public/css/bootstrap-theme.min.css diff --git a/public/css/bootstrap.css b/themes/default/public/css/bootstrap.css similarity index 100% rename from public/css/bootstrap.css rename to themes/default/public/css/bootstrap.css diff --git a/public/css/bootstrap.min.css b/themes/default/public/css/bootstrap.min.css similarity index 100% rename from public/css/bootstrap.min.css rename to themes/default/public/css/bootstrap.min.css diff --git a/public/css/cover.css b/themes/default/public/css/cover.css similarity index 100% rename from public/css/cover.css rename to themes/default/public/css/cover.css diff --git a/public/css/fontello-codes.css b/themes/default/public/css/fontello-codes.css similarity index 100% rename from public/css/fontello-codes.css rename to themes/default/public/css/fontello-codes.css diff --git a/public/css/fontello-embedded.css b/themes/default/public/css/fontello-embedded.css similarity index 100% rename from public/css/fontello-embedded.css rename to themes/default/public/css/fontello-embedded.css diff --git a/public/css/fontello-ie7-codes.css b/themes/default/public/css/fontello-ie7-codes.css similarity index 100% rename from public/css/fontello-ie7-codes.css rename to themes/default/public/css/fontello-ie7-codes.css diff --git a/public/css/fontello-ie7.css b/themes/default/public/css/fontello-ie7.css similarity index 100% rename from public/css/fontello-ie7.css rename to themes/default/public/css/fontello-ie7.css diff --git a/public/css/fontello.css b/themes/default/public/css/fontello.css similarity index 100% rename from public/css/fontello.css rename to themes/default/public/css/fontello.css diff --git a/public/css/lufi.css b/themes/default/public/css/lufi.css similarity index 100% rename from public/css/lufi.css rename to themes/default/public/css/lufi.css diff --git a/public/font/LICENSE.txt b/themes/default/public/font/LICENSE.txt similarity index 100% rename from public/font/LICENSE.txt rename to themes/default/public/font/LICENSE.txt diff --git a/public/font/README.txt b/themes/default/public/font/README.txt similarity index 100% rename from public/font/README.txt rename to themes/default/public/font/README.txt diff --git a/public/font/fontello.eot b/themes/default/public/font/fontello.eot similarity index 100% rename from public/font/fontello.eot rename to themes/default/public/font/fontello.eot diff --git a/public/font/fontello.svg b/themes/default/public/font/fontello.svg similarity index 100% rename from public/font/fontello.svg rename to themes/default/public/font/fontello.svg diff --git a/public/font/fontello.ttf b/themes/default/public/font/fontello.ttf similarity index 100% rename from public/font/fontello.ttf rename to themes/default/public/font/fontello.ttf diff --git a/public/font/fontello.woff b/themes/default/public/font/fontello.woff similarity index 100% rename from public/font/fontello.woff rename to themes/default/public/font/fontello.woff diff --git a/public/fontello-config.json b/themes/default/public/fontello-config.json similarity index 100% rename from public/fontello-config.json rename to themes/default/public/fontello-config.json diff --git a/public/img/favicon.png b/themes/default/public/img/favicon.png similarity index 100% rename from public/img/favicon.png rename to themes/default/public/img/favicon.png diff --git a/public/img/lufi-1-5.png b/themes/default/public/img/lufi-1-5.png similarity index 100% rename from public/img/lufi-1-5.png rename to themes/default/public/img/lufi-1-5.png diff --git a/public/img/lufi-2-5.png b/themes/default/public/img/lufi-2-5.png similarity index 100% rename from public/img/lufi-2-5.png rename to themes/default/public/img/lufi-2-5.png diff --git a/public/img/lufi-3-5.png b/themes/default/public/img/lufi-3-5.png similarity index 100% rename from public/img/lufi-3-5.png rename to themes/default/public/img/lufi-3-5.png diff --git a/public/img/lufi-4-5.png b/themes/default/public/img/lufi-4-5.png similarity index 100% rename from public/img/lufi-4-5.png rename to themes/default/public/img/lufi-4-5.png diff --git a/public/img/lufi-5-5.png b/themes/default/public/img/lufi-5-5.png similarity index 100% rename from public/img/lufi-5-5.png rename to themes/default/public/img/lufi-5-5.png diff --git a/public/img/lufi-min.png b/themes/default/public/img/lufi-min.png similarity index 100% rename from public/img/lufi-min.png rename to themes/default/public/img/lufi-min.png diff --git a/public/img/lufi.png b/themes/default/public/img/lufi.png similarity index 100% rename from public/img/lufi.png rename to themes/default/public/img/lufi.png diff --git a/public/img/lufi.svg b/themes/default/public/img/lufi.svg similarity index 100% rename from public/img/lufi.svg rename to themes/default/public/img/lufi.svg diff --git a/public/img/lufi.xcf b/themes/default/public/img/lufi.xcf similarity index 100% rename from public/img/lufi.xcf rename to themes/default/public/img/lufi.xcf diff --git a/public/img/lufi120.png b/themes/default/public/img/lufi120.png similarity index 100% rename from public/img/lufi120.png rename to themes/default/public/img/lufi120.png diff --git a/public/img/lufi128.png b/themes/default/public/img/lufi128.png similarity index 100% rename from public/img/lufi128.png rename to themes/default/public/img/lufi128.png diff --git a/public/img/lufi152.png b/themes/default/public/img/lufi152.png similarity index 100% rename from public/img/lufi152.png rename to themes/default/public/img/lufi152.png diff --git a/public/img/lufi196.png b/themes/default/public/img/lufi196.png similarity index 100% rename from public/img/lufi196.png rename to themes/default/public/img/lufi196.png diff --git a/public/img/lufi60.png b/themes/default/public/img/lufi60.png similarity index 100% rename from public/img/lufi60.png rename to themes/default/public/img/lufi60.png diff --git a/public/img/lufi76.png b/themes/default/public/img/lufi76.png similarity index 100% rename from public/img/lufi76.png rename to themes/default/public/img/lufi76.png diff --git a/public/img/lufi_favicon.png b/themes/default/public/img/lufi_favicon.png similarity index 100% rename from public/img/lufi_favicon.png rename to themes/default/public/img/lufi_favicon.png diff --git a/public/js/lufi-down.js b/themes/default/public/js/lufi-down.js similarity index 100% rename from public/js/lufi-down.js rename to themes/default/public/js/lufi-down.js diff --git a/public/js/lufi-files.js b/themes/default/public/js/lufi-files.js similarity index 100% rename from public/js/lufi-files.js rename to themes/default/public/js/lufi-files.js diff --git a/public/js/lufi-up.js b/themes/default/public/js/lufi-up.js similarity index 100% rename from public/js/lufi-up.js rename to themes/default/public/js/lufi-up.js diff --git a/public/js/moment-with-locales.min.js b/themes/default/public/js/moment-with-locales.min.js similarity index 100% rename from public/js/moment-with-locales.min.js rename to themes/default/public/js/moment-with-locales.min.js diff --git a/public/js/sjcl.js b/themes/default/public/js/sjcl.js similarity index 100% rename from public/js/sjcl.js rename to themes/default/public/js/sjcl.js diff --git a/templates/about.html.ep b/themes/default/templates/about.html.ep similarity index 100% rename from templates/about.html.ep rename to themes/default/templates/about.html.ep diff --git a/templates/delays.html.ep b/themes/default/templates/delays.html.ep similarity index 100% rename from templates/delays.html.ep rename to themes/default/templates/delays.html.ep diff --git a/templates/files.html.ep b/themes/default/templates/files.html.ep similarity index 100% rename from templates/files.html.ep rename to themes/default/templates/files.html.ep diff --git a/templates/index.html.ep b/themes/default/templates/index.html.ep similarity index 100% rename from templates/index.html.ep rename to themes/default/templates/index.html.ep diff --git a/templates/layouts/default.html.ep b/themes/default/templates/layouts/default.html.ep similarity index 100% rename from templates/layouts/default.html.ep rename to themes/default/templates/layouts/default.html.ep diff --git a/templates/mail.html.ep b/themes/default/templates/mail.html.ep similarity index 100% rename from templates/mail.html.ep rename to themes/default/templates/mail.html.ep diff --git a/templates/msg.html.ep b/themes/default/templates/msg.html.ep similarity index 100% rename from templates/msg.html.ep rename to themes/default/templates/msg.html.ep diff --git a/templates/render.html.ep b/themes/default/templates/render.html.ep similarity index 100% rename from templates/render.html.ep rename to themes/default/templates/render.html.ep diff --git a/themes/framasoft/public/css/bootstrap.min.css b/themes/framasoft/public/css/bootstrap.min.css new file mode 100644 index 0000000..fbcf12d --- /dev/null +++ b/themes/framasoft/public/css/bootstrap.min.css @@ -0,0 +1 @@ +toto diff --git a/themes/framasoft/public/toto.txt b/themes/framasoft/public/toto.txt new file mode 100644 index 0000000..fbcf12d --- /dev/null +++ b/themes/framasoft/public/toto.txt @@ -0,0 +1 @@ +toto diff --git a/utilities/locales_files.txt b/utilities/locales_files.txt index 8a32126..62818da 100644 --- a/utilities/locales_files.txt +++ b/utilities/locales_files.txt @@ -1,10 +1,10 @@ -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