From ebcdb002e0e0f3afa67a578f80f70837cd0e6a88 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Wed, 18 Feb 2015 16:40:50 -0500 Subject: [PATCH] LP#1410369: Show unread message count in the patron dashboard Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton Signed-off-by: Kathy Lussier --- Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm | 8 +++++++- Open-ILS/src/templates/opac/css/style.css.tt2 | 1 + Open-ILS/src/templates/opac/parts/topnav.tt2 | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm index 9b4658ac28..4e3df185bf 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm @@ -1744,6 +1744,11 @@ sub user_opac_vitals { $out->{"total_out"} = reduce { $a + $out->{$b} } 0, qw/out overdue long_overdue/; + my $unread_msgs = $e->search_actor_usr_message([ + {usr => $user_id, read_date => undef, deleted => 'f'}, + {idlist => 1} + ]); + return { user => { first_given_name => $user->first_given_name, @@ -1754,7 +1759,8 @@ sub user_opac_vitals { }, fines => $fines->to_bare_hash, checkouts => $out, - holds => $holds + holds => $holds, + messages => { unread => scalar(@$unread_msgs) } }; } diff --git a/Open-ILS/src/templates/opac/css/style.css.tt2 b/Open-ILS/src/templates/opac/css/style.css.tt2 index 277e82b90f..a0cac5d645 100644 --- a/Open-ILS/src/templates/opac/css/style.css.tt2 +++ b/Open-ILS/src/templates/opac/css/style.css.tt2 @@ -136,6 +136,7 @@ is too low for WCAG compliance. Use "text_attention" for now until a better color is picked - if needed. */ #dash_fines { color: [% css_colors.text_attention %]; } +#dash_messages { color: [% css_colors.text_attention %]; } #header-wrap { background: linear-gradient([% css_colors.primary %], [% css_colors.primary_fade %]); diff --git a/Open-ILS/src/templates/opac/parts/topnav.tt2 b/Open-ILS/src/templates/opac/parts/topnav.tt2 index 0cf554c969..e2a961cef1 100644 --- a/Open-ILS/src/templates/opac/parts/topnav.tt2 +++ b/Open-ILS/src/templates/opac/parts/topnav.tt2 @@ -55,6 +55,12 @@ %]">[% money(ctx.user_stats.fines.balance_owed) %] [% l("Fines") %] + | + + [% ctx.user_stats.messages.unread + %] [% l("Unread Messages") %] + [% END %] -- 2.11.0