And after I fixed the "bug", I just now remember why I did that. It made it convenient when using github pages for publishing ...
Hmmmm. Not sure what to do now. On Wednesday, January 18, 2017 at 4:50:17 PM UTC-6, mimosinnet wrote: > > You hit the nail on the head! Thanks a lot! I was looking for answers at > the wrong place =^_^= > > I will now work on the pull request and the test ;-) > > Thanks! > > El dimecres, 18 gener de 2017 14:46:52 UTC+1, Dotan Dimet va escriure: >> >> Sorry, I should have looked at the code in the layout template. >> >> >> https://github.com/jberger/Mojolicious-Plugin-RevealJS/blob/master/lib/Mojolicious/Plugin/RevealJS/files/templates/layouts/revealjs.html.ep >> >> It seems the links to the revealjs static files (css, etc.) are relative >> to the current route: >> >> <link rel="stylesheet" href="revealjs/css/reveal.css"> >> >> So if your presentation is at /reveal/foo, it will look for >> /reveal/revealjs/css/reveal.css, and not find it. >> >> I thought it was using absolute paths (i.e "/revealjs/css/reveal.css" >> etc.), which would avoid this issue. >> >> You could send Joel a bug report or a pull request for a change >> (preferably adding a test for a nested route, like you have in your app). >> >> - Dotan >> >> On 17/01/17 01:50, mimosinnet wrote: >> >> El dilluns, 16 gener de 2017 14:33:50 UTC+1, Dotan Dimet va escriure: >>> >>> My guess is that your route ('/revealjs/:id') interferes with requests >>> for the static Reveal.js files bundled in the plugin, >>> which are served from /revealjs/... >>> >> ... >> >>> So, try renaming your route and see if things improve? >>> >> >> Thanks very much for the suggestion. I have renamed the route to: >> >> $r->get('/reveal/:id')->to('presenta#reveal'); >> >> Nevertheless, I have the same issue. These are the paths that cannot be >> found when rendering the page: >> >> GET http://127.0.0.1:3000/reveal/revealjs/js/reveal.js >> 01:53 GET http://127.0.0.1:3000/reveal/revealjs/lib/js/head.min.js >> 01:22 GET http://127.0.0.1:3000/reveal/revealjs/lib/css/zenburn.css >> 01:19 GET http://127.0.0.1:3000/reveal/revealjs/css/theme/black.css >> 01:17 GET http://127.0.0.1:3000/reveal/revealjs/css/reveal.css >> 01:30 GET http://127.0.0.1:3000/reveal/revealjs/css/print/paper.css >> 01:53 GET http://127.0.0.1:3000/reveal/revealjs/lib/js/head.min.js >> 01:54 GET http://127.0.0.1:3000/reveal/revealjs/js/reveal.js >> >> If I try with Mojolicious::Lite, it fins the paths, which are: >> /revealjs/lib/js/head.min.js >> /revealjs/lib/css/zenburn.css >> /revealjs/css/theme/black.css >> /revealjs/css/reveal.css >> ... >> >> Cheers! >> >> On 16/01/17 10:51, mimosinnet wrote: >>> >>> I am having trouble using Mojolicious::Plugin::RevealJS. It works it a >>> Lite app, but I fail to use it in a full app and I am unable to find where >>> is the issue. >>> >>> I start the plugin with: >>> >>> sub startup { >>>> >>>> my $self = shift; >>>> >>>> $self->plugin('RevealJS'); >>>> ... >>>> my $r = $self->routes; >>>> .... >>>> $r->get('/revealjs/:id')->to('presenta#revealjs'); >>>> ... >>>> } >>>> >>> >>> In the controller, I start the plugin by using the revealjs layout: >>> sub revealjs { >>> >>> my $self = shift; >>> my $id_pres = $self->stash('id'); >>> $self->render( >>> >>> layout => 'revealjs', >>> template => 'mytalk', >>> id_pres => $id_pres >>> >>> >>> ); >>> } >>> >>> >>> The app shows the content of the template, adds code from the plugin, >>> but fails to find the revealjs files when rendering the layout. These are >>> the paths that cannot be found when rendering the page: >>> GET http://127.0.0.1:3000/revealjs/revealjs/css/reveal.css >>> 01:53 GET http://127.0.0.1:3000/revealjs/revealjs/lib/js/head.min.js >>> 01:22 GET http://127.0.0.1:3000/revealjs/revealjs/lib/css/zenburn.css >>> 01:19 GET http://127.0.0.1:3000/revealjs/revealjs/css/theme/black.css >>> 01:54 GET http://127.0.0.1:3000/revealjs/revealjs/js/reveal.js >>> 01:30 GET http://127.0.0.1:3000/revealjs/revealjs/css/print/paper.css >>> 01:53 GET http://127.0.0.1:3000/revealjs/revealjs/lib/js/head.min.js >>> 01:54 GET http://127.0.0.1:3000/revealjs/revealjs/js/reveal.js >>> 01:72 Uncaught ReferenceError: Reveal is not defined >>> at 01:72 >>> >>> As the app calls the plugin but fails to find the revealjs files, I >>> guess the issue could be in how the code >>> <https://github.com/jberger/Mojolicious-Plugin-RevealJS> builds the >>> paths, and I imagine this is the relevant part: >>> package Mojolicious::Plugin::RevealJS; >>> ... >>> use Mojo::Home; >>> ... >>> use File::Basename 'dirname'; >>> use File::Spec::Functions qw/rel2abs catdir/; >>> use File::ShareDir 'dist_dir'; >>> >>> has home => sub { >>> my $checkout = catdir(dirname(rel2abs(__FILE__)), qw/RevealJS files/); >>> Mojo::Home->new(-d $checkout ? $checkout : dist_dir( >>> 'Mojolicious-Plugin-RevealJS')); >>> }; >>> >>> sub register { >>> my ($plugin, $app, $conf) = @_; >>> my $home = $plugin->home; >>> push @{ $app->static->paths }, $home->rel_dir('public'); >>> push @{ $app->renderer->paths }, $home->rel_dir('templates'); >>> >>> >>> $app->defaults('revealjs.init' => { >>> controls => \1, >>> progress => \1, >>> history => \1, >>> center => \1, >>> transition => 'slide', #none/fade/slide/convex/concave/zoom >>> }); >>> >>> >>> $app->helper('include_code' => \&_include_code); >>> $app->helper('revealjs.export' => \&_export); >>> } >>> >>> I would appreciate any hints! >>> >>> Cheers! >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Mojolicious" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at https://groups.google.com/group/mojolicious. >>> For more options, visit https://groups.google.com/d/optout. >>> >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "Mojolicious" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/mojolicious. >> For more options, visit https://groups.google.com/d/optout. >> >> >> -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
