Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

support for a preview action

  • Loading branch information...
commit b1a0cbcadbd45ad5e881a458f4e9ff6374a5fbd8 1 parent 719598f
Alexis Sukrieh authored
Showing with 15 additions and 3 deletions.
  1. +15 −3 lib/Broadway/UI.pm
View
18 lib/Broadway/UI.pm
@@ -2,7 +2,6 @@ package Broadway::UI;
use Dancer ':syntax';
use Dancer::Plugin::Ajax;
-
use Broadway::Slide;
sub display_slide {
@@ -11,16 +10,29 @@ sub display_slide {
return template("slide-$slide");
}
+ajax '/preview' => sub {
+ my $next = Broadway::Slide->current + 1;
+ content_type "text/html; charset=UTF-8";
+ display_slide($next);
+};
+
before_template sub {
my $tokens = shift;
if (request->agent =~ /Android|iPhone/i) {
- debug "is_multi_touch : ".request->user_agent;
$tokens->{is_multi_touch} = 1;
}
};
get '/' => sub {
- template 'slideshow';
+
+ my $tokens = {};
+
+ if (request->agent =~ /Android|iPhone/i) {
+ debug "is_multi_touch : ".request->user_agent;
+ $tokens->{is_multi_touch} = 1;
+ }
+
+ template 'slideshow', $tokens;
};
get '/slide/:slide' => sub {
Please sign in to comment.
Something went wrong with that request. Please try again.