diff --git a/Web/lib/MJB/Web.pm b/Web/lib/MJB/Web.pm index 20cfe9e..5a668f0 100644 --- a/Web/lib/MJB/Web.pm +++ b/Web/lib/MJB/Web.pm @@ -226,7 +226,9 @@ sub startup ($self) { $admin->post( '/admin/invite' )->to('Admin#do_invite' )->name('do_admin_invite' ); $admin->post( '/admin/invite/remove' )->to('Admin#do_invite_remove' )->name('do_admin_invite_remove' ); $admin->get ( '/admin/alerts' )->to('Admin#alerts' )->name('show_admin_alerts' ); - $admin->post( '/admin/alert/:id' )->to('Admin#do_alert_read' )->name('do_admin_alert_read' ); + $admin->post( '/admin/alert/unread' )->to('Admin#do_alert_unread' )->name('do_admin_alert_unread' ); + $admin->post( '/admin/alert/read' )->to('Admin#do_alert_read' )->name('do_admin_alert_read' ); + $admin->post( '/admin/alert/remove' )->to('Admin#do_alert_remove' )->name('do_admin_alert_remove' ); $admin->get ( '/admin/jobs' )->to('Admin#jobs' )->name('show_admin_jobs' ); $admin->post( '/admin/update_ssl' )->to('Admin#do_update_ssl' )->name('do_admin_update_ssl' ); diff --git a/Web/lib/MJB/Web/Controller/Admin.pm b/Web/lib/MJB/Web/Controller/Admin.pm index 1016f63..529a673 100644 --- a/Web/lib/MJB/Web/Controller/Admin.pm +++ b/Web/lib/MJB/Web/Controller/Admin.pm @@ -198,4 +198,54 @@ sub do_update_ssl ( $c ) { $c->redirect_to( $c->url_for( 'show_admin_jobs' ) ); } +sub do_alert_read ( $c ) { + my $note = $c->db->system_note( $c->param('nid') ); + + if ( ! $note ) { + $c->flash( error_message => "Note could not be marked as read, because it doesn't exist?" ); + $c->redirect_to( $c->url_for( 'show_admin_alerts' ) ); + return; + } + + $note->is_read( 1 ); + $note->update; + + $c->flash( confirmation => "Note marked as read." ); + $c->redirect_to( $c->url_for( 'show_admin_alerts' ) ); + +} + +sub do_alert_unread ( $c ) { + my $note = $c->db->system_note( $c->param('nid') ); + + if ( ! $note ) { + $c->flash( error_message => "Note could not be marked as unread, because it doesn't exist?" ); + $c->redirect_to( $c->url_for( 'show_admin_alerts' ) ); + return; + } + + $note->is_read( 0 ); + $note->update; + + $c->flash( confirmation => "Note marked as read." ); + $c->redirect_to( $c->url_for( 'show_admin_alerts' ) ); + +} + +sub do_alert_remove ( $c ) { + my $note = $c->db->system_note( $c->param('nid') ); + + if ( ! $note ) { + $c->flash( error_message => "Note could not be removed, because it doesn't exist?" ); + $c->redirect_to( $c->url_for( 'show_admin_alerts' ) ); + return; + } + + $note->delete; + + $c->flash( confirmation => "Note removed" ); + $c->redirect_to( $c->url_for( 'show_admin_alerts' ) ); + +} + 1; diff --git a/Web/templates/_svg/envelope-open.html.ep b/Web/templates/_svg/envelope-open.html.ep new file mode 100644 index 0000000..455f8cc --- /dev/null +++ b/Web/templates/_svg/envelope-open.html.ep @@ -0,0 +1,5 @@ + + + + + diff --git a/Web/templates/_svg/envelope.html.ep b/Web/templates/_svg/envelope.html.ep new file mode 100644 index 0000000..17ceee0 --- /dev/null +++ b/Web/templates/_svg/envelope.html.ep @@ -0,0 +1,5 @@ + + + + + diff --git a/Web/templates/admin/_nav.html.ep b/Web/templates/admin/_nav.html.ep index cf9df54..b8bec9c 100644 --- a/Web/templates/admin/_nav.html.ep +++ b/Web/templates/admin/_nav.html.ep @@ -31,10 +31,25 @@
- +