From 8ef29bdcba8f3f804e0822758bca2fdd9e981ff7 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 2 Mar 2012 12:41:23 +0100 Subject: perltidy --- cgi/index.pl | 5 ++--- lib/App/VRR/Fakedisplay.pm.PL | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cgi/index.pl b/cgi/index.pl index f107e5d..cd5885e 100644 --- a/cgi/index.pl +++ b/cgi/index.pl @@ -22,7 +22,7 @@ sub get_results { my $expiry = 900; - if (lc($city) eq 'berlin' or lc($stop) ~~ [qw[hbf hauptbahnhof]]) { + if ( lc($city) eq 'berlin' or lc($stop) ~~ [qw[hbf hauptbahnhof]] ) { $expiry = 600; } @@ -31,7 +31,7 @@ sub get_results { default_expires => "${expiry} sec", ); - my $sstr = ( "${backend} _ ${stop} _ ${city}" ); + my $sstr = ("${backend} _ ${stop} _ ${city}"); $sstr =~ tr{a-zA-Z0-9}{_}c; my $results = $cache->thaw($sstr); @@ -203,7 +203,6 @@ sub render_image { // $strp_simple->parse_datetime($time); my $dt; - if ( ( @grep_line and not( grep { $line =~ $_ } @grep_line ) ) or ( @grep_platform and not( $platform ~~ \@grep_platform ) ) or ( $line =~ m{ ^ (RB | RE | IC | EC) }x ) ) diff --git a/lib/App/VRR/Fakedisplay.pm.PL b/lib/App/VRR/Fakedisplay.pm.PL index 3ad0fe5..59d0561 100644 --- a/lib/App/VRR/Fakedisplay.pm.PL +++ b/lib/App/VRR/Fakedisplay.pm.PL @@ -20,7 +20,7 @@ sub write_out { say $out_fh "'${char}' => {"; say $out_fh 'matrix => ['; - if ($char eq '1') { + if ( $char eq '1' ) { $off_x--; } @@ -49,7 +49,7 @@ sub write_out { $char_w = 5; } - if ($char ~~ [qw[0 1 2 3 4 5 6 7 8 9]]) { + if ( $char ~~ [qw[0 1 2 3 4 5 6 7 8 9]] ) { $char_w = 6; } -- cgit v1.2.3 From 0991ec0622f0959acd2f06ae3f8f281e34f5e499 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 14 Mar 2012 09:43:22 +0100 Subject: A little bit more CSS --- cgi/index.pl | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/cgi/index.pl b/cgi/index.pl index cd5885e..342d741 100644 --- a/cgi/index.pl +++ b/cgi/index.pl @@ -316,11 +316,17 @@ __DATA__ } div.about { + margin-top: 2em; color: #666666; } div.about a { color: #000066; + text-decoration: none; + } + + span.optional { + color: #666666; } div.break { @@ -334,11 +340,15 @@ __DATA__ div.field div.desc { float: left; - width: 10em; + width: 14em; text-align: right; padding-right: 0.5em; } + input, select { + border: 1px solid black; + } + @@ -373,7 +383,7 @@ local transit networks as well. <%= form_for _redirect => begin %>
-
City -> Stop
+
City → Stop
<%= text_field 'city' %> <%= text_field 'stop' %> @@ -381,9 +391,10 @@ local transit networks as well.
- optional: + optional:
-
display height [1..10]
+
+ display height [1..10]
<%= text_field 'no_lines' %>
@@ -391,20 +402,18 @@ local transit networks as well.
<%= text_field 'offset' %>
-
match line prefix 1
+
+ match line prefix
<%= text_field 'line' %>
-
match platform 1
+
match platform
<%= text_field 'platform' %>
backend
<%= select_field backend => [['EFA (VRR)' => 'vrr'], ['HAFAS (DB)' => 'db']] %>
-
- 1 comma-separated list
-
<% end %> -- cgit v1.2.3 From b5322a4db6b23d01b18c3d897c43990446767a90 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 14 Mar 2012 09:48:24 +0100 Subject: Remove all parameters with default values in _redirect --- cgi/index.pl | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/cgi/index.pl b/cgi/index.pl index 342d741..b2b37dc 100644 --- a/cgi/index.pl +++ b/cgi/index.pl @@ -13,9 +13,13 @@ no warnings 'uninitialized'; our $VERSION = '0.05'; -sub default_no_lines { - return 5; -} +my %default = ( + backend => 'vrr', + line => q{}, + no_lines => 5, + offset => q{}, + platform => q{}, +); sub get_results { my ( $backend, $city, $stop ) = @_; @@ -74,7 +78,7 @@ sub handle_request { my $no_lines = $self->param('no_lines'); if ( $no_lines < 1 or $no_lines > 10 ) { - $no_lines = default_no_lines(); + $no_lines = $default{no_lines}; } $self->stash( title => 'vrr-fakedisplay' ); @@ -174,7 +178,7 @@ sub render_image { } if ( $no_lines < 1 or $no_lines > 10 ) { - $no_lines = default_no_lines(); + $no_lines = $default{no_lines}; } my $png = App::VRR::Fakedisplay->new( @@ -278,14 +282,10 @@ get '/_redirect' => sub { $params->remove('city'); $params->remove('stop'); - if ( not $params->param('no_lines') - or $params->param('no_lines') == default_no_lines() ) - { - $params->remove('no_lines'); - } - - for my $param (qw(line platform offset)) { - if ( not $params->param($param) ) { + for my $param (qw(line platform offset no_lines backend)) { + if ( not $params->param($param) + or ( $params->param($param) eq $default{$param} ) ) + { $params->remove($param); } } -- cgit v1.2.3