Permalink
Browse files

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

  • Loading branch information...
2 parents 27ba41a + 2d42276 commit 96041715c0fb73ac073854c853a825850b19de1e @voodoorai2000 voodoorai2000 committed Oct 22, 2011
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
@@ -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
@@ -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
@@ -1,2 +0,0 @@
-module ProposersHelper
-end
@@ -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)
@@ -1,2 +0,0 @@
-module UserSessionsHelper
-end
@@ -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
View
@@ -79,15 +79,19 @@ 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
self.closer_id = cid
self.save!
count_votes!
end
-
- def reopen
-
- end
end
@@ -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,23 +73,23 @@
</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">
<iframe name="overlay"></iframe>
</div>
</div>
+ <%= render :partial => "shared/google_analytics" if Rails.env == 'production' %>
</body>
</html>
@@ -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>
@@ -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 %>
@@ -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 %>
@@ -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 %>
@@ -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">
Oops, something went wrong.

0 comments on commit 9604171

Please sign in to comment.