summaryrefslogtreecommitdiff
path: root/lib/Travelynx.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2023-02-27 22:14:54 +0100
committerDaniel Friesel <derf@finalrewind.org>2023-02-27 22:14:54 +0100
commit6d261197e3138c80357ec485749e2089ef6ff96a (patch)
tree3089879a8863354e6b1cd669caf37bcb8558883a /lib/Travelynx.pm
parentfb3878665b38f1e4c2439238c19cba0c9767f721 (diff)
set visibility per journey (wip)
some odds and ends left to polish, but ready for testing
Diffstat (limited to 'lib/Travelynx.pm')
-rwxr-xr-xlib/Travelynx.pm26
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm
index 98b22d8..6d903e6 100755
--- a/lib/Travelynx.pm
+++ b/lib/Travelynx.pm
@@ -421,6 +421,25 @@ sub startup {
);
$self->helper(
+ 'visibility_icon' => sub {
+ my ( $self, $visibility ) = @_;
+ if ( $visibility eq 'public' ) {
+ return 'language';
+ }
+ if ( $visibility eq 'travelynx' ) {
+ return 'lock_open';
+ }
+ if ( $visibility eq 'unlisted' ) {
+ return 'lock_outline';
+ }
+ if ( $visibility eq 'private' ) {
+ return 'lock';
+ }
+ return 'help_outline';
+ }
+ );
+
+ $self->helper(
'checkin' => sub {
my ( $self, %opt ) = @_;
@@ -1348,7 +1367,8 @@ sub startup {
uid => $uid,
db => $db,
with_data => 1,
- with_timestamps => 1
+ with_timestamps => 1,
+ with_visibility => 1,
);
if ($in_transit) {
@@ -1425,6 +1445,8 @@ sub startup {
messages => $in_transit->{messages},
extra_data => $in_transit->{data},
comment => $in_transit->{user_data}{comment},
+ visibility => $in_transit->{visibility},
+ visibility_str => $in_transit->{visibility_str},
};
my $traewelling = $self->traewelling->get(
@@ -2205,6 +2227,7 @@ sub startup {
$authed_r->get('/history/:year/:month')->to('traveling#monthly_history');
$authed_r->get('/journey/add')->to('traveling#add_journey_form');
$authed_r->get('/journey/comment')->to('traveling#comment_form');
+ $authed_r->get('/journey/visibility')->to('traveling#visibility_form');
$authed_r->get('/journey/:id')->to('traveling#journey_details');
$authed_r->get('/s/*station')->to('traveling#station');
$authed_r->get('/confirm_mail/:token')->to('account#confirm_mail');
@@ -2215,6 +2238,7 @@ sub startup {
$authed_r->post('/account/services')->to('account#services');
$authed_r->post('/journey/add')->to('traveling#add_journey_form');
$authed_r->post('/journey/comment')->to('traveling#comment_form');
+ $authed_r->post('/journey/visibility')->to('traveling#visibility_form');
$authed_r->post('/journey/edit')->to('traveling#edit_journey');
$authed_r->post('/journey/passenger_rights/*filename')
->to('passengerrights#generate');