Permalink
Browse files

the no_remote mode

  • Loading branch information...
1 parent 0e4f5a9 commit d70d6f6993171d92dbcb43a0d4ded18378905efe Alexis Sukrieh committed Oct 22, 2010
Showing with 46 additions and 8 deletions.
  1. +2 −2 config.yml
  2. +3 −2 environments/development.yml
  3. +1 −0 environments/production.yml
  4. +38 −4 lib/Broadway/Slide.pm
  5. +2 −0 views/slideshow.tt
View
@@ -15,7 +15,7 @@ broadway:
date: "Oct. 9, 2010"
event: "OSDCfr 2010"
author: "Alexis Sukrieh"
- slides: 52
+ slides: 42
refresh_rate: 600
- remote: 1
+ remote: 0
@@ -1,8 +1,9 @@
-log: "core"
+log: "debug"
warnings: 1
+session: 'YAML'
show_errors: 1
# auto_reload is a development feature
# you should enable it by yourself if you want it
# Module::Refresh is needed
-auto_reload: 1
+auto_reload: 0
@@ -1,5 +1,6 @@
log: "warning"
warnings: 0
+session: 'simple'
show_errors: 0
route_cache: 1
# never enable auto_reload in production
View
@@ -5,9 +5,43 @@ use Dancer ':syntax';
my $_slide = 0;
sub nbslides { config->{broadway}{slides} }
-sub current { $_slide }
-sub next { $_slide++ if $_slide < nbslides }
-sub prev { $_slide-- if $_slide > 0 }
-sub go { $_slide = $_[1] }
+
+sub current {
+ if (config->{'broadway'}{'remote'}) {
+ return $_slide;
+ }
+ else {
+ if (not defined session('slide')) {
+ session slide => 0;
+ }
+ return session('slide')
+ }
+}
+
+sub next {
+ my $slide = session('slide');
+ $slide++ if $slide < nbslides;
+ if (config->{'broadway'}{'remote'}) {
+ $_slide = $slide;
+ }
+ session(slide => $slide);
+}
+
+sub prev {
+ my $slide = session('slide');
+ $slide-- if $slide > 0;
+ if (config->{'broadway'}{'remote'}) {
+ $_slide = $slide;
+ }
+ session(slide => $slide);
+}
+
+sub go {
+ my $slide = $_[1];
+ if (config->{'broadway'}{'remote'}) {
+ $_slide = $slide;
+ }
+ session(slide => $slide);
+}
1;
View
@@ -21,6 +21,7 @@ document.addEventListener('touchmove', function(event) {
<% else %>
+<% if settings.broadway.remote %>
window.broadway_effects = 1;
window.setInterval(function() {
$.ajax({
@@ -36,6 +37,7 @@ window.setInterval(function() {
);
}, <% settings.broadway.refresh_rate %>);
+<% end %>
<% end %>

0 comments on commit d70d6f6

Please sign in to comment.