adds minimal public stats
This commit is contained in:
22
app/controllers/stats_controller.rb
Normal file
22
app/controllers/stats_controller.rb
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
class StatsController < ApplicationController
|
||||||
|
include FeatureFlags
|
||||||
|
|
||||||
|
feature_flag :public_stats
|
||||||
|
|
||||||
|
skip_authorization_check
|
||||||
|
|
||||||
|
def index
|
||||||
|
@visits = Visit.count
|
||||||
|
@debates = Debate.with_hidden.count
|
||||||
|
@proposals = Proposal.with_hidden.count
|
||||||
|
@comments = Comment.with_hidden.count
|
||||||
|
|
||||||
|
@debate_votes = Vote.where(votable_type: 'Debate').count
|
||||||
|
@proposal_votes = Vote.where(votable_type: 'Proposal').count
|
||||||
|
@comment_votes = Vote.where(votable_type: 'Comment').count
|
||||||
|
@votes = Vote.count
|
||||||
|
|
||||||
|
@verified_users = User.with_hidden.level_two_or_three_verified.count
|
||||||
|
@unverified_users = User.with_hidden.unverified.count
|
||||||
|
end
|
||||||
|
end
|
||||||
64
app/views/stats/index.html.erb
Normal file
64
app/views/stats/index.html.erb
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<div class="stats row-full">
|
||||||
|
<div class="row">
|
||||||
|
<div class="small-12 column">
|
||||||
|
<h1><%= t "admin.stats.show.stats_title" %></h1>
|
||||||
|
|
||||||
|
<div class="row stats-numbers">
|
||||||
|
<div class="small-12 medium-4 column">
|
||||||
|
<p class="featured">
|
||||||
|
<%= t "stats.index.visits" %><br>
|
||||||
|
<span class="number"><%= number_with_delimiter(@visits) %></span>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<%= t "stats.index.debates" %><br>
|
||||||
|
<span class="number"><%= number_with_delimiter(@debates) %></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= t "stats.index.proposals" %><br>
|
||||||
|
<span class="number"><%= number_with_delimiter(@proposals) %></span>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= t "stats.index.comments" %><br>
|
||||||
|
<span class="number"><%= number_with_delimiter(@comments) %></span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="small-12 medium-4 column">
|
||||||
|
<p class="featured">
|
||||||
|
<%= t "stats.index.proposal_votes" %><br>
|
||||||
|
<span class="number"><%= number_with_delimiter(@proposal_votes) %><br></span>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<%= t "stats.index.debate_votes" %><br>
|
||||||
|
<span class="number"><%= number_with_delimiter(@debate_votes) %></span>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<%= t "stats.index.comment_votes" %><br>
|
||||||
|
<span class="number"><%= number_with_delimiter(@comment_votes) %></span>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<%= t "stats.index.votes" %><br>
|
||||||
|
<span class="number"><%= number_with_delimiter(@votes) %></span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="small-12 medium-4 column">
|
||||||
|
<p class="featured">
|
||||||
|
<%= t "stats.index.verified_users" %><br>
|
||||||
|
<span class="number"><%= number_with_delimiter(@verified_users) %></span>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<%= t "stats.index.unverified_users" %><br>
|
||||||
|
<span class="number"><%= number_with_delimiter(@unverified_users) %></span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -418,6 +418,18 @@ en:
|
|||||||
recommendation_two: Any proposal or comment suggesting illegal action will be deleted.
|
recommendation_two: Any proposal or comment suggesting illegal action will be deleted.
|
||||||
recommendations_title: How to create a spending proposal
|
recommendations_title: How to create a spending proposal
|
||||||
start_new: Create spending proposal
|
start_new: Create spending proposal
|
||||||
|
stats:
|
||||||
|
index:
|
||||||
|
visits: Visits
|
||||||
|
debates: Debates
|
||||||
|
proposals: Proposals
|
||||||
|
comments: Comments
|
||||||
|
proposal_votes: Votes on proposals
|
||||||
|
debate_votes: Votes on debates
|
||||||
|
comment_votes: Votes on comments
|
||||||
|
votes: Total otes
|
||||||
|
verified_users: Verified users
|
||||||
|
unverified_users: Unverified users
|
||||||
unauthorized:
|
unauthorized:
|
||||||
default: You do not have permission to access this page.
|
default: You do not have permission to access this page.
|
||||||
manage:
|
manage:
|
||||||
|
|||||||
@@ -419,6 +419,18 @@ es:
|
|||||||
recommendation_two: Cualquier propuesta o comentario que implique acciones ilegales será eliminada.
|
recommendation_two: Cualquier propuesta o comentario que implique acciones ilegales será eliminada.
|
||||||
recommendations_title: Cómo crear una propuesta de gasto
|
recommendations_title: Cómo crear una propuesta de gasto
|
||||||
start_new: Crear una propuesta de gasto
|
start_new: Crear una propuesta de gasto
|
||||||
|
stats:
|
||||||
|
index:
|
||||||
|
visits: Visitas
|
||||||
|
debates: Debates
|
||||||
|
proposals: Propuestas ciudadanas
|
||||||
|
comments: Comentarios
|
||||||
|
proposal_votes: Votos en propuestas
|
||||||
|
debate_votes: Votos en debates
|
||||||
|
comment_votes: Votos en comentarios
|
||||||
|
votes: Votos
|
||||||
|
verified_users: Usuarios verificados
|
||||||
|
unverified_users: Usuarios sin verificar
|
||||||
unauthorized:
|
unauthorized:
|
||||||
default: No tienes permiso para acceder a esta página.
|
default: No tienes permiso para acceder a esta página.
|
||||||
manage:
|
manage:
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
resources :spending_proposals, only: [:index, :new, :create]
|
resources :spending_proposals, only: [:index, :new, :create]
|
||||||
|
|
||||||
|
resources :stats, only: [:index]
|
||||||
|
|
||||||
resources :legislations, only: [:show]
|
resources :legislations, only: [:show]
|
||||||
|
|
||||||
resources :annotations do
|
resources :annotations do
|
||||||
|
|||||||
Reference in New Issue
Block a user