diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index 8760135..8e10896 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -1729,6 +1729,7 @@ sub startup { $r->get('/register')->to('account#registration_form'); $r->get('/reg/:id/:token')->to('account#verify'); $r->get('/status/:name')->to('traveling#user_status'); + $r->get('/ajax/status/:name')->to('traveling#public_status_card'); $r->post('/action')->to('traveling#log_action'); $r->post('/geolocation')->to('traveling#geolocation'); $r->post('/list_departures')->to('traveling#redirect_to_station'); diff --git a/lib/Travelynx/Controller/Account.pm b/lib/Travelynx/Controller/Account.pm index 44babfa..f7d3a75 100644 --- a/lib/Travelynx/Controller/Account.pm +++ b/lib/Travelynx/Controller/Account.pm @@ -222,12 +222,12 @@ sub privacy { $public_level &= ~0x02; } $self->set_privacy( $user->{id}, $public_level ); + $self->redirect_to('account'); } else { $self->param( public_status => $public_level & 0x02 ? 1 : 0 ); + $self->render( 'privacy', name => $user->{name} ); } - - $self->render( 'privacy', name => $user->{name} ); } sub change_mail { diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index cf704ec..ee94913 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -50,6 +50,8 @@ sub public_status_card { my $name = $self->stash('name'); my $user = $self->get_privacy_by_name($name); + delete $self->stash->{layout}; + if ( $user and ( $user->{public_level} & 0x02 ) ) { my $status = $self->get_user_status( $user->{id} ); $self->render( diff --git a/public/static/js/travelynx-actions.js b/public/static/js/travelynx-actions.js index 015a35d..cb4f975 100644 --- a/public/static/js/travelynx-actions.js +++ b/public/static/js/travelynx-actions.js @@ -21,10 +21,23 @@ function tvly_update() { $.get('/ajax/status_card.html', function(data) { $('.statuscol').html(data); tvly_reg_handlers(); - setTimeout(tvly_update, 15000); + setTimeout(tvly_update, 20000); }).fail(function() { $('.sync-failed-marker').css('display', 'block'); - setTimeout(tvly_update, 15000); + setTimeout(tvly_update, 20000); + }); +} +function tvly_update_public() { + var user_name; + $('.publicstatuscol').each(function() { + user_name = $(this).data('user'); + }); + $.get('/ajax/status/' + user_name + '.html', function(data) { + $('.publicstatuscol').html(data); + setTimeout(tvly_update_public, 20000); + }).fail(function() { + $('.sync-failed-marker').css('display', 'block'); + setTimeout(tvly_update_public, 20000); }); } function tvly_reg_handlers() { @@ -92,6 +105,12 @@ function tvly_reg_handlers() { $(document).ready(function() { tvly_reg_handlers(); if ($('.statuscol .autorefresh').length) { - setTimeout(tvly_update, 15000); + setTimeout(tvly_update, 20000); + } +}); +$(document).ready(function() { + tvly_reg_handlers(); + if ($('.publicstatuscol .autorefresh').length) { + setTimeout(tvly_update_public, 20000); } }); diff --git a/public/static/js/travelynx-actions.min.js b/public/static/js/travelynx-actions.min.js index 7bf9922..1276162 100644 --- a/public/static/js/travelynx-actions.min.js +++ b/public/static/js/travelynx-actions.min.js @@ -1 +1 @@ -function tvly_run(t,a,e){var n='error',c=$('
- In <%= $journey->{train_type} %> <%= $journey->{train_no} %> - % if ($journey->{arr_name}) { - von <%= $journey->{dep_name} %> nach <%= $journey->{arr_name} %>. - % } - % else { - ab <%= $journey->{dep_name} %>. - % } -
-- <%= $journey->{real_departure}->strftime('%H:%M') %> - % if ($journey->{real_departure}->epoch != $journey->{sched_departure}->epoch) { - (<%= sprintf('%+d', ($journey->{real_departure}->epoch - $journey->{sched_departure}->epoch)/60) %>) - % } - → - % if ($journey->{real_arrival}->epoch) { - <%= $journey->{real_arrival}->strftime('%H:%M') %> - % if ($journey->{real_arrival}->epoch != $journey->{sched_arrival}->epoch) { - (<%= sprintf('%+d', ($journey->{real_arrival}->epoch - $journey->{sched_arrival}->epoch)/60) %>) - % } - % } - % elsif ($journey->{arr_name}) { - noch nicht bekannt - % } - % else { - unbekannt - % } -
--
+
Zuletzt gesehen in <%= $journey->{arr_name} %>. diff --git a/templates/account.html.ep b/templates/account.html.ep index fe1280f..fc4387d 100644 --- a/templates/account.html.ep +++ b/templates/account.html.ep @@ -37,17 +37,14 @@