Merge pull request #568 from AyuntamientoMadrid/design_stats

Design stats
This commit is contained in:
Raimond Garcia
2015-09-28 16:41:56 +02:00
6 changed files with 121 additions and 40 deletions

View File

@@ -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;
}
}
}

View File

@@ -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);

View File

@@ -6,36 +6,92 @@
<div class="small-12 column">
<h1><%= t "admin.stats.show.stats_title" %></h1>
<h2><%= t "admin.stats.show.summary_title" %></h2>
<ul>
<li><strong><%= t "admin.stats.show.summary.visits" %>: <%= @visits %></strong></li>
<li><%= t "admin.stats.show.summary.debates" %>: <%= @debates %></li>
<li><%= t "admin.stats.show.summary.proposals" %>: <%= @proposals %></li>
<li><%= t "admin.stats.show.summary.comments" %>: <%= @comments %></li>
<li><%= t "admin.stats.show.summary.debate_votes" %>: <%= @debate_votes %></li>
<li><strong><%= t "admin.stats.show.summary.proposal_votes" %>: <%= @proposal_votes %></strong></li>
<li><%= t "admin.stats.show.summary.comment_votes" %>: <%= @comment_votes %></li>
<li><%= t "admin.stats.show.summary.votes" %>: <%= @votes %></li>
<li><%= t "admin.stats.show.summary.user_level_two" %>: <%= @user_level_two %></li>
<li><%= t "admin.stats.show.summary.user_level_three" %>: <%= @user_level_three %></li>
<li><strong><%= t "admin.stats.show.summary.verified_users" %>: <%= @verified_users %></strong></li>
<li><strong><%= t "admin.stats.show.summary.unverified_users" %>: <%= @unverified_users %><strong></li>
<li><strong><%= t "admin.stats.show.summary.users" %>: <%= @users %></strong></li>
</ul>
<div class="row stats-numbers">
<div class="small-12 medium-3 column">
<p class="featured">
<%= t "admin.stats.show.summary.visits" %><br>
<span class="number"><%= @visits %></span>
</p>
<div class="small-12 medium-6 column">
<h3><%= t "admin.stats.show.combined_title" %></h3>
<p>
<%= t "admin.stats.show.summary.debates" %><br>
<span class="number"><%= @debates %></span>
</p>
<p>
<%= t "admin.stats.show.summary.proposals" %><br>
<span class="number"><%= @proposals %></span>
</p>
<p>
<%= t "admin.stats.show.summary.comments" %><br>
<span class="number"><%= @comments %></span>
</p>
</div>
<div class="small-12 medium-3 column">
<p class="featured">
<%= t "admin.stats.show.summary.proposal_votes" %><br>
<span class="number"><%= @proposal_votes %><br></span>
</p>
<p>
<%= t "admin.stats.show.summary.debate_votes" %><br>
<span class="number"><%= @debate_votes %></span>
</p>
<p>
<%= t "admin.stats.show.summary.comment_votes" %><br>
<span class="number"><%= @comment_votes %></span>
</p>
<p>
<%= t "admin.stats.show.summary.votes" %><br>
<span class="number"><%= @votes %></span>
</p>
</div>
<div class="small-12 medium-3 column">
<p class="featured">
<%= t "admin.stats.show.summary.verified_users" %><br>
<span class="number"><%= @verified_users %></span>
</p>
<p class="featured">
<%= t "admin.stats.show.summary.unverified_users" %><br>
<span class="number"><%= @unverified_users %></span>
</p>
</div>
<div class="small-12 medium-3 column">
<p class="featured">
<%= t "admin.stats.show.summary.users" %><br>
<span class="number"><%= @users %></span>
</p>
<p>
<%= t "admin.stats.show.summary.user_level_two" %><br>
<span class="number"><%= @user_level_two %></span>
</p>
<p>
<%= t "admin.stats.show.summary.user_level_three" %><br>
<span class="number"><%= @user_level_three %></span>
</p>
</div>
</div>
<div class="small-12 medium-6 left">
<h2><%= t "admin.stats.show.combined_title" %></h2>
<%= visits_chart_tag id: "visits" %>
</div>
<div class="small-12 medium-6 column">
<h3><%= t "admin.stats.show.visits_title" %></h3>
<div class="small-12 medium-6 left">
<h2><%= t "admin.stats.show.visits_title" %></h2>
<%= events_chart_tag @event_types.keys, id: 'combined' %>
</div>
<div class="small-12">
<% @event_types.each do |event, count| %>
<h3><%= event.titleize %> (<%= count %>)</h3>
<h2><%= event.titleize %> (<%= count %>)</h2>
<%= events_chart_tag event %>
<% end %>
</div>

View File

@@ -149,7 +149,6 @@ en:
block: Blocked
stats:
show:
summary_title: Summary
stats_title: Stats
visits_title: Visits
combined_title: Combined

View File

@@ -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

View File

@@ -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