Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:PartidoDeInternet/AgoraOnRails

  • Loading branch information...
commit 96041715c0fb73ac073854c853a825850b19de1e 2 parents 27ba41a + 2d42276
Raimond Garcia voodoorai2000 authored
Showing with 360 additions and 287 deletions.
  1. +4 −9 app/helpers/application_helper.rb
  2. +18 −8 app/helpers/proposals_helper.rb
  3. +0 −2  app/helpers/proposers_helper.rb
  4. +1 −2  app/helpers/share_helper.rb
  5. +0 −2  app/helpers/user_sessions_helper.rb
  6. +3 −4 app/helpers/votes_helper.rb
  7. +8 −4 app/models/proposal.rb
  8. +21 −21 app/views/layouts/application.html.erb
  9. +1 −2  app/views/layouts/mini_application.html.erb
  10. +17 −0 app/views/proposals/_form.html.erb
  11. +3 −3 app/views/proposals/_vote_calculator.html.erb
  12. +0 −24 app/views/proposals/edit.html.erb
  13. +2 −2 app/views/proposals/index.html.erb
  14. +24 −54 app/views/proposals/show.html.erb
  15. +9 −5 app/views/shared/_proposal.html.erb
  16. +6 −6 app/views/shared/_results.html.erb
  17. +5 −5 app/views/user_sessions/new.html.erb
  18. +4 −6 app/views/users/_proposal.html.erb
  19. +5 −4 app/views/users/choose_as_spokesman.html.erb
  20. +4 −4 app/views/users/confirm_spokesman_change.html.erb
  21. +3 −2 app/views/users/index.html.erb
  22. +34 −34 app/views/users/new.html.erb
  23. +9 −8 app/views/users/show.html.erb
  24. +11 −8 app/views/votes/new.html.erb
  25. +2 −2 app/views/votes/show.html.erb
  26. +11 −17 app/views/welcome/index.html.erb
  27. +11 −0 config/config.yml
  28. +1 −0  config/initializers/0_load_config.rb
  29. +10 −1 config/locales/en.yml
  30. +88 −0 config/locales/es.yml
  31. +0 −9 db/migrate/20110321010225_remove_confidential_vote.rb
  32. +2 −3 db/schema.rb
  33. +6 −2 spec/acceptance/admin_can_close_proposals_spec.rb
  34. +3 −3 spec/acceptance/dni_authentication_spec.rb
  35. +2 −1  spec/acceptance/navigate_spec.rb
  36. +1 −0  spec/acceptance/spokesmen_spec.rb
  37. +2 −1  spec/acceptance/vote_calculator_spec.rb
  38. +29 −29 spec/acceptance/vote_for_proposals_spec.rb
13 app/helpers/application_helper.rb
View
@@ -1,4 +1,3 @@
-# coding: utf-8
module ApplicationHelper
def hot_categories
@hot_categories ||= Category.hot
@@ -21,18 +20,14 @@ def awesome_truncate(text, length = 30, truncate_string = "...")
end
def humanize(choice)
- case choice
- when "in_favor" then ""
- when "against" then "No"
- when "abstention" then "Abs"
- end
+ t(choice)
end
- def vote_text(proposal)
+ def who_did_vote(proposal)
if proposal.votes.blank?
- "<strong>Vota!</strong> Sé el primero en votar".html_safe
+ t(:be_first)
else
- "<strong>Vota!</strong> #{pluralize(proposal.votes.count, 'persona ya lo ha hecho', 'personas ya lo han hecho')}".html_safe
+ pluralize(proposal.votes.count, t(:one_did_it), t(:many_did_it))
end
end
end
26 app/helpers/proposals_helper.rb
View
@@ -1,24 +1,34 @@
module ProposalsHelper
def proposals_heading
case parent_type
- when :category then "Propuestas relacionadas con #{parent.name}"
- when :proposer then "Propuestas presentadas por #{parent.name}"
+ when :category then t(:related_with_category, :category => parent.name)
+ when :proposer then t(:proposed_by, :proposer => parent.name)
else
- "Propuestas"
+ t :proposals
end
end
+
+ def choice_result(proposal, choice)
+ content_tag :strong, :style => "width:#{percentage_for(proposal, choice)}-width" do
+ humanize(choice)
+ end
+ end
+
+ def percentage_for(proposal, choice)
+ number_to_percentage(proposal.percentage_for(choice.to_sym), :precision => 0)
+ end
def show_toggle_button(is_admin)
- if (is_admin and !@proposal.closed?)
- button_to("Finalizar votaci&oacute;n", toggle_proposal_path(@proposal)).html_safe
+ if is_admin && @proposal.open?
+ button_to t(:end_voting), toggle_proposal_path(@proposal)
end
end
def show_closed_text
- if @proposal.closer_id.present?
- "El periodo de votaci&oacute;n para esta propuesta finaliz&oacute; el #{l(@proposal.closed_at)}"
+ if @proposal.closed? && @proposal.official_resolution.blank?
+ t(:closed, :date => l(@proposal.closed_at))
else
- "La Propuesta fue <span class=\"official_resolution\"> #{@proposal.official_resolution}</span> en el Congreso."
+ t(:congress_resolution_html, :resolution => @proposal.official_resolution)
end
end
2  app/helpers/proposers_helper.rb
View
@@ -1,2 +0,0 @@
-module ProposersHelper
-end
3  app/helpers/share_helper.rb
View
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
module ShareHelper
def image_url(source)
abs_path = image_path(source)
@@ -9,7 +8,7 @@ def image_url(source)
end
def share_text(proposal)
- "He votado a través del partido del internet la propuesta #{proposal_url(proposal)}"
+ t(:share_text, :url => proposal_url(proposal))
end
def share_on_facebook_link(proposal)
2  app/helpers/user_sessions_helper.rb
View
@@ -1,2 +0,0 @@
-module UserSessionsHelper
-end
7 app/helpers/votes_helper.rb
View
@@ -1,11 +1,10 @@
-# -*- coding: utf-8 -*-
module VotesHelper
def confirmation_text(value)
case value
- when "no" then "a votar en contra de"
- when "si" then "a votar a favor de"
- when "abstencion" then "a abstenerte de votar sobre"
+ when "no" then t(:going_to_vote_against)
+ when "si" then t(:going_to_vote_in_favor)
+ when "abstencion" then t(:going_to_abstain)
end
end
12 app/models/proposal.rb
View
@@ -79,6 +79,14 @@ def proposer_name
def category_name
category.name
end
+
+ def closed?
+ closed_at.present?
+ end
+
+ def open?
+ closed_at.blank?
+ end
def close(cid)
self.closed_at = DateTime.now
@@ -86,8 +94,4 @@ def close(cid)
self.save!
count_votes!
end
-
- def reopen
-
- end
end
42 app/views/layouts/application.html.erb
View
@@ -6,11 +6,10 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="/stylesheets/populo.css" type="text/css" media="screen" charset="utf-8"/>
<!--[if lte IE 6]>
- <link rel="stylesheet" href="/stylesheets/populo-ie.css" type="text/css" media="screen" charset="utf-8"/>
+ <link rel="stylesheet" href="/stylesheets/populo-ie.css" type="text/css" media="screen" charset="utf-8"/>
<![endif]-->
<%= javascript_include_tag 'jquery', 'jquery_tools', 'rails', 'application' %>
<%= csrf_meta_tag %>
- <%= render :partial => "shared/google_analytics" %>
<%= yield :head %>
</head>
<body>
@@ -20,28 +19,29 @@
<div id="wrap">
<div id="wrap-inner">
<div class="wrap-fit">
-
+
<section id="header">
- <header>
- </header>
<% if current_user %>
- <nav id="user-nav">
- <ul>
- <li>Estoy logueado como <%= current_user.name %> y <%= link_to "quiero salir", user_session_path, :method => "delete" %></li>
- </ul>
- </nav>
+ <nav id="user-nav">
+ <ul>
+ <li>
+ <%= t :currently_logged_as, :username => current_user.name,
+ :href => link_to(t("want_to_sign_out"), user_session_path, :method => "delete") %>
+ </li>
+ </ul>
+ </nav>
<% end %>
</section>
<% flash.each do |key, value| %>
<div class="<%= key %>"><%= value %></div>
<% end %>
-
+
<%= yield %>
-
+
<aside>
<dl class="tag_list" id="categories">
- <dt><strong>¿De qué se habla?</strong></dt>
+ <dt><strong><%= t :what_proposals %></strong></dt>
<dd>
<ul>
<% hot_categories.each_with_index do |category, index| %>
@@ -57,7 +57,7 @@
</dl>
<dl class="tag_list" id="proposers">
- <dt><strong>¿Quién propone?</strong></dt>
+ <dt><strong><%= t :who_proposed %></strong></dt>
<dd>
<ul>
<% hot_proposers.each_with_index do |proposer, index| %>
@@ -73,17 +73,16 @@
</dl>
</aside>
-
+
</div>
</div>
</div>
-<footer>
- <div class="wrap-fit">
- <section id="total-votes"><strong><%= number_with_delimiter Vote.count %></strong> votos a través de AgoraOnRails</section>
- <p>Proyecto desarrollado a partir de <a href="http://populo.heroku.com/">Populo</a></p>
- </div>
-</footer>
+ <footer>
+ <div class="wrap-fit">
+ <section id="total-votes"><strong><%= number_with_delimiter Vote.count %></strong> <%= t :votes_through_agora %></section>
+ </div>
+ </footer>
<div id="overlay">
<div id="overlay-inner">
@@ -91,5 +90,6 @@
</div>
</div>
+ <%= render :partial => "shared/google_analytics" if Rails.env == 'production' %>
</body>
</html>
3  app/views/layouts/mini_application.html.erb
View
@@ -10,7 +10,6 @@
<![endif]-->
<%= javascript_include_tag 'jquery', 'jquery_tools', 'rails', 'application' %>
<%= csrf_meta_tag %>
- <%= render :partial => "shared/google_analytics" %>
</head>
<body id="mini">
@@ -32,6 +31,6 @@
</div>
</div>
-
+ <%= render :partial => "shared/google_analytics" if Rails.env == 'production' %>
</body>
</html>
17 app/views/proposals/_form.html.erb
View
@@ -0,0 +1,17 @@
+<%= form_tag new_proposal_vote_path(@proposal), {:method => :get, :class => "vote"} do %>
+ <fieldset>
+ <strong><%= t :vote_proposal %></strong>
+ <div>
+ <%= label_tag :explanation, t(:explain) %><br/>
+ <%= text_area_tag :explanation, nil, :size => "40x5" %>
+ </div>
+ <div>
+ <%= label_tag :link, t(:optional_link) %><br/>
+ <%= text_field_tag :link, nil, :size => "40" %>
+ </div>
+ <br/>
+ <button type="submit" name="value" value="si" class="si"><span><%= t(:yes_option)%></span></button>
+ <button type="submit" name="value" value="no" class="no"><span><%= t(:no_option)%></span></button>
+ <button type="submit" name="value" value="abstencion" class="abstencion"><span><%= t(:abstention)%></span></button>
+ </fieldset>
+<% end %>
6 app/views/proposals/_vote_calculator.html.erb
View
@@ -1,8 +1,8 @@
<%= form_tag proposal_path(@proposal), :method => :get do %>
- <p>Calcula el voto de los representantes:</p>
+ <p><%= t :calculate_representatives_vote %></p>
<p>
- <%= label_tag 'numero de representantes'%>
+ <%= label_tag t(:representatives_number)%>
<%= text_field_tag 'representative_count' %>
</p>
- <%= submit_tag 'Calcular'%>
+ <%= submit_tag t(:calculate) %>
<% end %>
24 app/views/proposals/edit.html.erb
View
@@ -1,24 +0,0 @@
-<h1>Editing proposal</h1>
-
-<%= form_for(@proposal) do |f| %>
- <%= f.error_messages %>
-
- <p>
- <%= f.label :title %><br />
- <%= f.text_field :title %>
- </p>
- <p>
- <%= f.label :official_url %><br />
- <%= f.text_field :official_url %>
- </p>
- <p>
- <%= f.label :proposal_type %><br />
- <%= f.text_field :proposal_type %>
- </p>
- <p>
- <%= f.submit 'Update' %>
- </p>
-<% end %>
-
-<%= link_to 'Show', @proposal %> |
-<%= link_to 'Back', proposals_path %>
4 app/views/proposals/index.html.erb
View
@@ -1,8 +1,8 @@
<% @title = proposals_heading %>
<section id="content">
<ul id="breadcrumb">
- <li><a href="/">Inicio »</a></li>
- <li><%= link_to "Proposiciones", proposals_path %></li>
+ <li><a href="/"><%= t(:start) %> »</a></li>
+ <li><%= link_to t(:proposals), proposals_path %></li>
</ul>
<header class="proposal-head">
78 app/views/proposals/show.html.erb
View
@@ -1,10 +1,11 @@
<%= render 'opengraph' %>
<% @title = "#{awesome_truncate(@proposal.title, 100)}" %>
+
<section id="content">
<ul id="breadcrumb">
<li><a href="/">Inicio »</a></li>
- <li><%= link_to "Proposiciones", proposals_path %></li>
+ <li><%= link_to t(:proposals), proposals_path %></li>
</ul>
<article class="proposal" id="proposal_<%= @proposal.id %>">
<section class="proposal-content">
@@ -13,46 +14,40 @@
<hgroup>
<h2 class="title"><%=h @proposal.title %></h2>
<h3 class="proposal_type">
- <%=h @proposal.proposal_type %> (<a class="official_url" href="<%= @proposal.official_url %>">Enlace oficial</a>)
+ <%=h @proposal.proposal_type %>
+ <%= link_to t(:official_link), @proposal.official_url, :class => 'official_url' %>
</h3>
</hgroup>
<%= show_toggle_button(current_user.is_admin?) if current_user %>
<ul class="meta">
- <li class="votes"><%= number_with_delimiter @proposal.votes.count %> votos</li>
- <li class="views"><%= number_with_delimiter @proposal.visits %> visitas</li>
+ <li class="votes">
+ <%= number_with_delimiter @proposal.votes.count %> <%= t(:votes) %>
+ </li>
+ <li class="views">
+ <%= number_with_delimiter @proposal.visits %> <%= t(:views) %>
+ </li>
</ul>
</header>
<% if @proposal.closed? %>
<p class="solved">
- <%= show_closed_text.html_safe %>
+ <%= show_closed_text %>
</p>
<% elsif current_user && current_user.has_voted_for?(@proposal) %>
- <p class="voted">Ya has votado esta propuesta</p>
+ <p class="voted">
+ <%= t :already_voted %>
+ </p>
<%= render 'proposals/share' %>
<% else %>
- <%= form_tag new_proposal_vote_path(@proposal), {:method => :get, :class => "vote"} do -%>
- <fieldset>
- <strong>Vota esta propuesta</strong>
- <div>
- <%= label_tag :explanation, "Explica tu opinión (opcional)" %><br/>
- <%= text_area_tag :explanation, nil, :size => "40x5" %>
- </div>
- <div>
- <%= label_tag :link, "Enlace (opcional)" %><br/>
- <%= text_field_tag :link, nil, :size => "40" %>
- </div>
- <br/>
- <button type="submit" name="value" value="si" class="si"><span>Sí</span></button>
- <button type="submit" name="value" value="no" class="no"><span>No</span></button>
- <button type="submit" name="value" value="abstencion" class="abstencion"><span>Abstencion</span></button>
- </fieldset>
- <% end -%>
+ <%= render 'proposals/form' %>
<% end %>
+
<section class="vote-results documents-list">
<dl>
- <dt><strong>Votación popular</strong></dt>
+ <dt>
+ <strong><%= t(:popular_vote)%></strong>
+ </dt>
<dd>
<%= render :partial => "shared/results", :locals => {:proposal => @proposal, :width => 20} %>
</dd>
@@ -64,38 +59,13 @@
<p class="votes_with_explanations">
<%= render :partial => "vote", :collection => @proposal.votes.order_by_represented_users %>
</p>
-
- <!--
- <section class="documentation documents-list">
- <dl>
- <dt><strong>Documentación</strong></dt>
- <dd>
- <ul>
- <li><a href="#">BOCG. B-213-1 de 04/12/2009</a> <span>iniciativa</span></li>
- <li><a href="#">BOCG. B-213-1 de 04/12/2009</a> <span>iniciativa</span></li>
- <li><a href="#">BOCG. B-213-1 de 04/12/2009</a> <span>iniciativa</span></li>
- </ul>
- </dd>
- </dl>
- </section>
-
- <section class="sessions documents-list">
- <dl>
- <dt><strong>Diario de sesiones</strong></dt>
- <dd>
- <ul>
- <li><a href="#">BOCG. B-213-1 de 04/12/2009</a> <span>iniciativa</span></li>
- <li><a href="#">BOCG. B-213-1 de 04/12/2009</a> <span>iniciativa</span></li>
- <li><a href="#">BOCG. B-213-1 de 04/12/2009</a> <span>iniciativa</span></li>
- </ul>
- </dd>
- </dl>
- </section>
- -->
</section>
- <% unless @proposal.category.blank? %>
+
+ <% if @proposal.category.present? %>
<dl class="tag_list" id="related">
- <dt><strong>Relacionada con</strong></dt>
+ <dt>
+ <strong><%= t(:related_with)%></strong>
+ </dt>
<dd>
<ul>
<li class="related">
14 app/views/shared/_proposal.html.erb
View
@@ -4,18 +4,19 @@
<hgroup>
<h2 class="title"><%= link_to awesome_truncate(proposal.title, 150), proposal %></h2>
<h3>
- Presentado por: <%= link_to proposal.proposer.name, proposal.proposer, :class => "proposer" %>
- el <span class="proposed_at"><%= l proposal.proposed_at, :format => :long %></span>
+ <%= t(:proposed_by) %> <%= link_to proposal.proposer.name, proposal.proposer, :class => "proposer" %>
+ <%= t(:on) %>
+ <span class="proposed_at"><%= l proposal.proposed_at, :format => :long %></span>
</h3>
</hgroup>
</header>
</section>
<% if proposal.closed? %>
<section class="voters">
- <p class="solved"><span class="official_resolution"> <%= proposal.official_resolution %></span> en el Congreso.</p>
+ <p class="solved"><span class="official_resolution"> <%= proposal.official_resolution %></span> <%= t(:in_congress) %>.</p>
<section class="vote-results documents-list voters">
<dl>
- <dt><strong>Resultados de la votación popular</strong></dt>
+ <dt><strong><%= t :popular_vote_results %></strong></dt>
<dd>
<%= render :partial => "shared/results", :locals => {:proposal => proposal, :width => 40} %>
</dd>
@@ -24,7 +25,10 @@
</section>
<% else %>
<section class="voters">
- <%= link_to vote_text(proposal), proposal, :class => "vote-link" %>
+ <%= link_to proposal, :class => "vote-link" do %>
+ <strong><%= t(:vote_prompt) %></strong>
+ <%= who_did_vote(proposal) %>
+ <% end %>
</section>
<% end %>
<span class="decorate up"></span>
12 app/views/shared/_results.html.erb
View
@@ -1,14 +1,14 @@
<ul>
<% Vote.choices.each do |choice| %>
<li class="<%= choice %>">
- <strong style="width:<%= "#{ number_to_percentage(proposal.percentage_for(choice.to_sym)-width, :precision => 0) }" %>"><%= humanize(choice) %></strong>
- <span class="vote_percentage"><%= "#{ number_to_percentage(proposal.percentage_for(choice.to_sym), :precision => 0) }" %></span>
- <span class="vote_count"><%= "#{ proposal.send("total_#{choice}")} votos" %></span>
- <% if params[:representative_count].present?%>
+ <%= choice_result(proposal, choice) %>
+ <span class="vote_percentage"><%= percentage_for(proposal, choice) %></span>
+ <span class="vote_count"><%= proposal.total(choice)%> <%= t(:votes) %></span>
+ <% if params[:representative_count].present? %>
<span class="representative_count_<%= choice %>">
- <%= "#{ proposal.send("total_representatives_#{choice}", params[:representative_count])} representantes" %>
+ <%= proposal.total_representatives(choice, params[:representative_count]) %> <%= t(:representatives) %> %>
</span>
- <%end%>
+ <% end %>
</li>
<% end %>
</ul>
10 app/views/user_sessions/new.html.erb
View
@@ -1,18 +1,18 @@
-<h2>Autenticación con DNIe requerida</h2>
+<h2><%= t(:dnie_auth_required)%></h2>
<section id="login-section">
<div style="margin-bottom: 10px;">
- <%= identity_verification_gateway("Identifícate con tu DNIe", ENV["TRACTIS_API_KEY"], :action => 'authenticate') %>
+ <%= identity_verification_gateway(t(:identify_with_dnie), ENV["TRACTIS_API_KEY"], :action => 'authenticate') %>
</div>
<% if Rails.env != 'production' %>
<%= form_tag user_session_path do %>
- <p>o haz tongo creando una identidad falsa...</p>
+ <p><%= t(:try_with_test_id) %></p>
<p>
- <%= label_tag 'falso nombre'%>
+ <%= label_tag t(:fake_name) %>
<%= text_field_tag 'name' %>
</p>
- <%= submit_tag 'Haz tongo aquí'%>
+ <%= submit_tag t(:try_here) %>
<% end %>
<% end %>
</section>
10 app/views/users/_proposal.html.erb
View
@@ -4,8 +4,8 @@
<hgroup>
<h2 class="title"><%= link_to awesome_truncate(proposal.title, 150), proposal %></h2>
<h3>
- Presentado por: <%= link_to proposal.proposer.name, proposal.proposer, :class => "proposer" %>
- el <span class="proposed_at"><%= l proposal.proposed_at, :format => :long %></span>
+ <%= t(:proposed_desc_html, :proposer => link_to(proposal.proposer.name, proposal.proposer, :class => "proposer")) %>
+ <%= t(:on, :date => l(proposal.proposed_at, :format => :long))%>
</h3>
</hgroup>
</header>
@@ -17,12 +17,10 @@
<section class="vote-results documents-list">
<dl>
- <dt><strong>Votación popular</strong></dt>
+ <dt><strong><%= t(:popular_vote) %></strong></dt>
<dd>
<%= render :partial => "shared/results", :locals => {:proposal => proposal, :width => 20} %>
</dd>
</dl>
</section>
-
-</article>
-
+</article>
9 app/views/users/choose_as_spokesman.html.erb
View
@@ -1,14 +1,15 @@
-<h2>Hooray!!</h2>
+<h2><%= t(:hooray)%></h2>
<p class="confirmation-message">
<strong>
<% if @spokesman_change %>
- Has cambiado de portavoz.
+ <%= t(:changed_spokesman) %>
<% else %>
- Has elegido a tu portavoz.
+ <%= t(:chosen_spokesman) %>
<% end %>
</strong>
- Si nadie lo remedia en 5 segundos te llevaremos a la página de tu portavoz.
+
+ <%= t :spokeman_redirect %>
</p>
8 app/views/users/confirm_spokesman_change.html.erb
View
@@ -1,11 +1,11 @@
-<h2>¿Estás seguro?</h2>
+<h2><%= t(:are_you_sure) %></h2>
<p class="confirmation-message">
- <strong>Tu portavoz actual es <%= current_user.spokesman.name %>.</strong>
- Estás seguro de que quieres cambiarlo por <%= @spokesman.name %>
+ <strong><%= t :your_current_spokeman, :spokeman => current_user.spokesman.name %></strong>
+ <%= t :sure_to_change_spokeman, :spokeman => @spokesman.name %>
<%= form_for @spokesman, :url => choose_as_spokesman_user_path(@spokesman) do |f| -%>
<%= hidden_field_tag :confirmation, true %>
- <%= submit_tag "Estoy seguro", :id => "choose_spokesman_button", :class => "make-my-spokesman" %>
+ <%= submit_tag t(:i_am_sure), :id => "choose_spokesman_button", :class => "make-my-spokesman" %>
<% end -%>
</p>
5 app/views/users/index.html.erb
View
@@ -1,10 +1,11 @@
<section id="user_list">
<header>
- <h2>Usuari@s presentes en AgoraOnRails</h2>
+ <h2><%= t(:present_users) %></h2>
<p>
- Puedes delegar tu voto en ell@s para las propuestas en las que no votes directamente.
+ <%= t(:can_delegate_vote) %>
</p>
</header>
+
<% for user in @users do %>
<article class="user">
<header>
68 app/views/users/new.html.erb
View
@@ -1,37 +1,37 @@
-<h2>Regístrate </h2>
+<h2><%= t(:sign_up)%></h2>
<%= form_for @user, :url => users_path do |f| %>
- <%= f.error_messages %>
-
- <fieldset id="login-section">
-
- <div class="overlayfield">
- <%= f.label :login, "<span>Introduce tu usuario</span>".html_safe %>
- <%= f.text_field :login %>
- </div>
-
- <div class="overlayfield">
- <%= f.label :password, "<span>Dinos tu contraseña</span>".html_safe %>
- <%= f.password_field :password %>
- </div>
-
- <div class="overlayfield">
- <%= f.label :password_confirmation, "<span>Repite tu contraseña</span>".html_safe %>
- <%= f.password_field :password_confirmation %>
- </div>
-
- </fieldset>
-
- <fieldset>
-
- <div class="overlayfield">
- <%= f.label :email, "<span>Y por último tu email</span>".html_safe %>
- <%= f.text_field :email %>
- </div>
-
- </fieldset>
-
- <p class="actions">
- <button type="submit" class="confirm"><span>Regístrate</span></button>
- </p>
+<%= f.error_messages %>
+
+<fieldset id="login-section">
+
+ <div class="overlayfield">
+ <%= f.label :login, t(:username) %>
+ <%= f.text_field :login %>
+ </div>
+
+ <div class="overlayfield">
+ <%= f.label :password, t(:password) %>
+ <%= f.password_field :password %>
+ </div>
+
+ <div class="overlayfield">
+ <%= f.label :password_confirmation, t(:password_confirmation) %>
+ <%= f.password_field :password_confirmation %>
+ </div>
+
+</fieldset>
+
+<fieldset>
+
+ <div class="overlayfield">
+ <%= f.label :email, t(:email) %>
+ <%= f.text_field :email %>
+ </div>
+
+</fieldset>
+
+<p class="actions">
+ <button type="submit" class="confirm"><span><%= t(:sign_up)%></span></button>
+</p>
<% end %>
17 app/views/users/show.html.erb
View
@@ -1,20 +1,21 @@
<% @title = "#{@user.name}" %>
+
<section id="content">
<ul id="breadcrumb">
<li><a href="/">Inicio »</a></li>
- <li><%= link_to "Proposiciones", proposals_path %></li>
- <li><%= link_to "Usuari@s", users_path %></li>
+ <li><%= link_to t(:proposals), proposals_path %></li>
+ <li><%= link_to t(:users), users_path %></li>
</ul>
<% if current_user && current_user.spokesman == @user %>
- <%= form_for @user, :url => discharge_as_spokesman_user_path(@user) do |f| -%>
- <%= submit_tag "Destituir a #{h @user.name} de ser mi portavoz", :id => "discharge_spokesman_button", :class => "discharge-my-spokesman" %>
- <% end -%>
+ <%= form_for @user, :url => discharge_as_spokesman_user_path(@user) do |f| %>
+ <%= submit_tag t(:discharge_spokesman, :name => @user.name), :id => "discharge_spokesman_button", :class => "discharge-my-spokesman" %>
+ <% end %>
<% else %>
<% unless current_user == @user %>
- <%= form_for @user, :url => choose_as_spokesman_user_path(@user) do |f| -%>
- <%= submit_tag "Elegir a #{h @user.name} como mi portavoz", :id => "choose_spokesman_button", :class => "make-my-spokesman" %>
- <% end -%>
+ <%= form_for @user, :url => choose_as_spokesman_user_path(@user) do |f| %>
+ <%= submit_tag t(:choose_spokeman, :name => @user.name), :id => "choose_spokesman_button", :class => "make-my-spokesman" %>
+ <% end %>
<% end %>
<% end %>
19 app/views/votes/new.html.erb
View
@@ -1,15 +1,16 @@
-<h2>Revisa tu voto</h2>
+<h2><%= t(:review_vote)%></h2>
<p class="confirmation-message">
- <strong>Vas <%= confirmation_text(params[:value]) %></strong>
- la iniciativa “<%= @proposal.title %>
+ <strong><%= confirmation_text(params[:value]) %></strong>
- <% unless params[:explanation].blank? %>
- <p>Porque <%= params[:explanation] %></p>
+ <%= t(:the_proposal, :title => @proposal.title) %>
+
+ <% if params[:explanation].present? %>
+ <p><%= t :because, :explanation => params[:explanation] %></p>
<% end %>
- <% unless params[:link].blank? %>
- <p>Más información <%= params[:link] %></p>
+ <% if params[:link].present? %>
+ <p><%= t :more_info, :link => params[:link] %></p>
<% end %>
</p>
@@ -20,7 +21,9 @@
<%= f.hidden_field :explanation, :value => params[:explanation] %>
<%= f.hidden_field :link, :value => params[:link] %>
<p class="actions">
- <button type="submit" class="confirm"><span>Estoy seguro</span></button> o bueno... <%= link_to 'quiero pensármelo mejor', "#", :class => "oh-no" %>
+ <button type="submit" class="confirm"><span><%= t(:i_am_sure) %></span></button>
+ <%= t(:or_well)%>
+ <%= link_to t(:think_more), "#", :class => "oh-no" %>
</p>
<% end %>
4 app/views/votes/show.html.erb
View
@@ -1,6 +1,6 @@
-<h2>Hooray!!</h2>
+<h2><% t(:hooray)%></h2>
<p class="confirmation-message">
- <strong>Tu voto ha sido contabilizado.</strong>
+ <strong><%= t :vote_counted %></strong>
<%= render 'proposals/share' %>
</p>
28 app/views/welcome/index.html.erb
View
@@ -1,37 +1,31 @@
<section id="welcome">
<p>
- <h2>Hola!</h2>
- <p>¿Qué pasaría si los ciudadanos pudieran participar de manera más
- directa en las decisiones que se toman en el Congreso de los
- Diputados?" Es el experimento detrás de esta propuesta.</p>
- <p>AgoraOnRails es un simulador de la aplicación web en la los ciudadanos
- podrán decidir lo que votarán los diputados del <%= link_to "Partido de Internet", "http://partidodeinternet.es" %> en
- el Congreso a partir de las Elecciones Generales de 2012.</p>
+ <h2><%= t(:hello)%></h2>
+ <p><%= t(:intro_paragraph)%></p>
+ <p><%= t :whats_agora_html, :href => link_to(APP_CONFIG['org_name'], APP_CONFIG['org_url']) %></p>
</section>
<img src="/images/explain.png" width="951" height="33" alt="Explain"/>
<section id="content">
<nav id="nav">
<ul>
- <li><%= link_to "Hot!", "#hot_proposals", :id => "hot_proposals_link", :class => "navlinks" %></li>
- <li><%= link_to "Recién tramitadas", "#recently_closed", :id => "recently_closed_link", :class => "navlinks" %></li>
- <li><%= link_to "Usuari@s", users_path %></li>
+ <li><%= link_to t(:hot), "#hot_proposals", :id => "hot_proposals_link", :class => "navlinks" %></li>
+ <li><%= link_to t(:recently_closed), "#recently_closed", :id => "recently_closed_link", :class => "navlinks" %></li>
+ <li><%= link_to t(:users), users_path %></li>
</ul>
</nav>
<section id="hot_proposals" class="proposals">
<header class="proposal-head">
- <h2>Lo más hot!</h2>
- <p>Las propuestas más visitadas o las más votadas. Vota y da tu opinión ahora que todavía estás a tiempo.</p>
+ <h2><%= t(:hottest)%></h2>
+ <p><%= t(:hottest_paragraph)%></p>
</header>
<%= render :partial => 'shared/proposal', :collection => @staff_choice %>
</section>
<section id="recently_closed" class="proposals">
<header class="proposal-head">
- <h2>Recién tramitadas</h2>
- <p>Son las propuestas que acaban de ser tramitadas. Mira lo que se decidió en el congreso y lo que decidió la gente a través de la web.</p>
+ <h2><%= t(:recently_closed) %></h2>
+ <p><%= t(:recently_closed_paragraph)%></p>
</header>
<%= render :partial => 'shared/proposal', :collection => @recently_closed %>
</section>
-</section>
-
-
+</section>
11 config/config.yml
View
@@ -0,0 +1,11 @@
+development:
+ org_name: 'Partido de Internet'
+ org_url: 'http://partidodeinternet.es'
+
+test:
+ org_name: 'Partido de Internet'
+ org_url: 'http://partidodeinternet.es'
+
+production:
+ org_name: 'Partido de Internet'
+ org_url: 'http://partidodeinternet.es'
1  config/initializers/0_load_config.rb
View
@@ -0,0 +1 @@
+APP_CONFIG = YAML.load_file("#{Rails.root}/config/config.yml")[Rails.env]
11 config/locales/en.yml
View
@@ -2,4 +2,13 @@
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
en:
- hello: "Hello world"
+ currently_logged: "I am currently logged as"
+ want_to_sign_out: "I want to sign out"
+ what_proposals: "What are the proposals?"
+ who_proposed: "Who proposed?"
+ votes_through_agora: 'votes through AgoraOnRails'
+ hello: 'Hello!'
+ calculate_representatives_vote: 'Calculates the vote of the representatives'
+ representatives_number: 'number of representatives'
+ calculate: 'calculate'
+ proposals: "Proposals"
88 config/locales/es.yml
View
@@ -1,4 +1,92 @@
"es":
+ currently_logged_as: "Estoy logueado como %{username}"
+ what_proposals: "¿De qué se habla?"
+ want_to_sign_out: "quiero salir de la applicación"
+ hello: 'Hola!'
+ intro_paragraph: '¿Qué pasaría si los ciudadanos pudieran participar de manera más directa en las decisiones que se toman en el Congreso de los Diputados? Es el experimento detrás de esta propuesta.'
+ whats_agora_html: 'AgoraOnRails es un simulador de la aplicación web en la los ciudadanos podrán decidir lo que votarán los diputados del %{href} en el Congreso a partir de las Elecciones Generales de 2012.'
+ hot: 'Hot!'
+ recently_closed: "Recién tramitadas"
+ users: "Usuari@s"
+ hottest: 'Lo más hot!'
+ hottest_paragraph: 'Las propuestas más visitadas o las más votadas. Vota y da tu opinión ahora que todavía estás a tiempo.'
+ proposed_by: 'Propuestas presentadas por %{proposer}'
+ on_html: 'el <span class="date">%{date}</span>'
+ in_congress: 'en el Congreso'
+ vote_prompt: 'Vota!'
+ end_voting: 'Finalizar votación'
+ be_first: 'Sé el primero en votar'
+ one_did_it: 'persona ya lo ha hecho'
+ many_did_it: 'personas ya lo han hecho'
+ popular_vote_results: 'Resultados de la votación popular'
+ votes: 'votos'
+ representatives: 'representantes'
+ recently_closed_paragraph: 'Son las propuestas que acaban de ser tramitadas. Mira lo que se decidió en el congreso y lo que decidió la gente a través de la web.'
+ who_proposed: "¿Quién propone?"
+ votes_through_agora: 'votos a través de AgoraOnRails'
+ calculate_representatives_vote: 'Calcula el voto de los representantes'
+ representatives_number: 'numero de representantes'
+ calculate: 'calcular'
+ proposals: "Propuestas"
+ in_favor: ""
+ against: "No"
+ abstention: "Abs"
+ related_with_category: "Propuestas relacionadas con %{category}"
+ proposals_by: "Propuestas presentadas por %{proposer}"
+ closed: "El periodo de votación para esta propuesta finalizó el %{date}"
+ congress_resolution_html: 'La Propuesta fue <span class="official_resolution">%{resolution}</span> en el Congreso.'
+ share_text: "He votado a través del partido del internet la propuesta %{url}"
+ official_link: 'Enlace oficial'
+ votes: 'votos'
+ views: 'visitas'
+ already_voted: 'Ya has votado esta propuesta'
+ vote_proposal: 'Vota esta propuesta'
+ explain: "Explica tu opinión (opcional)"
+ optional_link: "Enlace (opcional)"
+ dnie_auth_required: 'Autenticación con DNIe requerida'
+ identify_with_dnie: 'Identifícate con tu DNIe'
+ try_with_test_id: 'o haz tongo creando una identidad falsa...'
+ fake_name: 'falso nombre'
+ try_here: 'Haz tongo aquí'
+ popular_vote: 'Votación popular'
+ related_with: 'Relacionada con'
+ on: 'el'
+ yes_option: ''
+ no_option: 'No'
+ abstention: 'Abstención'
+ start: 'Inicio'
+ proposal_desc_html: 'Presentado por: %{proposer}'
+ popular_vote: 'Votación popular'
+ hooray: 'Hooray!!'
+ changed_spokesman: 'Has cambiado de portavoz.'
+ chosen_spokesman: 'Has elegido a tu portavoz.'
+ spokeman_redirect: 'Si nadie lo remedia en 5 segundos te llevaremos a la página de tu portavoz.'
+ are_you_sure: '¿Estás seguro?'
+ your_current_spokeman: 'Tu portavoz actual es %{spokeman}.'
+ sure_to_change_spokeman: 'Estás seguro de que quieres cambiarlo por %{spokeman}'
+ i_am_sure: "Estoy seguro"
+ present_users: 'Usuari@s presentes en AgoraOnRails'
+ can_delegate_vote: 'Puedes delegar tu voto en ell@s para las propuestas en las que no votes directamente.'
+ sign_up: 'Regístrate'
+ username: 'Nombre de usuario'
+ password: 'Contraseña'
+ password_confirmation: 'Confirma la contraseña'
+ email: 'Email'
+ users: 'Usuari@s'
+ discharge_spokesman: "Destituir a %{name} de ser mi portavoz"
+ choose_spokeman: "Elegir a %{name} como mi portavoz"
+ review_vote: "Revisa tu voto"
+ going_to_vote_in_favor: 'Vas a votar a favor de'
+ going_to_abstain: 'Vas a abstenerte'
+ going_to_vote_against: 'Vas a votar en contra de'
+ vote_counted: 'Tu voto ha sido contabilizado.'
+ the_proposal: 'la iniciativa “%{title}”'
+ because: 'Porque %{explanation}'
+ more_info: 'Más información %{link}'
+ i_am_sure: 'Estoy seguro'
+ or_well: 'o bueno...'
+ think_more: 'quiero pensármelo mejor'
+
# Action View
number:
# Used in number_with_delimiter()
9 db/migrate/20110321010225_remove_confidential_vote.rb
View
@@ -1,9 +0,0 @@
-class RemoveConfidentialVote < ActiveRecord::Migration
- def self.up
- remove_column :votes, :confidential
- end
-
- def self.down
- add_column :votes, :confidential, :boolean, :default=> false
- end
-end
5 db/schema.rb
View
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20110321010601) do
+ActiveRecord::Schema.define(:version => 20110319234436) do
create_table "categories", :force => true do |t|
t.string "name"
@@ -64,9 +64,9 @@
t.string "link"
t.integer "spokesman_id"
t.integer "represented_users_count"
+ t.boolean "admin", :default => false
t.string "dni"
t.string "name"
- t.boolean "admin", :default => false
end
create_table "votes", :force => true do |t|
@@ -77,7 +77,6 @@
t.string "link"
t.text "explanation"
t.string "value"
- t.boolean "confidential", :default => false
end
end
8 spec/acceptance/admin_can_close_proposals_spec.rb
View
@@ -30,8 +30,12 @@
login_as @admin
proposal = create_proposal(:title => "Ley Sinde")
visit proposal_path(proposal)
- click_button("Finalizar votaci&oacute;n")
- page.should have_content('El periodo de votación para esta propuesta finalizó')
+ click_button I18n.t(:end_voting)
+
+ proposal.reload
+
+ proposal.closed_at.should_not be_nil
+ page.should have_content I18n.t(:closed, :date => I18n.l(proposal.closed_at))
end
scenario "User cannot finish a proposal" do
6 spec/acceptance/dni_authentication_spec.rb
View
@@ -15,7 +15,7 @@
login_as user
- page.should have_content("Estoy logueado como Bad Ass Mother Fucking Real User")
+ page.should have_content I18n.t(:currently_logged_as, :username => "Bad Ass Mother Fucking Real User")
end
scenario "Valid authentication with new user" do
@@ -25,7 +25,7 @@
register_as("Bad Ass Mother Fucking New User", "12345678V")
- page.should have_content("Estoy logueado como Bad Ass Mother Fucking New User")
+ page.should have_content I18n.t(:currently_logged_as, :username => "Bad Ass Mother Fucking New User")
User.find_by_name_and_dni("Bad Ass Mother Fucking New User", "12345678V").should be
end
@@ -48,7 +48,7 @@
fill_in 'name', :with => 'Backdoor Mother Fucker'
click_button 'Haz tongo aquí'
- page.should have_content("Estoy logueado como Backdoor Mother Fucker ")
+ page.should have_content(I18n.t(:currently_logged_as, :username => 'Backdoor Mother Fucker'))
end
end
3  spec/acceptance/navigate_spec.rb
View
@@ -36,7 +36,8 @@
visit homepage
within(:css, "aside") { click_link "Gobierno" }
- page.should have_content("Propuestas presentadas por Gobierno")
+
+ page.should have_content(I18n.t(:proposed_by, :proposer => "Gobierno"))
page.should have_css(".proposal .title", :text => "Ley Sinde")
page.should_not have_css(".proposal .title", :text => "Usar Google en los examenes")
1  spec/acceptance/spokesmen_spec.rb
View
@@ -28,6 +28,7 @@
visit users_path
click_link "Fan de Punset"
+
click_button "Elegir a Fan de Punset como mi portavoz"
page.should have_content("Has elegido a tu portavoz.")
3  spec/acceptance/vote_calculator_spec.rb
View
@@ -18,7 +18,8 @@
visit proposal_path(proposal)
fill_in "representative_count", :with => "10"
- click_button "Calcular"
+
+ click_button I18n.t(:calculate)
page.should have_css(".representative_count_in_favor", :text => "2")
page.should have_css(".representative_count_against", :text => "7")
58 spec/acceptance/vote_for_proposals_spec.rb
View
@@ -16,9 +16,9 @@
scenario "Vote for open proposals" do
login_as @user
- [["No", "a votar en contra de"],
- ["", "a votar a favor de"],
- ["Abstencion", "a abstenerte de votar sobre"]].each do |vote, confirmation|
+ [["no", I18n.t(:going_to_vote_against)],
+ ["si", I18n.t(:going_to_vote_in_favor)],
+ ["abstencion", I18n.t(:going_to_abstain)]].each do |vote, confirmation|
proposal = create_proposal(:title => "Ley Sinde")
@@ -26,13 +26,13 @@
click_button vote
- page.should have_content("Vas #{confirmation} la iniciativa “Ley Sinde”")
- page.should_not have_content("Porque")
- page.should_not have_content("Más información")
+ page.should have_content confirmation
+ page.should_not have_content(I18n.t(:because))
+ page.should_not have_content(I18n.t(:more_info))
- click_button "Estoy seguro"
+ click_button I18n.t(:i_am_sure)
- page.should have_content("Tu voto ha sido contabilizado.")
+ page.should have_content(I18n.t(:vote_counted))
page.should have_css(".share.fb-share iframe")
page.should have_css(".share.twitter-share iframe")
end
@@ -44,13 +44,13 @@
explanation = "we don't want the ignorance in 'A Brave New World'"
visit proposal_path(proposal)
- fill_in "Explica tu opinión (opcional)", :with => explanation
- click_button ""
+ fill_in I18n.t(:explain), :with => explanation
+ click_button I18n.t(:yes_option)
- page.should have_content("Porque #{explanation}")
- page.should_not have_content("Más información")
+ page.should have_content(I18n.t(:because, :explanation => explanation))
+ page.should_not have_content(I18n.t(:more_info))
- click_button "Estoy seguro"
+ click_button I18n.t(:i_am_sure)
@user.votes.last.explanation.should == explanation
end
@@ -61,12 +61,12 @@
link = "http://en.wikipedia.org/wiki/Brave_New_World"
visit proposal_path(proposal)
- fill_in "Enlace", :with => link
- click_button ""
+ fill_in "link", :with => link
+ click_button I18n.t(:yes_option)
page.should have_content("Más información #{link}")
- page.should_not have_content("Porque")
- click_button "Estoy seguro"
+ page.should_not have_content I18n.t(:because)
+ click_button I18n.t(:i_am_sure)
@user.votes.last.link.should == link
end
@@ -75,13 +75,13 @@
proposal = create_proposal(:title => "Derogación del canon")
visit proposal_path(proposal)
- click_button ""
+ click_button I18n.t(:yes_option)
- page.should have_content("Autenticación con DNIe requerida")
- page.should_not have_css("button", :text => "Confirmar")
+ page.should have_content I18n.t(:dnie_auth_required)
+ page.should_not have_css("button", :text => I18n.t(:i_am_sure))
login_as @user
-
+
page.should have_content("Vas a votar a favor de la iniciativa “Derogación del canon”")
end
@@ -108,8 +108,8 @@
login_as @user
visit proposal_path(proposal)
- click_button ""
- click_button "Estoy seguro"
+ click_button I18n.t(:yes_option)
+ click_button I18n.t(:i_am_sure)
visit proposal_path(proposal)
@@ -134,8 +134,8 @@
visit proposal_path(proposal)
- click_button ""
- click_button "Estoy seguro"
+ click_button I18n.t(:yes_option)
+ click_button I18n.t(:i_am_sure)
visit proposal_path(proposal)
@@ -145,8 +145,8 @@
login_as @user2
visit proposal_path(proposal)
- click_button "No"
- click_button "Estoy seguro"
+ click_button I18n.t(:no_option)
+ click_button I18n.t(:i_am_sure)
visit proposal_path(proposal)
percentages_should_be(proposal, :in_favor => 50, :against => 50, :abstention => 0)
@@ -154,8 +154,8 @@
login_as @user3
visit proposal_path(proposal)
- click_button "Abstencion"
- click_button "Estoy seguro"
+ click_button I18n.t(:abstention)
+ click_button I18n.t(:i_am_sure)
visit proposal_path(proposal)
percentages_should_be(proposal, :in_favor => 33, :against => 33, :abstention => 33)
Please sign in to comment.
Something went wrong with that request. Please try again.