fixes conflicts with budgets

This commit is contained in:
rgarcia
2017-01-09 13:33:01 +01:00
36 changed files with 248 additions and 255 deletions

View File

@@ -462,7 +462,7 @@
word-break: break-word; word-break: break-word;
} }
.proposal-show, .investment-project-show { .proposal-show, .investment-project-show, .budget-investment-show {
.supports { .supports {
padding: $line-height/2 0 0; padding: $line-height/2 0 0;
@@ -712,6 +712,7 @@
} }
.remove .icon-check-circle { .remove .icon-check-circle {
color: $budget;
display: block; display: block;
font-size: rem-calc(70); font-size: rem-calc(70);
line-height: rem-calc(70); line-height: rem-calc(70);
@@ -1030,7 +1031,6 @@
.amount-spent { .amount-spent {
background: $success-bg; background: $success-bg;
color: $success-color;
font-weight: normal; font-weight: normal;
padding: $line-height/2; padding: $line-height/2;

View File

@@ -5,14 +5,16 @@ module Budgets
before_action :load_ballot before_action :load_ballot
def show def show
authorize! :show, @ballot
render template: "budgets/ballot/show" render template: "budgets/ballot/show"
end end
private private
def load_ballot def load_ballot
@ballot = Budget::Ballot.where(user: current_user, budget: @budget).first_or_create query = Budget::Ballot.where(user: current_user, budget: @budget)
@ballot = @budget.balloting? ? query.first_or_create : query.first_or_initialize
end end
end end
end end

View File

@@ -18,7 +18,7 @@ module Budgets
feature_flag :budgets feature_flag :budgets
has_orders %w{most_voted newest oldest}, only: :show has_orders %w{most_voted newest oldest}, only: :show
has_orders ->(c){ c.instance_variable_get(:@budget).balloting? ? %w{random price} : %w{random confidence_score} }, only: :index has_orders ->(c) { c.instance_variable_get(:@budget).investments_orders }, only: :index
invisible_captcha only: [:create, :update], honeypot: :subtitle, scope: :budget_investment invisible_captcha only: [:create, :update], honeypot: :subtitle, scope: :budget_investment
@@ -83,7 +83,7 @@ module Budgets
end end
def investment_params def investment_params
params.require(:budget_investment).permit(:title, :description, :external_url, :heading_id, :terms_of_service, :location, :tag_list) params.require(:budget_investment).permit(:title, :description, :external_url, :heading_id, :tag_list, :organization_name, :location, :terms_of_service)
end end
def load_ballot def load_ballot

View File

@@ -66,14 +66,14 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController
def valid_price_params? def valid_price_params?
if /\D/.match params[:budget_investment][:price] if /\D/.match params[:budget_investment][:price]
@investment.errors.add(:price, I18n.t('budget.investments.wrong_price_format')) @investment.errors.add(:price, I18n.t('budgets.investments.wrong_price_format'))
end end
if /\D/.match params[:budget_investment][:price_first_year] if /\D/.match params[:budget_investment][:price_first_year]
@investment.errors.add(:price_first_year, I18n.t('budget.investments.wrong_price_format')) @investment.errors.add(:price_first_year, I18n.t('budgets.investments.wrong_price_format'))
end end
@investment.errors.empty? @investment.errors.empty?
end end
end end

View File

@@ -1,17 +1,13 @@
module BudgetsHelper module BudgetsHelper
def budget_phases_select_options def budget_phases_select_options
Budget::PHASES.map { |ph| [ t("budget.phase.#{ph}"), ph ] } Budget::PHASES.map { |ph| [ t("budgets.phase.#{ph}"), ph ] }
end end
def budget_currency_symbol_select_options def budget_currency_symbol_select_options
Budget::CURRENCY_SYMBOLS.map { |cs| [ cs, cs ] } Budget::CURRENCY_SYMBOLS.map { |cs| [ cs, cs ] }
end end
def heading_name(heading)
heading.present? ? heading.name : t("budget.headings.none")
end
def namespaced_budget_investment_path(investment, options={}) def namespaced_budget_investment_path(investment, options={})
case namespace case namespace
when "management::budgets" when "management::budgets"

View File

@@ -76,7 +76,7 @@ class Budget < ActiveRecord::Base
end end
def translated_phase def translated_phase
I18n.t "budget.phase.#{phase}" I18n.t "budgets.phase.#{phase}"
end end
def formatted_amount(amount) def formatted_amount(amount)
@@ -94,6 +94,17 @@ class Budget < ActiveRecord::Base
formatted_amount(amount_spent(heading)) formatted_amount(amount_spent(heading))
end end
def investments_orders
case phase
when 'accepting', 'reviewing'
%w{random}
when 'balloting', 'reviewing_ballots'
%w{random price}
else
%w{random confidence_score}
end
end
private private
def sanitize_descriptions def sanitize_descriptions

View File

@@ -25,7 +25,7 @@
<%= budget.name %> <%= budget.name %>
</td> </td>
<td class="small"> <td class="small">
<%= t("budget.phase.#{budget.phase}") %> <%= t("budgets.phase.#{budget.phase}") %>
</td> </td>
<td class="small"> <td class="small">
<%= link_to t("admin.budgets.index.budget_investments"), admin_budget_budget_investments_path(budget_id: budget.id) %> <%= link_to t("admin.budgets.index.budget_investments"), admin_budget_budget_investments_path(budget_id: budget.id) %>

View File

@@ -1,22 +1,24 @@
<div class="row ballot"> <div class="expanded budget no-margin-top padding">
<div class="row">
<%= render 'shared/back_link' %>
<%= render 'shared/back_link' %> <h1 class="text-center"><%= t("budgets.ballots.show.title") %></h1>
<h1 class="text-center"><%= t("budgets.ballots.show.title") %></h1> <div class="small-12 medium-8 column small-centered text-center">
<h2>
<div class="small-12 medium-8 column small-centered text-center"> <%= t("budgets.ballots.show.voted_html",
<h2> count: @ballot.investments.count) %>
<%= t("budgets.ballots.show.voted_html", </h2>
count: @ballot.investments.count) %> <p>
</h2> <small>
<p> <%= t("budgets.ballots.show.voted_info_html") %>
<small> </small>
<%= t("budgets.ballots.show.voted_info_html") %> </p>
</small> </div>
</p>
</div> </div>
<hr> </div>
<div class="row ballot">
<div class="margin-top"> <div class="margin-top">
<% @ballot.groups.each do |group| %> <% @ballot.groups.each do |group| %>
<div id="<%= dom_id(group) %>" <div id="<%= dom_id(group) %>"
@@ -34,9 +36,6 @@
<% else %> <% else %>
<p> <p>
<%= t("budgets.ballots.show.zero") %><br> <%= t("budgets.ballots.show.zero") %><br>
<%= link_to t("budgets.ballots.show.heading_link"),
budget_investments_path(budget, heading_id: heading.id),
data: { no_turbolink: true } %>
</p> </p>
<% end %> <% end %>

View File

@@ -9,7 +9,8 @@
class: "remove-investment-project", class: "remove-investment-project",
method: :delete, method: :delete,
remote: true do %> remote: true do %>
<span class="icon-x delete"></span> <span class="sr-only"><%= t('budgets.ballots.show.remove') %></span>
<span class="icon-x delete"></span>
<% end %> <% end %>
<% end %> <% end %>
</li> </li>

View File

@@ -3,7 +3,8 @@
</span> </span>
<div class="progress" role="progressbar" tabindex="0" <div class="progress" role="progressbar" tabindex="0"
aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"> id="progress"
aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
<div class="progress-meter" <div class="progress-meter"
style="width: style="width:
<%= progress_bar_width(@budget.heading_price(@heading), <%= progress_bar_width(@budget.heading_price(@heading),
@@ -20,7 +21,7 @@
<p id="amount-spent" class="progress-meter-text spent-amount-text"> <p id="amount-spent" class="progress-meter-text spent-amount-text">
<%= @ballot.formatted_amount_spent(@heading) %> <%= @ballot.formatted_amount_spent(@heading) %>
<span id="amount-available" class="amount-available"> <span id="amount-available" class="amount-available">
<%= t("budget.progress_bar.available") %> <%= t("budgets.progress_bar.available") %>
<span><%= @ballot.formatted_amount_available(@heading) %></span> <span><%= @ballot.formatted_amount_available(@heading) %></span>
</span> </span>
</p> </p>

View File

@@ -1,7 +1,7 @@
<div class="expanded budget no-margin-top padding"> <div class="expanded budget no-margin-top padding">
<div class="row"> <div class="row">
<div class="small-12 column"> <div class="small-12 column">
<h1><%= t('budget.index.title') %></h1> <h1><%= t('budgets.index.title') %></h1>
</div> </div>
</div> </div>
</div> </div>
@@ -10,8 +10,8 @@
<div class="small-12 medium-9 column"> <div class="small-12 medium-9 column">
<table> <table>
<thead> <thead>
<th><%= t('budget.index.name') %></th> <th><%= Budget.human_attribute_name(:name) %></th>
<th><%= t('budget.index.phase') %></th> <th><%= Budget.human_attribute_name(:phase) %></th>
</thead> </thead>
<tbody> <tbody>
<% @budgets.each do |budget| %> <% @budgets.each do |budget| %>

View File

@@ -3,8 +3,8 @@
<% if ballot.has_investment?(investment) %> <% if ballot.has_investment?(investment) %>
<div class="remove supported inline-block"> <div class="remove supported inline-block">
<span class="icon-check-circle bounceIn animated" <span class="icon-check-circle"
title="<%= t("budget.investments.investment.already_added") %>"> title="<%= t("budgets.investments.investment.already_added") %>">
</span> </span>
<p class="investment-project-amount"> <p class="investment-project-amount">
<%= investment.formatted_price %> <%= investment.formatted_price %>
@@ -27,12 +27,12 @@
<%= investment.formatted_price %> <%= investment.formatted_price %>
</p> </p>
<% if investment.should_show_ballots? %> <% if investment.should_show_ballots? %>
<%= link_to t("budget.investments.investment.add"), <%= link_to t("budgets.investments.investment.add"),
budget_ballot_lines_url(investment_id: investment.id, budget_ballot_lines_url(investment_id: investment.id,
budget_id: investment.budget_id, budget_id: investment.budget_id,
investments_ids: investment_ids), investments_ids: investment_ids),
class: "button button-support small expanded", class: "button button-support small expanded",
title: t('budget.investments.investment.support_title'), title: t('budgets.investments.investment.support_title'),
method: :post, method: :post,
remote: true %> remote: true %>
<% end %> <% end %>
@@ -42,7 +42,7 @@
<% if reason.present? && !ballot.has_investment?(investment) %> <% if reason.present? && !ballot.has_investment?(investment) %>
<div class="js-participation-not-allowed" style='display:none'> <div class="js-participation-not-allowed participation-not-allowed" style='display:none'>
<p> <p>
<%= t("budgets.ballots.reasons_for_not_balloting.#{reason}", <%= t("budgets.ballots.reasons_for_not_balloting.#{reason}",
verify_account: link_to(t("votes.verify_account"), verification_path), verify_account: link_to(t("votes.verify_account"), verification_path),

View File

@@ -3,8 +3,7 @@
<div class="row"> <div class="row">
<div class="small-12 medium-8 column"> <div class="small-12 medium-8 column">
<%= f.label :heading_id, t("budget.investments.form.heading") %> <%= f.select :heading_id, budget_heading_select_options(@budget), {include_blank: true, } %>
<%= f.select :heading_id, budget_heading_select_options(@budget), {include_blank: true, label: false} %>
</div> </div>
<div class="small-12 column"> <div class="small-12 column">
@@ -25,6 +24,10 @@
<%= f.text_field :location %> <%= f.text_field :location %>
</div> </div>
<div class="small-12 column">
<%= f.text_field :organization_name %>
</div>
<div class="small-12 column"> <div class="small-12 column">
<%= f.label :tag_list, t("budget.investments.form.tags_label") %> <%= f.label :tag_list, t("budget.investments.form.tags_label") %>
<p class="note"><%= t("budget.investments.form.tags_instructions") %></p> <p class="note"><%= t("budget.investments.form.tags_instructions") %></p>
@@ -60,7 +63,7 @@
<% end %> <% end %>
<div class="actions small-12 medium-6 large-4 end column"> <div class="actions small-12 medium-6 large-4 end column">
<%= f.submit(class: "button expanded", value: t("budget.investments.form.submit_buttons.#{action_name}")) %> <%= f.submit(nil, class: "button expanded") %>
</div> </div>
</div> </div>
<% end %> <% end %>

View File

@@ -10,7 +10,7 @@
<% end %> <% end %>
<% if can? :show, @ballot %> <% if can? :show, @ballot %>
<%= link_to t("budget.investments.header.check_ballot"), <%= link_to t("budgets.investments.header.check_ballot"),
budget_ballot_path(@budget), budget_ballot_path(@budget),
class: "button float-right" %> class: "button float-right" %>
<% end %> <% end %>
@@ -20,13 +20,12 @@
<div class="row progress-votes"> <div class="row progress-votes">
<div class="small-12 column"> <div class="small-12 column">
<div class="progress-bar-nav" data-fixed-bar> <div class="progress-bar-nav" data-fixed-bar>
<h1 class="inline-block"><%= @heading.name %></h1> <h1 class="inline-block margin-top"><%= @heading.name %></h1>
<div id="check-ballot" style="display: none;"> <% if can? :show, @ballot %>
<% if can? :show, @ballot %> <div id="check-ballot" style="display: none;">
<%= link_to t("budget.investments.header.check_ballot"), <%= link_to t("budgets.investments.header.check_ballot"),
budget_ballot_path(@budget) %> budget_ballot_path(@budget) %>
<% end %> </div>
</div>
<% if @ballot.valid_heading?(@heading) %> <% if @ballot.valid_heading?(@heading) %>
<div id="progress_bar" class="no-margin-top"> <div id="progress_bar" class="no-margin-top">
<%= render 'budgets/ballot/progress_bar' %> <%= render 'budgets/ballot/progress_bar' %>
@@ -34,13 +33,16 @@
<% else %> <% else %>
<br> <br>
<p class="callout warning inline-block"> <p class="callout warning inline-block">
<%= t("budget.investments.header.different_heading_assigned_html", <%= t("budgets.investments.header.different_heading_assigned_html",
heading_link: link_to( heading_link: link_to(
@assigned_heading.name, @assigned_heading.name,
budget_investments_path(@budget, heading: @assigned_heading)) budget_investments_path(@budget, heading: @assigned_heading))
) %> ) %>
</p> </p>
<% end %> <% end %>
<% else %>
<h2><%= @budget.formatted_heading_price(@heading) %></h2>
<% end %>
</div> </div>
</div> </div>
</div> </div>
@@ -55,7 +57,7 @@
<%= t("shared.back") %> <%= t("shared.back") %>
<% end %> <% end %>
<h1><%= t('budget.investments.index.title') %></h1> <h1><%= t('budgets.investments.index.title') %></h1>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -6,7 +6,7 @@
<div class="budget-investment-content"> <div class="budget-investment-content">
<% cache [locale_and_user_status(investment), 'index', investment, investment.author] do %> <% cache [locale_and_user_status(investment), 'index', investment, investment.author] do %>
<span class="label-budget-investment float-left"><%= t("budget.investments.investment.title") %></span> <span class="label-budget-investment float-left"><%= t("budgets.investments.investment.title") %></span>
<span class="icon-budget"></span> <span class="icon-budget"></span>
<h3><%= link_to investment.title, namespaced_budget_investment_path(investment) %></h3> <h3><%= link_to investment.title, namespaced_budget_investment_path(investment) %></h3>
<p class="investment-project-info"> <p class="investment-project-info">
@@ -16,7 +16,7 @@
<% if investment.author.hidden? || investment.author.erased? %> <% if investment.author.hidden? || investment.author.erased? %>
<span class="bullet">&nbsp;&bull;&nbsp;</span> <span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="author"> <span class="author">
<%= t("budget.investments.show.author_deleted") %> <%= t("budgets.investments.show.author_deleted") %>
</span> </span>
<% else %> <% else %>
<span class="bullet">&nbsp;&bull;&nbsp;</span> <span class="bullet">&nbsp;&bull;&nbsp;</span>
@@ -32,10 +32,10 @@
<% end %> <% end %>
<span class="bullet">&nbsp;&bull;&nbsp;</span> <span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= heading_name(investment.heading) %> <%= investment.heading.name %>
</p> </p>
<div class="investment-project-description"> <div class="investment-project-description">
<p><%= link_to investment.description, namespaced_budget_investment_path(investment) %></p> <p><%= investment.description %></p>
<div class="truncate"></div> <div class="truncate"></div>
</div> </div>
<%= render "shared/tags", taggable: investment, limit: 5 %> <%= render "shared/tags", taggable: investment, limit: 5 %>

View File

@@ -1,11 +1,5 @@
<section class="budget-investment-show" id="<%= dom_id(investment) %>"> <section class="budget-investment-show" id="<%= dom_id(investment) %>">
<ul class="breadcrumbs">
<li><%= link_to investment.budget.name, budget_path(investment.budget) %></a></li>
<li><%= investment.group.name %></a></li>
<li><%= investment.heading.name %></a></li>
</ul>
<div class="row"> <div class="row">
<div class="small-12 medium-9 column"> <div class="small-12 medium-9 column">
<%= link_to :back, class: "back" do %> <%= link_to :back, class: "back" do %>
@@ -21,17 +15,23 @@
<span class="bullet">&nbsp;&bull;&nbsp;</span> <span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= l investment.created_at.to_date %> <%= l investment.created_at.to_date %>
<span class="bullet">&nbsp;&bull;&nbsp;</span> <span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= heading_name(investment.heading) %> <%= investment.heading.name %>
</div> </div>
<br> <br>
<p id="investment_code"> <p id="investment_code">
<%= t("budget.investments.show.code_html", code: investment.id) %> <%= t("budgets.investments.show.code_html", code: investment.id) %>
</p> </p>
<% if investment.location.present? %> <% if investment.location.present? %>
<p id="investment_code"> <p>
<%= t("budget.investments.show.location_html", location: investment.location) %> <%= t("budgets.investments.show.location_html", location: investment.location) %>
</p>
<% end %>
<% if investment.organization_name.present? %>
<p>
<%= t("budgets.investments.show.organization_name_html", name: investment.organization_name) %>
</p> </p>
<% end %> <% end %>
@@ -46,12 +46,12 @@
<% end %> <% end %>
<% if investment.unfeasible? && investment.unfeasibility_explanation.present? %> <% if investment.unfeasible? && investment.unfeasibility_explanation.present? %>
<h2><%= t('budget.investments.show.unfeasibility_explanation') %></h2> <h2><%= t('budgets.investments.show.unfeasibility_explanation') %></h2>
<p><%= investment.unfeasibility_explanation %></p> <p><%= investment.unfeasibility_explanation %></p>
<% end %> <% end %>
<% if investment.feasible? && investment.price_explanation.present? %> <% if investment.feasible? && investment.price_explanation.present? %>
<h2><%= t('budget.investments.show.price_explanation') %></h2> <h2><%= t('budgets.investments.show.price_explanation') %></h2>
<p><%= investment.price_explanation %></p> <p><%= investment.price_explanation %></p>
<% end %> <% end %>
</div> </div>
@@ -59,7 +59,7 @@
<% if investment.should_show_aside? %> <% if investment.should_show_aside? %>
<aside class="small-12 medium-3 column"> <aside class="small-12 medium-3 column">
<div class="sidebar-divider"></div> <div class="sidebar-divider"></div>
<h3><%= t("votes.supports") %></h3> <h2><%= t("votes.supports") %></h2>
<div class="text-center"> <div class="text-center">
<% if investment.should_show_votes? %> <% if investment.should_show_votes? %>
@@ -82,7 +82,7 @@
</div> </div>
<div class="sidebar-divider"></div> <div class="sidebar-divider"></div>
<h3><%= t("budget.investments.show.share") %></h3> <h2><%= t("budgets.investments.show.share") %></h2>
<div class="social-share-full"> <div class="social-share-full">
<%= social_share_button_tag("#{investment.title} #{setting['twitter_hashtag']}") %> <%= social_share_button_tag("#{investment.title} #{setting['twitter_hashtag']}") %>
<% if browser.device.mobile? %> <% if browser.device.mobile? %>
@@ -96,5 +96,3 @@
</div> </div>
</section> </section>

View File

@@ -1,41 +1,45 @@
<div class="clear"></div> <div class="clear"></div>
<% if @budget.accepting? %> <% if can?(:create, Budget::Investment.new(budget: @budget)) %>
<% if current_user && current_user.level_two_or_three_verified? %> <% if current_user && current_user.level_two_or_three_verified? %>
<%= link_to t("budget.investments.index.sidebar.create"), new_budget_investment_path, class: "button budget expanded" %> <%= link_to t("budgets.investments.index.sidebar.create"), new_budget_investment_path, class: "button budget expanded" %>
<% else %> <% else %>
<div class="callout warning"> <div class="callout warning">
<%= t("budget.investments.index.sidebar.verified_only", <%= t("budgets.investments.index.sidebar.verified_only",
verify: link_to(t("budget.investments.index.sidebar.verify_account"), verification_path)).html_safe %> verify: link_to(t("budgets.investments.index.sidebar.verify_account"), verification_path)).html_safe %>
</div> </div>
<% end %> <% end %>
<%= render "shared/tag_cloud", taggable: 'budget/investment' %> <%= render "shared/tag_cloud", taggable: 'budget/investment' %>
<%= render 'categories' %> <%= render 'categories' %>
<% end %> <% end %>
<div class="sidebar-divider"></div>
<h2 class="sidebar-title"><%= t("budget.investments.index.sidebar.my_ballot") %></h2>
<% if @heading && @ballot.investments.by_heading(@heading.id).count > 0 %> <% if @heading && can?(:show, @ballot) %>
<p>
<em>
<%= t("budget.investments.index.sidebar.voted_html",
count: @ballot.investments.by_heading(@heading.id).count,
amount_spent: @ballot.formatted_amount_spent(@heading)) %>
</em>
</p>
<% else %>
<p><strong><%= t("budget.investments.index.sidebar.zero") %></strong></p>
<% end %>
<ul class="ballot-list"> <div class="sidebar-divider"></div>
<% if @heading %>
<% @ballot.investments.by_heading(@heading.id).each do |investment| %> <h2 class="sidebar-title"><%= t("budgets.investments.index.sidebar.my_ballot") %></h2>
<%= render 'budgets/ballot/investment_for_sidebar', <% if @ballot.investments.by_heading(@heading.id).count > 0 %>
investment: investment, <p>
investment_ids: @investment_ids %> <em>
<% end %> <%= t("budgets.investments.index.sidebar.voted_html",
count: @ballot.investments.by_heading(@heading.id).count,
amount_spent: @ballot.formatted_amount_spent(@heading)) %>
</em>
</p>
<% else %>
<p><strong><%= t("budgets.investments.index.sidebar.zero") %></strong></p>
<% end %> <% end %>
</ul>
<p class="callout primary"><%= t("budget.investments.index.sidebar.voted_info") %></p> <ul class="ballot-list">
<% if @heading %>
<% @ballot.investments.by_heading(@heading.id).each do |investment| %>
<%= render 'budgets/ballot/investment_for_sidebar',
investment: investment,
investment_ids: @investment_ids %>
<% end %>
<% end %>
</ul>
<p class="callout primary"><%= t("budgets.investments.index.sidebar.voted_info") %></p>
<% end %>

View File

@@ -5,29 +5,29 @@
<div class="supports js-participation"> <div class="supports js-participation">
<span class="total-supports <%= 'no-button' unless voting_allowed || user_voted_for %>"> <span class="total-supports <%= 'no-button' unless voting_allowed || user_voted_for %>">
<%= t("budget.investments.investment.supports", count: investment.total_votes) %> <%= t("budgets.investments.investment.supports", count: investment.total_votes) %>
</span> </span>
<div class="in-favor js-in-favor"> <div class="in-favor js-in-favor">
<% if user_voted_for %> <% if user_voted_for %>
<div class="supported"> <div class="supported callout success">
<%= t("budget.investments.investment.already_supported") %> <%= t("budgets.investments.investment.already_supported") %>
</div> </div>
<% elsif investment.should_show_votes? %> <% elsif investment.should_show_votes? %>
<%= link_to vote_url, <%= link_to vote_url,
class: "button button-support small expanded", class: "button button-support small expanded",
title: t('budget.investments.investment.support_title'), title: t('budgets.investments.investment.support_title'),
method: "post", method: "post",
remote: true, remote: true,
"aria-hidden" => css_for_aria_hidden(reason) do %> "aria-hidden" => css_for_aria_hidden(reason) do %>
<%= t("budget.investments.investment.give_support") %> <%= t("budgets.investments.investment.give_support") %>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
<% if reason.present? && !user_voted_for %> <% if reason.present? && !user_voted_for %>
<div class="js-participation-not-allowed" style='display:none' aria-hidden="false"> <div class="js-participation-not-allowed participation-not-allowed" style='display:none' aria-hidden="false">
<p> <p>
<%= t("votes.budget_investments.#{reason}", <%= t("votes.budget_investments.#{reason}",
verify_account: link_to(t("votes.verify_account"), verification_path), verify_account: link_to(t("votes.verify_account"), verification_path),

View File

@@ -1,8 +1,8 @@
<% provide :title do %><%= t('budget.investments.index.title') %><% end %> <% provide :title do %><%= t('budgets.investments.index.title') %><% end %>
<% content_for :header_addon do %> <% content_for :header_addon do %>
<%= render "shared/search_form", <%= render "shared/search_form",
search_path: budget_investments_path(budget_id: @budget.id, page: 1), search_path: budget_investments_path(budget_id: @budget.id, page: 1),
i18n_namespace: "budget.investments.index.search_form" %> i18n_namespace: "budgets.investments.index.search_form" %>
<% end %> <% end %>
<main id="budget-investments-main"> <main id="budget-investments-main">
@@ -17,23 +17,23 @@
<div class="small-12 search-results margin-bottom"> <div class="small-12 search-results margin-bottom">
<% if params[:unfeasible].present? %> <% if params[:unfeasible].present? %>
<h2><%= t("budget.investments.index.unfeasible") %></h2> <h2><%= t("budgets.investments.index.unfeasible") %></h2>
<p> <p>
<%= t("budget.investments.index.unfeasible_text", <%= t("budgets.investments.index.unfeasible_text",
definitions: link_to(t("budget.investments.index.unfeasible_text_definitions"), "https://decide.madrid.es/participatory_budget_info#20")).html_safe %> definitions: link_to(t("budgets.investments.index.unfeasible_text_definitions"), "https://decide.madrid.es/participatory_budget_info#20")).html_safe %>
</p> </p>
<% end %> <% end %>
<%= content_tag(:h2, t("budget.investments.index.by_heading", heading: @heading.name)) if @heading.present? %> <%= content_tag(:h2, t("budgets.investments.index.by_heading", heading: @heading.name)) if @heading.present? %>
<% if params[:search].present? %> <% if params[:search].present? %>
<h2> <h2>
<%= page_entries_info @investments %> <%= page_entries_info @investments %>
<%= t("budget.investments.index.search_results", count: @investments.size, search_term: params[:search]) %> <%= t("budgets.investments.index.search_results", count: @investments.size, search_term: params[:search]) %>
</h2> </h2>
<% end %> <% end %>
</div> </div>
<%= render('shared/order_links', i18n_namespace: "budget.investments.index") unless params[:unfeasible].present? %> <%= render('shared/order_links', i18n_namespace: "budgets.investments.index") unless params[:unfeasible].present? %>
<% @investments.each do |investment| %> <% @investments.each do |investment| %>
<%= render partial: '/budgets/investments/investment', locals: { <%= render partial: '/budgets/investments/investment', locals: {

View File

@@ -12,26 +12,26 @@
</div> </div>
<div class="small-12 medium-3 column info padding" data-equalizer-watch> <div class="small-12 medium-3 column info padding" data-equalizer-watch>
<p> <p>
<strong><%= t('budget.show.phase') %></strong> <strong><%= t('budgets.show.phase') %></strong>
<br> <br>
<%= t("budgets.phases.#{@budget.phase}") %> <%= t("budgets.phase.#{@budget.phase}") %>
</p> </p>
<% if @budget.accepting? %> <% if can?(:create, Budget::Investment.new(budget: @budget))%>
<% if current_user %> <% if current_user %>
<% if current_user.level_two_or_three_verified? %> <% if current_user.level_two_or_three_verified? %>
<%= link_to t("budget.investments.index.sidebar.create"), new_budget_investment_path(@budget), class: "button margin-top expanded" %> <%= link_to t("budgets.investments.index.sidebar.create"), new_budget_investment_path(@budget), class: "button margin-top expanded" %>
<% else %> <% else %>
<div class="callout warning margin-top"> <div class="callout warning margin-top">
<%= t("budget.investments.index.sidebar.verified_only", <%= t("budgets.investments.index.sidebar.verified_only",
verify: link_to(t("budget.investments.index.sidebar.verify_account"), verification_path)).html_safe %> verify: link_to(t("budgets.investments.index.sidebar.verify_account"), verification_path)).html_safe %>
</div> </div>
<% end %> <% end %>
<% else %> <% else %>
<div class="callout primary margin-top"> <div class="callout primary margin-top">
<%= t("budget.investments.index.sidebar.not_logged_in", <%= t("budgets.investments.index.sidebar.not_logged_in",
sign_in: link_to(t("budget.investments.index.sidebar.sign_in"), new_user_session_path), sign_in: link_to(t("budgets.investments.index.sidebar.sign_in"), new_user_session_path),
sign_up: link_to(t("budget.investments.index.sidebar.sign_up"), new_user_registration_path)).html_safe %> sign_up: link_to(t("budgets.investments.index.sidebar.sign_up"), new_user_registration_path)).html_safe %>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
@@ -43,7 +43,7 @@
<div class="small-12 medium-9 column"> <div class="small-12 medium-9 column">
<table class="table-fixed"> <table class="table-fixed">
<thead> <thead>
<th><%= t('budget.show.group') %></th> <th><%= t('budgets.show.group') %></th>
</thead> </thead>
<tbody> <tbody>
<% @budget.groups.each do |group| %> <% @budget.groups.each do |group| %>

View File

@@ -3,7 +3,7 @@
<%= form_tag search_path, method: :get do %> <%= form_tag search_path, method: :get do %>
<div class="input-group"> <div class="input-group">
<label for="search_text" class="sr-only"><%= t("#{i18n_namespace}.title") %></label> <label for="search_text" class="sr-only"><%= t("#{i18n_namespace}.title") %></label>
<input type="text" name="search" placeholder="<%= t("#{i18n_namespace}.placeholder") %>" class="input-group-field" value="<%= params[:search] %>" id="search_text"> <input type="text" name="search" placeholder='<%= t("#{i18n_namespace}.placeholder") %>' class="input-group-field" value="<%= params[:search] %>" id="search_text">
<div class="input-group-button"> <div class="input-group-button">
<button type="submit" class="button" title="<%= t("#{i18n_namespace}.button") %>"> <button type="submit" class="button" title="<%= t("#{i18n_namespace}.button") %>">
<span class="sr-only"><%= t("#{i18n_namespace}.button") %></span> <span class="sr-only"><%= t("#{i18n_namespace}.button") %></span>

View File

@@ -18,7 +18,7 @@
<%= budget.name %> <%= budget.name %>
</td> </td>
<td> <td>
<%= t("budget.phase.#{budget.phase}") %> <%= t("budgets.phase.#{budget.phase}") %>
</td> </td>
<td> <td>
<%= @investments_with_valuation_open[budget.id] %> <%= @investments_with_valuation_open[budget.id] %>

View File

@@ -32,6 +32,7 @@ data:
- config/locales/devise_views.%{locale}.yml - config/locales/devise_views.%{locale}.yml
- config/locales/responders.%{locale}.yml - config/locales/responders.%{locale}.yml
- config/locales/kaminari.%{locale}.yml - config/locales/kaminari.%{locale}.yml
- config/locales/budgets.%{locale}.yml
# Locale files to write new keys to, based on a list of key pattern => file rules. Matched from top to bottom: # Locale files to write new keys to, based on a list of key pattern => file rules. Matched from top to bottom:
# `i18n-tasks normalize -p` will force move the keys according to these rules # `i18n-tasks normalize -p` will force move the keys according to these rules
@@ -94,8 +95,6 @@ search:
# - 'errors.messages.{accepted,blank,invalid,too_short,too_long}' # - 'errors.messages.{accepted,blank,invalid,too_short,too_long}'
# - '{devise,simple_form}.*' # - '{devise,simple_form}.*'
ignore_missing: ignore_missing:
- 'budget.*'
- 'budgets.*'
- 'unauthorized.*' - 'unauthorized.*'
- 'activerecord.models.proposal' - 'activerecord.models.proposal'
- 'activerecord.models.spending_proposal' - 'activerecord.models.spending_proposal'
@@ -109,8 +108,8 @@ ignore_missing:
## Consider these keys used: ## Consider these keys used:
ignore_unused: ignore_unused:
- 'budget.*' - 'budgets.phase.*'
- 'budgets.*' - 'budgets.investments.index.orders.*'
- 'activerecord.*' - 'activerecord.*'
- 'activemodel.*' - 'activemodel.*'
- 'unauthorized.*' - 'unauthorized.*'
@@ -140,11 +139,10 @@ ignore_unused:
- 'users.show.filters.*' - 'users.show.filters.*'
- 'debates.index.select_order' - 'debates.index.select_order'
- 'debates.index.orders.*' - 'debates.index.orders.*'
- 'debates.index.search_form.*'
- 'proposals.index.select_order' - 'proposals.index.select_order'
- 'proposals.index.orders.*' - 'proposals.index.orders.*'
- 'proposals.index.search_form.*'
- 'spending_proposals.index.search_form.*' - 'spending_proposals.index.search_form.*'
- '*.index.search_form.*'
- 'notifications.index.comments_on*' - 'notifications.index.comments_on*'
- 'notifications.index.replies_to*' - 'notifications.index.replies_to*'
- 'notifications.index.proposal_notification*' - 'notifications.index.proposal_notification*'

View File

@@ -63,6 +63,8 @@ en:
external_url: "Link to additional documentation" external_url: "Link to additional documentation"
heading_id: "Heading" heading_id: "Heading"
title: "Title" title: "Title"
location: "Location"
organization_name: "If you are proposing in the name of a collective/organization, write its name"
comment: comment:
body: "Comment" body: "Comment"
user: "User" user: "User"

View File

@@ -58,6 +58,8 @@ es:
external_url: "Enlace a documentación adicional" external_url: "Enlace a documentación adicional"
heading_id: "Partida presupuestaria" heading_id: "Partida presupuestaria"
title: "Título" title: "Título"
location: "Ubicación"
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, escribe su nombre"
comment: comment:
body: "Comentario" body: "Comentario"
user: "Usuario" user: "Usuario"

View File

@@ -16,30 +16,21 @@ en:
not_verified: Only verified users can vote on proposals; %{verify_account}. not_verified: Only verified users can vote on proposals; %{verify_account}.
organization: Organizations are not permitted to vote organization: Organizations are not permitted to vote
not_selected: Unselected investment projects can not be supported not_selected: Unselected investment projects can not be supported
not_enough_money: "Price is higher than the available amount left" not_enough_money: "Price is higher than the available amount left."
no_ballots_allowed: Selecting phase is closed no_ballots_allowed: Selecting phase is closed
different_heading_assigned: You have already voted a different heading different_heading_assigned: You have already voted a different heading
groups: groups:
show: show:
title: Select a heading title: Select a heading
budget:
phase: phase:
accepting: Accepting proposals accepting: Accepting proposals
reviewing: Reviewing proposals reviewing: Reviewing proposals
selecting: Selecting selecting: Selecting proposals
valuating: Valuating valuating: Valuating proposals
balloting: Balloting balloting: Balloting proposals
reviewing_ballots: Reviewing Ballots reviewing_ballots: Reviewing Ballots
finished: Finished finished: Finished budget
groups:
index:
group_title: "Groups"
headings:
none: Whole City
all: All scopes
index: index:
name: Budget name
phase: Phase
title: Participatory budgets title: Participatory budgets
investments: investments:
form: form:
@@ -58,7 +49,6 @@ en:
new: Create new: Create
title: Investment title title: Investment title
index: index:
available: "Available:"
title: Participatory budgeting title: Participatory budgeting
unfeasible: Unfeasible investment projects unfeasible: Unfeasible investment projects
unfeasible_text: "The proposals must meet a number of criteria (legality, concreteness, be the responsibility of the city, not exceed the limit of the budget; %{definitions}) to be declared viable and reach the stage of final vote. All proposals don't meet these criteria are marked as unfeasible and published in the following list, along with its report of infeasibility." unfeasible_text: "The proposals must meet a number of criteria (legality, concreteness, be the responsibility of the city, not exceed the limit of the budget; %{definitions}) to be declared viable and reach the stage of final vote. All proposals don't meet these criteria are marked as unfeasible and published in the following list, along with its report of infeasibility."
@@ -66,25 +56,17 @@ en:
by_heading: "Investment projects with scope: %{heading}" by_heading: "Investment projects with scope: %{heading}"
search_form: search_form:
button: Search button: Search
placeholder: Investment projects... placeholder: Search investment projects...
title: Search title: Search
search_results: search_results:
one: " containing the term '%{search_term}'" one: " containing the term '%{search_term}'"
other: " containing the term '%{search_term}'" other: " containing the term '%{search_term}'"
sidebar: sidebar:
back: Back to select page
district: District
my_ballot: My ballot my_ballot: My ballot
remember_city: You can also vote %{city} investment projects.
remember_city_link_html: <strong>city-wide</strong>
remember_district: You can also vote investment projects for %{district}.
remember_district_link_html: <strong>a district</strong>
voted_html: voted_html:
one: "<strong>You voted one proposal with a cost of %{amount_spent}</strong>" one: "<strong>You voted one proposal with a cost of %{amount_spent}</strong>"
other: "<strong>You voted %{count} proposals with a cost of %{amount_spent}</strong>" other: "<strong>You voted %{count} proposals with a cost of %{amount_spent}</strong>"
voted_info: You can change your vote at any time until the close of this phase. No need to spend all the money available. voted_info: You can change your vote at any time until the close of this phase. No need to spend all the money available.
votes: Supports remaining
votes_district: "You can only vote in the district %{district}"
zero: You have not voted any investment project. zero: You have not voted any investment project.
verified_only: "To create a new budget investment %{verify}." verified_only: "To create a new budget investment %{verify}."
verify_account: "verify your account" verify_account: "verify your account"
@@ -96,22 +78,13 @@ en:
random: random random: random
confidence_score: highest rated confidence_score: highest rated
price: by price price: by price
new:
back_link: Back
more_info: "Important, not to be ruled out your proposal must comply:"
recommendation_one: See the %{requirements}.
recommendation_one_link: requirements to be met by a proposal
recommendation_three: Try to go into details when describing your spending proposal so the reviewing team undertands your points.
recommendation_two: Each proposal must be submitted separately. You can make as many want.
recommendations_title: How to create a spending proposal
start_new: Create spending proposal
show: show:
author_deleted: User deleted author_deleted: User deleted
price_explanation: Price explanation price_explanation: Price explanation
unfeasibility_explanation: Unfeasibility explanation unfeasibility_explanation: Unfeasibility explanation
code_html: 'Investment project code: <strong>%{code}</strong>' code_html: 'Investment project code: <strong>%{code}</strong>'
location_html: 'Location: <strong>%{location}</strong>' location_html: 'Location: <strong>%{location}</strong>'
location: Location organization_name_html: 'Organization: <strong>%{name}</strong>'
share: Share share: Share
wrong_price_format: Only integer numbers wrong_price_format: Only integer numbers
investment: investment:
@@ -119,7 +92,6 @@ en:
add: Add add: Add
already_added: You have already added this investment project already_added: You have already added this investment project
already_supported: You have already supported this. Share it! already_supported: You have already supported this. Share it!
forum: District discussion space
support_title: Support this project support_title: Support this project
supports: supports:
one: 1 support one: 1 support
@@ -129,9 +101,8 @@ en:
header: header:
check_ballot: Check my ballot check_ballot: Check my ballot
different_heading_assigned_html: "You have active votes in another heading: %{heading_link}" different_heading_assigned_html: "You have active votes in another heading: %{heading_link}"
progress_bar:
available: "Available: "
show: show:
group: Group group: Group
heading: Heading
price: Price
no_heading: No Heading
phase: Actual phase phase: Actual phase

View File

@@ -11,35 +11,26 @@ es:
other: "Has votado <span>%{count}</span> propuestas." other: "Has votado <span>%{count}</span> propuestas."
voted_info_html: "Puedes cambiar tus votos en cualquier momento hasta el cierre de esta fase.<br> No hace falta que inviertas todo el dinero disponible." voted_info_html: "Puedes cambiar tus votos en cualquier momento hasta el cierre de esta fase.<br> No hace falta que inviertas todo el dinero disponible."
zero: "Todavía no has votado ninguna propuesta de inversión." zero: "Todavía no has votado ninguna propuesta de inversión."
reasons_for_not_balloting: reasons_for_not_balloting:
not_logged_in: Necesitas %{signin} o %{signup} para continuar. not_logged_in: Necesitas %{signin} o %{signup} para continuar.
not_verified: Las propuestas de inversión sólo pueden ser apoyadas por usuarios verificados, %{verify_account}. not_verified: Las propuestas de inversión sólo pueden ser apoyadas por usuarios verificados, %{verify_account}.
organization: Las organizaciones no pueden votar. organization: Las organizaciones no pueden votar.
not_selected: No se pueden votar propuestas inviables. not_selected: No se pueden votar propuestas inviables.
not_enough_money: No hay fondos suficientes not_enough_money: No hay fondos suficientes.
no_ballots_allowed: El periodo de votación está cerrado. no_ballots_allowed: El periodo de votación está cerrado.
different_heading_assigned: Ya votaste en una sección distinta del presupuesto. different_heading_assigned: Ya votaste en una sección distinta del presupuesto.
groups: groups:
show: show:
title: Selecciona una partida title: Selecciona una partida
budget:
phase: phase:
accepting: Fase de propuestas accepting: Aceptando propuestas
reviewing: Fase de revisión de propuestas reviewing: Revisando propuestas
selecting: Fase de apoyos selecting: Selección de propuestas
valuating: Fase de evaluación de propuestas valuating: Evaluación de propuestas
balloting: Fase de votación balloting: Votación de propuestas
reviewing_ballots: Fase de revisión de resultados reviewing_ballots: Contando resultados
finished: Resultados finished: Presupuesto terminado
groups:
index:
group_title: "Grupos"
headings:
none: Toda la ciudad
all: Todos los ámbitos
index: index:
name: Nombre del presupuesto
phase: Fase
title: Presupuestos participativos title: Presupuestos participativos
investments: investments:
form: form:
@@ -58,7 +49,6 @@ es:
new: Crear new: Crear
title: Título de la propuesta de inversión title: Título de la propuesta de inversión
index: index:
available: "Disponible:"
title: Presupuestos participativos title: Presupuestos participativos
unfeasible: Propuestas de inversión no viables unfeasible: Propuestas de inversión no viables
unfeasible_text: Las propuestas presentadas deben cumplir una serie de criterios (legalidad, concreción, ser competencia del Ayuntamiento, no superar el tope del presupuesto; %{definitions}) para ser declaradas viables y llegar hasta la fase de votación final. Todas las propuestas que no cumplen estos criterios son marcadas como inviables y publicadas en la siguiente lista, junto con su informe de inviabilidad. unfeasible_text: Las propuestas presentadas deben cumplir una serie de criterios (legalidad, concreción, ser competencia del Ayuntamiento, no superar el tope del presupuesto; %{definitions}) para ser declaradas viables y llegar hasta la fase de votación final. Todas las propuestas que no cumplen estos criterios son marcadas como inviables y publicadas en la siguiente lista, junto con su informe de inviabilidad.
@@ -66,25 +56,17 @@ es:
by_heading: "Propuestas de inversión con ámbito: %{heading}" by_heading: "Propuestas de inversión con ámbito: %{heading}"
search_form: search_form:
button: Buscar button: Buscar
placeholder: Propuestas de inversión... placeholder: Buscar propuestas de inversión...
title: Buscar title: Buscar
search_results: search_results:
one: " que contiene '%{search_term}'" one: " que contiene '%{search_term}'"
other: " que contienen '%{search_term}'" other: " que contienen '%{search_term}'"
sidebar: sidebar:
back: Volver a página de selección
district: Distrito
my_ballot: Mis votos my_ballot: Mis votos
remember_city: Además puedes votar propuestas de inversión para %{city}.
remember_city_link_html: <strong>toda la ciudad</strong>
remember_district: Además puedes votar propuestas de inversión para %{district}.
remember_district_link_html: <strong>un distrito</strong>
voted_html: voted_html:
one: "<strong>Has votado una propuesta por un valor de %{amount_spent}</strong>" one: "<strong>Has votado una propuesta por un valor de %{amount_spent}</strong>"
other: "<strong>Has votado %{count} propuestas por un valor de %{amount_spent}</strong>" other: "<strong>Has votado %{count} propuestas por un valor de %{amount_spent}</strong>"
voted_info: Puedes cambiar tus votos en cualquier momento hasta el cierre de esta fase. No hace falta que gastes todo el dinero disponible. voted_info: Puedes cambiar tus votos en cualquier momento hasta el cierre de esta fase. No hace falta que gastes todo el dinero disponible.
votes: Apoyos restantes
votes_district: "Solo puedes votar en el distrito %{district}"
zero: "Todavía no has votado ninguna propuesta de inversión." zero: "Todavía no has votado ninguna propuesta de inversión."
verified_only: "Para crear una nueva propuesta de inversión %{verify}." verified_only: "Para crear una nueva propuesta de inversión %{verify}."
verify_account: "verifica tu cuenta" verify_account: "verifica tu cuenta"
@@ -96,30 +78,21 @@ es:
random: Aleatorias random: Aleatorias
confidence_score: Mejor valoradas confidence_score: Mejor valoradas
price: Por coste price: Por coste
new:
more_info: "¿Cómo funcionan los presupuestos participativos?"
recommendation_one: Consulta los %{requirements}.
recommendation_one_link: requisitos que debe cumplir una propuesta
recommendation_three: Intenta detallar lo máximo posible la propuesta para que el equipo de gobierno encargado de estudiarla tenga las menor dudas posibles.
recommendation_two: Cualquier propuesta o comentario que implique acciones ilegales será eliminada.
recommendations_title: Cómo crear una propuesta de inversión
start_new: Crear una propuesta de inversión
back_link: Volver
show: show:
author_deleted: Usuario eliminado author_deleted: Usuario eliminado
price_explanation: Informe de coste price_explanation: Informe de coste
unfeasibility_explanation: Informe de inviabilidad unfeasibility_explanation: Informe de inviabilidad
code_html: 'Código propuesta de gasto: <strong>%{code}</strong>' code_html: 'Código propuesta de gasto: <strong>%{code}</strong>'
location_html: 'Ubicación: <strong>%{location}</strong>' location_html: 'Ubicación: <strong>%{location}</strong>'
organization_name_html: 'Organización: <strong>%{name}</strong>'
share: Compartir share: Compartir
wrong_price_format: Solo puede incluir caracteres numéricos wrong_price_format: Solo puede incluir caracteres numéricos
investment: investment:
title: Propuesta de inversión title: Propuesta de inversión
add: Añadir add: Añadir
already_added: "Ya has añadido esta propuesta de inversión" already_added: "Ya has añadido esta propuesta de inversión"
already_supported: Ya has apoyado este proyecto. ¡Compártelo! already_supported: Ya has apoyado esta propuesta. ¡Compártelo!
forum: Espacio de debate distrital support_title: Apoyar esta propuesta
support_title: Apoyar este proyecto
supports: supports:
one: 1 apoyo one: 1 apoyo
other: "%{count} apoyos" other: "%{count} apoyos"
@@ -128,9 +101,8 @@ es:
header: header:
check_ballot: Revisar mis votos check_ballot: Revisar mis votos
different_heading_assigned_html: "Ya apoyaste propuestas de otra sección del presupuesto: %{heading_link}" different_heading_assigned_html: "Ya apoyaste propuestas de otra sección del presupuesto: %{heading_link}"
progress_bar:
available: "Disponible: "
show: show:
group: Grupo group: Grupo
heading: Partida
price: Cantidad
no_heading: Sin línea
phase: Fase actual phase: Fase actual

View File

@@ -33,15 +33,6 @@ en:
application: application:
close: Close close: Close
menu: Menu menu: Menu
budgets:
progress_bar:
available: Available
phases:
accepting: Accepting investment projects
on_hold: On Hold
selecting: Selecting investment projects
balloting: Voting investment projects
finished: Finished
comments: comments:
comment: comment:
admin: Administrator admin: Administrator

View File

@@ -33,15 +33,6 @@ es:
application: application:
close: Cerrar close: Cerrar
menu: Menú menu: Menú
budgets:
progress_bar:
available: Disponible
phases:
accepting: Aceptación de proyectos
on_hold: En espera
selecting: Selección de proyectos
balloting: Votación de proyectos
finished: Terminado
comments: comments:
comment: comment:
admin: Administrador admin: Administrador

View File

@@ -348,7 +348,7 @@ Budget::PHASES.each_with_index do |phase, i|
geozones = Geozone.reorder("RANDOM()").limit([2, 5, 6, 7].sample) geozones = Geozone.reorder("RANDOM()").limit([2, 5, 6, 7].sample)
geozones.each do |geozone| geozones.each do |geozone|
group.headings << group.headings.create!(name: geozone.name, group.headings << group.headings.create!(name: geozone.name,
geozone: geozone, #geozone: geozone,
price: rand(1 .. 100) * 100000) price: rand(1 .. 100) * 100000)
end end

View File

@@ -0,0 +1,5 @@
class AddOrganizationNameFieldToBudgetInvestment < ActiveRecord::Migration
def change
add_column :budget_investments, :organization_name, :string
end
end

View File

@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170103170147) do ActiveRecord::Schema.define(version: 20170106130838) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@@ -142,6 +142,7 @@ ActiveRecord::Schema.define(version: 20170103170147) do
t.integer "group_id" t.integer "group_id"
t.boolean "selected", default: false t.boolean "selected", default: false
t.string "location" t.string "location"
t.string "organization_name"
end end
add_index "budget_investments", ["administrator_id"], name: "index_budget_investments_on_administrator_id", using: :btree add_index "budget_investments", ["administrator_id"], name: "index_budget_investments_on_administrator_id", using: :btree

View File

@@ -23,7 +23,7 @@ feature 'Admin budgets' do
visit admin_budgets_path visit admin_budgets_path
expect(page).to have_content(budget.name) expect(page).to have_content(budget.name)
expect(page).to have_content(I18n.t("budget.phase.#{budget.phase}")) expect(page).to have_content(I18n.t("budgets.phase.#{budget.phase}"))
end end
scenario 'Filters by phase' do scenario 'Filters by phase' do

View File

@@ -70,6 +70,7 @@ feature 'Budget Investments' do
end end
context("Orders") do context("Orders") do
before(:each) { budget.update(phase: 'selecting') }
scenario "Default order is random" do scenario "Default order is random" do
per_page = Kaminari.config.default_per_page per_page = Kaminari.config.default_per_page
@@ -151,7 +152,7 @@ feature 'Budget Investments' do
fill_in 'budget_investment_description', with: 'This is the description' fill_in 'budget_investment_description', with: 'This is the description'
check 'budget_investment_terms_of_service' check 'budget_investment_terms_of_service'
click_button 'Create' click_button 'Create Investment'
expect(page.status_code).to eq(200) expect(page.status_code).to eq(200)
expect(page.html).to be_empty expect(page.html).to be_empty
@@ -169,7 +170,7 @@ feature 'Budget Investments' do
fill_in 'budget_investment_description', with: 'This is the description' fill_in 'budget_investment_description', with: 'This is the description'
check 'budget_investment_terms_of_service' check 'budget_investment_terms_of_service'
click_button 'Create' click_button 'Create Investment'
expect(page).to have_content 'Sorry, that was too quick! Please resubmit' expect(page).to have_content 'Sorry, that was too quick! Please resubmit'
expect(current_path).to eq(new_budget_investment_path(budget_id: budget.id)) expect(current_path).to eq(new_budget_investment_path(budget_id: budget.id))
@@ -186,7 +187,7 @@ feature 'Budget Investments' do
fill_in 'budget_investment_external_url', with: 'http://http://skyscraperpage.com/' fill_in 'budget_investment_external_url', with: 'http://http://skyscraperpage.com/'
check 'budget_investment_terms_of_service' check 'budget_investment_terms_of_service'
click_button 'Create' click_button 'Create Investment'
expect(page).to have_content 'Investment created successfully' expect(page).to have_content 'Investment created successfully'
expect(page).to have_content 'You can access it from My activity' expect(page).to have_content 'You can access it from My activity'
@@ -204,9 +205,21 @@ feature 'Budget Investments' do
login_as(author) login_as(author)
visit new_budget_investment_path(budget_id: budget.id) visit new_budget_investment_path(budget_id: budget.id)
click_button 'Create' click_button 'Create Investment'
expect(page).to have_content error_message expect(page).to have_content error_message
end end
scenario 'Ballot is not visible' do
login_as(author)
visit budget_investments_path(budget, heading_id: heading.id)
expect(page).to_not have_link('Check my ballot')
expect(page).to_not have_css('#progress_bar')
within('#sidebar') do
expect(page).to_not have_content('My ballot')
end
end
end end
scenario "Show" do scenario "Show" do
@@ -280,7 +293,7 @@ feature 'Budget Investments' do
end end
context "Phase 3 - Final Voting" do context "Balloting Phase" do
background do background do
budget.update(phase: "balloting") budget.update(phase: "balloting")
@@ -403,5 +416,17 @@ feature 'Budget Investments' do
end end
end end
scenario 'Ballot is visible' do
login_as(author)
visit budget_investments_path(budget, heading_id: heading.id)
expect(page).to have_link('Check my ballot')
expect(page).to have_css('#progress_bar')
within('#sidebar') do
expect(page).to have_content('My ballot')
end
end
end end
end end

View File

@@ -35,12 +35,12 @@ feature 'Budget Investments' do
fill_in 'budget_investment_external_url', with: 'http://moarparks.com' fill_in 'budget_investment_external_url', with: 'http://moarparks.com'
check 'budget_investment_terms_of_service' check 'budget_investment_terms_of_service'
click_button 'Create' click_button 'Create Investment'
expect(page).to have_content 'Investment created successfully.' expect(page).to have_content 'Investment created successfully.'
expect(page).to have_content '2016' expect(page).to have_content '2017'
expect(page).to have_content 'Whole city' #expect(page).to have_content 'Whole city'
expect(page).to have_content 'Health' expect(page).to have_content 'Health'
expect(page).to have_content 'Build a park in my neighborhood' expect(page).to have_content 'Build a park in my neighborhood'
expect(page).to have_content 'There is no parks here...' expect(page).to have_content 'There is no parks here...'
@@ -82,7 +82,6 @@ feature 'Budget Investments' do
expect(page).to have_content(budget_investment1.title) expect(page).to have_content(budget_investment1.title)
expect(page).to_not have_content(budget_investment2.title) expect(page).to_not have_content(budget_investment2.title)
expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment1)}']", text: budget_investment1.title) expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment1)}']", text: budget_investment1.title)
expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment1)}']", text: budget_investment1.description)
end end
end end
@@ -107,7 +106,6 @@ feature 'Budget Investments' do
expect(page).to_not have_content(budget_investment1.title) expect(page).to_not have_content(budget_investment1.title)
expect(page).to have_content(budget_investment2.title) expect(page).to have_content(budget_investment2.title)
expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment2)}']", text: budget_investment2.title) expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment2)}']", text: budget_investment2.title)
expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment2)}']", text: budget_investment2.description)
end end
end end
end end
@@ -135,9 +133,7 @@ feature 'Budget Investments' do
within("#budget-investments") do within("#budget-investments") do
expect(page).to have_css('.budget-investment', count: 2) expect(page).to have_css('.budget-investment', count: 2)
expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment1)}']", text: budget_investment1.title) expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment1)}']", text: budget_investment1.title)
expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment1)}']", text: budget_investment1.description)
expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment2)}']", text: budget_investment2.title) expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment2)}']", text: budget_investment2.title)
expect(page).to have_css("a[href='#{management_budget_investment_path(@budget, budget_investment2)}']", text: budget_investment2.description)
end end
end end

View File

@@ -64,5 +64,27 @@ describe Budget do
expect(budget.heading_price(create(:budget_heading))).to eq(-1) expect(budget.heading_price(create(:budget_heading))).to eq(-1)
end end
end end
describe "investments_orders" do
let(:budget) { create(:budget) }
it "is random when accepting and reviewing" do
budget.phase = 'accepting'
expect(budget.investments_orders).to eq(['random'])
budget.phase = 'reviewing'
expect(budget.investments_orders).to eq(['random'])
end
it "is random and price when ballotting and reviewing ballots" do
budget.phase = 'balloting'
expect(budget.investments_orders).to eq(['random', 'price'])
budget.phase = 'reviewing_ballots'
expect(budget.investments_orders).to eq(['random', 'price'])
end
it "is random and confidence_score in all other cases" do
budget.phase = 'selecting'
expect(budget.investments_orders).to eq(['random', 'confidence_score'])
budget.phase = 'valuating'
expect(budget.investments_orders).to eq(['random', 'confidence_score'])
end
end
end end