From 636121977d485b9f6b3d7c4ba98fecc6ca6b4c30 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 28 Sep 2015 15:40:11 +0200 Subject: [PATCH 1/2] Adds styles for admin stats --- app/assets/stylesheets/admin.scss | 26 +++++- app/assets/stylesheets/participacion.scss | 5 +- app/views/admin/stats/show.html.erb | 98 ++++++++++++++++++----- config/locales/admin.en.yml | 1 - config/locales/admin.es.yml | 5 +- 5 files changed, 108 insertions(+), 27 deletions(-) diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index ffabd35a8..94b128e4c 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -72,9 +72,12 @@ body.admin { // - - - - - - - - - - - - - - - - - - - - - - - - - .admin-sidebar { - margin-left: rem-calc(-20); margin-top: rem-calc(24); + @media (min-width: $small-breakpoint) { + margin-left: rem-calc(-20); + } + ul { list-style-type: none; margin-left: 0; @@ -248,3 +251,24 @@ body.admin { .stats { background: white; } + +.stats-numbers { + p { + color: $text-medium; + font-size: rem-calc(13); + padding: rem-calc(6); + text-transform: uppercase; + + &.featured { + background: $info-bg; + border: 1px solid $info-border; + font-weight: bold; + } + + .number { + color: $text; + font-size: rem-calc(30); + font-weight: bold; + } + } +} diff --git a/app/assets/stylesheets/participacion.scss b/app/assets/stylesheets/participacion.scss index edcad4875..e8c7cb420 100644 --- a/app/assets/stylesheets/participacion.scss +++ b/app/assets/stylesheets/participacion.scss @@ -493,9 +493,12 @@ header { img { height: 48px; - margin-top: rem-calc(24); width: 48px; + @media (min-width: $small-breakpoint) { + margin-top: rem-calc(24); + } + @media (min-width: $medium-breakpoint) { height: 96px; margin-right: rem-calc(12); diff --git a/app/views/admin/stats/show.html.erb b/app/views/admin/stats/show.html.erb index 1f6c39327..31a0dbf2c 100644 --- a/app/views/admin/stats/show.html.erb +++ b/app/views/admin/stats/show.html.erb @@ -6,36 +6,92 @@

<%= t "admin.stats.show.stats_title" %>

-

<%= t "admin.stats.show.summary_title" %>

- +
+
+ -
-

<%= t "admin.stats.show.combined_title" %>

+

+ <%= t "admin.stats.show.summary.debates" %>
+ <%= @debates %> +

+

+ <%= t "admin.stats.show.summary.proposals" %>
+ <%= @proposals %> +

+

+ <%= t "admin.stats.show.summary.comments" %>
+ <%= @comments %> +

+
+ +
+ + +

+ <%= t "admin.stats.show.summary.debate_votes" %>
+ <%= @debate_votes %> +

+ +

+ <%= t "admin.stats.show.summary.comment_votes" %>
+ <%= @comment_votes %> +

+ +

+ <%= t "admin.stats.show.summary.votes" %>
+ <%= @votes %> +

+
+ +
+ + + +
+ +
+ + +

+ <%= t "admin.stats.show.summary.user_level_two" %>
+ <%= @user_level_two %> +

+ +

+ <%= t "admin.stats.show.summary.user_level_three" %>
+ <%= @user_level_three %> +

+
+
+ +
+

<%= t "admin.stats.show.combined_title" %>

<%= visits_chart_tag id: "visits" %>
-
-

<%= t "admin.stats.show.visits_title" %>

+
+

<%= t "admin.stats.show.visits_title" %>

<%= events_chart_tag @event_types.keys, id: 'combined' %>
<% @event_types.each do |event, count| %> -

<%= event.titleize %> (<%= count %>)

+

<%= event.titleize %> (<%= count %>)

<%= events_chart_tag event %> <% end %>
diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index 0de19481f..4fbf50b57 100644 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -149,7 +149,6 @@ en: block: Blocked stats: show: - summary_title: Summary stats_title: Stats visits_title: Visits combined_title: Combined diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index 1f6e1ac7e..61ba752ba 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -149,7 +149,6 @@ es: block: Bloqueado stats: show: - summary_title: Resumen stats_title: Estadísticas visits_title: Visitas combined_title: Combinado @@ -158,9 +157,9 @@ es: debates: Debates proposals: Propuestas comments: Comentarios - debate_votes: Votes en debates + debate_votes: Votos en debates proposal_votes: Votos en propuestas - comment_votes: Votso en comentarios + comment_votes: Votos en comentarios votes: Votos user_level_three: Usuarios de nivel tres user_level_two: Usuarios de nivel dos From b5a85b20402e88325d4dc7834bc9d19f5f25bfa4 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 28 Sep 2015 16:17:40 +0200 Subject: [PATCH 2/2] Changes tests --- spec/features/stats_spec.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/features/stats_spec.rb b/spec/features/stats_spec.rb index ee06b9c79..ef8d15ad5 100644 --- a/spec/features/stats_spec.rb +++ b/spec/features/stats_spec.rb @@ -17,10 +17,10 @@ feature 'Stats' do visit admin_stats_path - expect(page).to have_content "Debates: 1" - expect(page).to have_content "Proposals: 2" - expect(page).to have_content "Comments: 3" - expect(page).to have_content "Visits: 4" + expect(page).to have_content "Debates 1" + expect(page).to have_content "Proposals 2" + expect(page).to have_content "Comments 3" + expect(page).to have_content "Visits 4" end scenario 'Votes' do @@ -35,10 +35,10 @@ feature 'Stats' do visit admin_stats_path - expect(page).to have_content "Debate votes: 1" - expect(page).to have_content "Proposal votes: 2" - expect(page).to have_content "Comment votes: 3" - expect(page).to have_content "Total votes: 6" + expect(page).to have_content "Debate votes 1" + expect(page).to have_content "Proposal votes 2" + expect(page).to have_content "Comment votes 3" + expect(page).to have_content "Total votes 6" end scenario 'Users' do @@ -54,11 +54,11 @@ feature 'Stats' do visit admin_stats_path - expect(page).to have_content "Level three users: 1" - expect(page).to have_content "Level two users: 2" - expect(page).to have_content "Verified users: 3" - expect(page).to have_content "Unverified users: 4" - expect(page).to have_content "Total users: 7" + expect(page).to have_content "Level three users 1" + expect(page).to have_content "Level two users 2" + expect(page).to have_content "Verified users 3" + expect(page).to have_content "Unverified users 4" + expect(page).to have_content "Total users 7" end end