diff --git a/app/assets/stylesheets/components/big-number.scss b/app/assets/stylesheets/components/big-number.scss index 3e046c12a..f9d0508be 100644 --- a/app/assets/stylesheets/components/big-number.scss +++ b/app/assets/stylesheets/components/big-number.scss @@ -1,19 +1,29 @@ %big-number, .big-number { - @include bold-48; + display: block; + + &-number { + @include bold-48; + display: block; + } &-label { @include core-19; - display: block; - padding-bottom: $gutter-half; + display: inline-block; + padding-bottom: 10px; } } .big-number-smaller { + @extend %big-number; - @include bold-36($tabular-numbers: true); + + .big-number-number { + @include bold-36($tabular-numbers: true); + } + } .big-number-with-status { @@ -22,25 +32,12 @@ background: $text-colour; color: $white; position: relative; - - &-show-more-link { - @include core-16; - display: block; - padding: 0.75em 0 0.5625em 0; - margin-bottom: $gutter-half; - text-align: center; - border-bottom: 1px solid $border-colour; - - &:focus { - outline: none; - color: $text-colour; - border-bottom: 1px solid $brown; - } - } + margin-bottom: $gutter-half; .big-number { padding: 15px; position: relative; + } .big-number-overlay-link { @@ -66,6 +63,8 @@ &:link, &:visited { color: $white; + text-decoration: none; + border-bottom: 1px solid $white; } } @@ -85,6 +84,8 @@ &:active, &:hover { color: $white; + text-decoration: none; + border-bottom: 1px solid $white; } } diff --git a/app/assets/stylesheets/components/show-more.scss b/app/assets/stylesheets/components/show-more.scss new file mode 100644 index 000000000..a02c4b53d --- /dev/null +++ b/app/assets/stylesheets/components/show-more.scss @@ -0,0 +1,34 @@ +.show-more { + + @include core-16; + display: block; + padding: 0 0; + margin: $gutter-half 0 $gutter 0; + text-align: center; + border-top: 1px solid $border-colour; + + &:focus { + + outline: none; + color: $text-colour; + box-shadow: 0 -10px 0 0 $yellow; + border-color: $yellow; + + span { + background: $yellow; + outline: none; + border-color: $text-colour; + } + + } + + span { + position: relative; + top: -11px; + outline: 10px solid white; + background: $white; + display: inline-block; + border-bottom: 1px solid $light-blue; + } + +} diff --git a/app/assets/stylesheets/main.scss b/app/assets/stylesheets/main.scss index 356110614..eae80027d 100644 --- a/app/assets/stylesheets/main.scss +++ b/app/assets/stylesheets/main.scss @@ -50,6 +50,7 @@ $path: '/static/images/'; @import 'components/vendor/previous-next-navigation'; @import 'components/pill'; @import 'components/secondary-button'; +@import 'components/show-more'; @import 'views/job'; @import 'views/edit-template'; diff --git a/app/assets/stylesheets/views/dashboard.scss b/app/assets/stylesheets/views/dashboard.scss index d4dfb1159..a2697f7b3 100644 --- a/app/assets/stylesheets/views/dashboard.scss +++ b/app/assets/stylesheets/views/dashboard.scss @@ -5,16 +5,45 @@ } .keyline-block { - border-top: 1px solid $border-colour; padding-top: $gutter-half; +} - &-show-more-link { - @include core-16; - border-top: 1px solid $border-colour; - border-bottom: 1px solid $border-colour; - padding: 0.75em 0 0.5625em 0; - text-align: center; +.spark-bar { + + @include core-16; + box-sizing: border-box; + display: block; + width: 100%; + text-align: right; + margin-bottom: $gutter-half; + height: $gutter-half; + color: $govuk-blue; + text-align: left; + color: $govuk-blue; + + span { + box-sizing: border-box; + display: block; + background: $govuk-blue; + color: $white; + height: $gutter-half; + padding-left: 5px; + padding-right: 5px; + margin: 3px 0 5px 0; + transition: width 0.6s ease-in-out; + } + + &-label { + @include bold-19; + display: block; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + color: $govuk-blue; + max-width: 100%; + background: $white; + margin-bottom: $gutter; } } diff --git a/app/main/views/dashboard.py b/app/main/views/dashboard.py index b63cc81c8..efbaa1045 100644 --- a/app/main/views/dashboard.py +++ b/app/main/views/dashboard.py @@ -71,10 +71,14 @@ def service_dashboard_updates(service_id): @login_required @user_has_permissions('view_activity', admin_override=True) def template_history(service_id): + template_statistics = aggregate_usage( + template_statistics_client.get_template_statistics_for_service(service_id) + ) return render_template( 'views/dashboard/all-template-statistics.html', - template_statistics=aggregate_usage( - template_statistics_client.get_template_statistics_for_service(service_id) + template_statistics=template_statistics, + most_used_template_count=max( + [row['usage_count'] for row in template_statistics] or [0] ) ) @@ -197,12 +201,17 @@ def get_dashboard_statistics_for_service(service_id): sms_sent = usage['data'].get('sms_count', 0) emails_sent = usage['data'].get('email_count', 0) + template_statistics = aggregate_usage( + template_statistics_client.get_template_statistics_for_service(service_id, limit_days=7) + ) + return { 'statistics': add_rates_to(sum_of_statistics( statistics_api_client.get_statistics_for_service(service_id, limit_days=7)['data'] )), - 'template_statistics': aggregate_usage( - template_statistics_client.get_template_statistics_for_service(service_id, limit_days=7) + 'template_statistics': template_statistics, + 'most_used_template_count': max( + [row['usage_count'] for row in template_statistics] or [0] ), 'emails_sent': emails_sent, 'sms_free_allowance': sms_free_allowance, diff --git a/app/templates/components/big-number.html b/app/templates/components/big-number.html index 654946f1f..b52f98c6f 100644 --- a/app/templates/components/big-number.html +++ b/app/templates/components/big-number.html @@ -1,14 +1,16 @@ {% macro big_number(number, label, label_link=None, currency='', smaller=False) %}
- 1 April 2016 to date -
- {% with period = "" %} - {% include 'views/dashboard/template-statistics.html' %} - {% endwith %} + +- See all templates sent this year -
+ {{ show_more( + url_for('.template_history', service_id=current_service.id), + 'See all templates sent this year' + ) }} + {% endif %} {% if current_user.has_permissions(['manage_settings'], admin_override=True) %} -