fixes conflicts with budgets
This commit is contained in:
@@ -462,7 +462,7 @@
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.proposal-show, .investment-project-show {
|
||||
.proposal-show, .investment-project-show, .budget-investment-show {
|
||||
|
||||
.supports {
|
||||
padding: $line-height/2 0 0;
|
||||
@@ -712,6 +712,7 @@
|
||||
}
|
||||
|
||||
.remove .icon-check-circle {
|
||||
color: $budget;
|
||||
display: block;
|
||||
font-size: rem-calc(70);
|
||||
line-height: rem-calc(70);
|
||||
@@ -1030,7 +1031,6 @@
|
||||
|
||||
.amount-spent {
|
||||
background: $success-bg;
|
||||
color: $success-color;
|
||||
font-weight: normal;
|
||||
padding: $line-height/2;
|
||||
|
||||
|
||||
@@ -5,14 +5,16 @@ module Budgets
|
||||
before_action :load_ballot
|
||||
|
||||
def show
|
||||
authorize! :show, @ballot
|
||||
render template: "budgets/ballot/show"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
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
|
||||
|
||||
@@ -18,7 +18,7 @@ module Budgets
|
||||
feature_flag :budgets
|
||||
|
||||
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
|
||||
|
||||
@@ -83,7 +83,7 @@ module Budgets
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
def load_ballot
|
||||
|
||||
@@ -66,14 +66,14 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController
|
||||
|
||||
def valid_price_params?
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
@investment.errors.empty?
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
module BudgetsHelper
|
||||
|
||||
def budget_phases_select_options
|
||||
Budget::PHASES.map { |ph| [ t("budget.phase.#{ph}"), ph ] }
|
||||
Budget::PHASES.map { |ph| [ t("budgets.phase.#{ph}"), ph ] }
|
||||
end
|
||||
|
||||
def budget_currency_symbol_select_options
|
||||
Budget::CURRENCY_SYMBOLS.map { |cs| [ cs, cs ] }
|
||||
end
|
||||
|
||||
def heading_name(heading)
|
||||
heading.present? ? heading.name : t("budget.headings.none")
|
||||
end
|
||||
|
||||
def namespaced_budget_investment_path(investment, options={})
|
||||
case namespace
|
||||
when "management::budgets"
|
||||
|
||||
@@ -76,7 +76,7 @@ class Budget < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def translated_phase
|
||||
I18n.t "budget.phase.#{phase}"
|
||||
I18n.t "budgets.phase.#{phase}"
|
||||
end
|
||||
|
||||
def formatted_amount(amount)
|
||||
@@ -94,6 +94,17 @@ class Budget < ActiveRecord::Base
|
||||
formatted_amount(amount_spent(heading))
|
||||
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
|
||||
|
||||
def sanitize_descriptions
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<%= budget.name %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<%= t("budget.phase.#{budget.phase}") %>
|
||||
<%= t("budgets.phase.#{budget.phase}") %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<%= link_to t("admin.budgets.index.budget_investments"), admin_budget_budget_investments_path(budget_id: budget.id) %>
|
||||
|
||||
@@ -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>
|
||||
<%= t("budgets.ballots.show.voted_html",
|
||||
count: @ballot.investments.count) %>
|
||||
</h2>
|
||||
<p>
|
||||
<small>
|
||||
<%= t("budgets.ballots.show.voted_info_html") %>
|
||||
</small>
|
||||
</p>
|
||||
<div class="small-12 medium-8 column small-centered text-center">
|
||||
<h2>
|
||||
<%= t("budgets.ballots.show.voted_html",
|
||||
count: @ballot.investments.count) %>
|
||||
</h2>
|
||||
<p>
|
||||
<small>
|
||||
<%= t("budgets.ballots.show.voted_info_html") %>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="row ballot">
|
||||
<div class="margin-top">
|
||||
<% @ballot.groups.each do |group| %>
|
||||
<div id="<%= dom_id(group) %>"
|
||||
@@ -34,9 +36,6 @@
|
||||
<% else %>
|
||||
<p>
|
||||
<%= 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>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
class: "remove-investment-project",
|
||||
method: :delete,
|
||||
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 %>
|
||||
</li>
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
</span>
|
||||
|
||||
<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"
|
||||
style="width:
|
||||
<%= progress_bar_width(@budget.heading_price(@heading),
|
||||
@@ -20,7 +21,7 @@
|
||||
<p id="amount-spent" class="progress-meter-text spent-amount-text">
|
||||
<%= @ballot.formatted_amount_spent(@heading) %>
|
||||
<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>
|
||||
</p>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="expanded budget no-margin-top padding">
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<h1><%= t('budget.index.title') %></h1>
|
||||
<h1><%= t('budgets.index.title') %></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -10,8 +10,8 @@
|
||||
<div class="small-12 medium-9 column">
|
||||
<table>
|
||||
<thead>
|
||||
<th><%= t('budget.index.name') %></th>
|
||||
<th><%= t('budget.index.phase') %></th>
|
||||
<th><%= Budget.human_attribute_name(:name) %></th>
|
||||
<th><%= Budget.human_attribute_name(:phase) %></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @budgets.each do |budget| %>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
<% if ballot.has_investment?(investment) %>
|
||||
|
||||
<div class="remove supported inline-block">
|
||||
<span class="icon-check-circle bounceIn animated"
|
||||
title="<%= t("budget.investments.investment.already_added") %>">
|
||||
<span class="icon-check-circle"
|
||||
title="<%= t("budgets.investments.investment.already_added") %>">
|
||||
</span>
|
||||
<p class="investment-project-amount">
|
||||
<%= investment.formatted_price %>
|
||||
@@ -27,12 +27,12 @@
|
||||
<%= investment.formatted_price %>
|
||||
</p>
|
||||
<% 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_id: investment.budget_id,
|
||||
investments_ids: investment_ids),
|
||||
class: "button button-support small expanded",
|
||||
title: t('budget.investments.investment.support_title'),
|
||||
title: t('budgets.investments.investment.support_title'),
|
||||
method: :post,
|
||||
remote: true %>
|
||||
<% end %>
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
<% 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>
|
||||
<%= t("budgets.ballots.reasons_for_not_balloting.#{reason}",
|
||||
verify_account: link_to(t("votes.verify_account"), verification_path),
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
|
||||
<div class="row">
|
||||
<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, label: false} %>
|
||||
<%= f.select :heading_id, budget_heading_select_options(@budget), {include_blank: true, } %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
@@ -25,6 +24,10 @@
|
||||
<%= f.text_field :location %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= f.text_field :organization_name %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 column">
|
||||
<%= f.label :tag_list, t("budget.investments.form.tags_label") %>
|
||||
<p class="note"><%= t("budget.investments.form.tags_instructions") %></p>
|
||||
@@ -60,7 +63,7 @@
|
||||
<% end %>
|
||||
|
||||
<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>
|
||||
<% end %>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<% end %>
|
||||
|
||||
<% if can? :show, @ballot %>
|
||||
<%= link_to t("budget.investments.header.check_ballot"),
|
||||
<%= link_to t("budgets.investments.header.check_ballot"),
|
||||
budget_ballot_path(@budget),
|
||||
class: "button float-right" %>
|
||||
<% end %>
|
||||
@@ -20,13 +20,12 @@
|
||||
<div class="row progress-votes">
|
||||
<div class="small-12 column">
|
||||
<div class="progress-bar-nav" data-fixed-bar>
|
||||
<h1 class="inline-block"><%= @heading.name %></h1>
|
||||
<div id="check-ballot" style="display: none;">
|
||||
<% if can? :show, @ballot %>
|
||||
<%= link_to t("budget.investments.header.check_ballot"),
|
||||
<h1 class="inline-block margin-top"><%= @heading.name %></h1>
|
||||
<% if can? :show, @ballot %>
|
||||
<div id="check-ballot" style="display: none;">
|
||||
<%= link_to t("budgets.investments.header.check_ballot"),
|
||||
budget_ballot_path(@budget) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% if @ballot.valid_heading?(@heading) %>
|
||||
<div id="progress_bar" class="no-margin-top">
|
||||
<%= render 'budgets/ballot/progress_bar' %>
|
||||
@@ -34,13 +33,16 @@
|
||||
<% else %>
|
||||
<br>
|
||||
<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(
|
||||
@assigned_heading.name,
|
||||
budget_investments_path(@budget, heading: @assigned_heading))
|
||||
) %>
|
||||
</p>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<h2><%= @budget.formatted_heading_price(@heading) %></h2>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -55,7 +57,7 @@
|
||||
<%= t("shared.back") %>
|
||||
<% end %>
|
||||
|
||||
<h1><%= t('budget.investments.index.title') %></h1>
|
||||
<h1><%= t('budgets.investments.index.title') %></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<div class="budget-investment-content">
|
||||
|
||||
<% 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>
|
||||
<h3><%= link_to investment.title, namespaced_budget_investment_path(investment) %></h3>
|
||||
<p class="investment-project-info">
|
||||
@@ -16,7 +16,7 @@
|
||||
<% if investment.author.hidden? || investment.author.erased? %>
|
||||
<span class="bullet"> • </span>
|
||||
<span class="author">
|
||||
<%= t("budget.investments.show.author_deleted") %>
|
||||
<%= t("budgets.investments.show.author_deleted") %>
|
||||
</span>
|
||||
<% else %>
|
||||
<span class="bullet"> • </span>
|
||||
@@ -32,10 +32,10 @@
|
||||
<% end %>
|
||||
|
||||
<span class="bullet"> • </span>
|
||||
<%= heading_name(investment.heading) %>
|
||||
<%= investment.heading.name %>
|
||||
</p>
|
||||
<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>
|
||||
<%= render "shared/tags", taggable: investment, limit: 5 %>
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
<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="small-12 medium-9 column">
|
||||
<%= link_to :back, class: "back" do %>
|
||||
@@ -21,17 +15,23 @@
|
||||
<span class="bullet"> • </span>
|
||||
<%= l investment.created_at.to_date %>
|
||||
<span class="bullet"> • </span>
|
||||
<%= heading_name(investment.heading) %>
|
||||
<%= investment.heading.name %>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<p id="investment_code">
|
||||
<%= t("budget.investments.show.code_html", code: investment.id) %>
|
||||
<%= t("budgets.investments.show.code_html", code: investment.id) %>
|
||||
</p>
|
||||
|
||||
<% if investment.location.present? %>
|
||||
<p id="investment_code">
|
||||
<%= t("budget.investments.show.location_html", location: investment.location) %>
|
||||
<p>
|
||||
<%= 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>
|
||||
<% end %>
|
||||
|
||||
@@ -46,12 +46,12 @@
|
||||
<% end %>
|
||||
|
||||
<% 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>
|
||||
<% end %>
|
||||
|
||||
<% 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>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -59,7 +59,7 @@
|
||||
<% if investment.should_show_aside? %>
|
||||
<aside class="small-12 medium-3 column">
|
||||
<div class="sidebar-divider"></div>
|
||||
<h3><%= t("votes.supports") %></h3>
|
||||
<h2><%= t("votes.supports") %></h2>
|
||||
<div class="text-center">
|
||||
|
||||
<% if investment.should_show_votes? %>
|
||||
@@ -82,7 +82,7 @@
|
||||
</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">
|
||||
<%= social_share_button_tag("#{investment.title} #{setting['twitter_hashtag']}") %>
|
||||
<% if browser.device.mobile? %>
|
||||
@@ -96,5 +96,3 @@
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
@@ -1,41 +1,45 @@
|
||||
<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? %>
|
||||
<%= 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 %>
|
||||
<div class="callout warning">
|
||||
<%= t("budget.investments.index.sidebar.verified_only",
|
||||
verify: link_to(t("budget.investments.index.sidebar.verify_account"), verification_path)).html_safe %>
|
||||
<%= t("budgets.investments.index.sidebar.verified_only",
|
||||
verify: link_to(t("budgets.investments.index.sidebar.verify_account"), verification_path)).html_safe %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= render "shared/tag_cloud", taggable: 'budget/investment' %>
|
||||
<%= render 'categories' %>
|
||||
<% 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 %>
|
||||
<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 %>
|
||||
<% if @heading && can?(:show, @ballot) %>
|
||||
|
||||
<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 %>
|
||||
<div class="sidebar-divider"></div>
|
||||
|
||||
<h2 class="sidebar-title"><%= t("budgets.investments.index.sidebar.my_ballot") %></h2>
|
||||
<% if @ballot.investments.by_heading(@heading.id).count > 0 %>
|
||||
<p>
|
||||
<em>
|
||||
<%= 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 %>
|
||||
</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 %>
|
||||
|
||||
@@ -5,29 +5,29 @@
|
||||
<div class="supports js-participation">
|
||||
|
||||
<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>
|
||||
|
||||
<div class="in-favor js-in-favor">
|
||||
<% if user_voted_for %>
|
||||
<div class="supported">
|
||||
<%= t("budget.investments.investment.already_supported") %>
|
||||
<div class="supported callout success">
|
||||
<%= t("budgets.investments.investment.already_supported") %>
|
||||
</div>
|
||||
<% elsif investment.should_show_votes? %>
|
||||
|
||||
<%= link_to vote_url,
|
||||
class: "button button-support small expanded",
|
||||
title: t('budget.investments.investment.support_title'),
|
||||
title: t('budgets.investments.investment.support_title'),
|
||||
method: "post",
|
||||
remote: true,
|
||||
"aria-hidden" => css_for_aria_hidden(reason) do %>
|
||||
<%= t("budget.investments.investment.give_support") %>
|
||||
<%= t("budgets.investments.investment.give_support") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% 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>
|
||||
<%= t("votes.budget_investments.#{reason}",
|
||||
verify_account: link_to(t("votes.verify_account"), verification_path),
|
||||
|
||||
@@ -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 %>
|
||||
<%= render "shared/search_form",
|
||||
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 %>
|
||||
|
||||
<main id="budget-investments-main">
|
||||
@@ -17,23 +17,23 @@
|
||||
<div class="small-12 search-results margin-bottom">
|
||||
|
||||
<% if params[:unfeasible].present? %>
|
||||
<h2><%= t("budget.investments.index.unfeasible") %></h2>
|
||||
<h2><%= t("budgets.investments.index.unfeasible") %></h2>
|
||||
<p>
|
||||
<%= t("budget.investments.index.unfeasible_text",
|
||||
definitions: link_to(t("budget.investments.index.unfeasible_text_definitions"), "https://decide.madrid.es/participatory_budget_info#20")).html_safe %>
|
||||
<%= t("budgets.investments.index.unfeasible_text",
|
||||
definitions: link_to(t("budgets.investments.index.unfeasible_text_definitions"), "https://decide.madrid.es/participatory_budget_info#20")).html_safe %>
|
||||
</p>
|
||||
<% 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? %>
|
||||
<h2>
|
||||
<%= 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>
|
||||
<% end %>
|
||||
</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| %>
|
||||
<%= render partial: '/budgets/investments/investment', locals: {
|
||||
|
||||
@@ -12,26 +12,26 @@
|
||||
</div>
|
||||
<div class="small-12 medium-3 column info padding" data-equalizer-watch>
|
||||
<p>
|
||||
<strong><%= t('budget.show.phase') %></strong>
|
||||
<strong><%= t('budgets.show.phase') %></strong>
|
||||
<br>
|
||||
<%= t("budgets.phases.#{@budget.phase}") %>
|
||||
<%= t("budgets.phase.#{@budget.phase}") %>
|
||||
</p>
|
||||
|
||||
<% if @budget.accepting? %>
|
||||
<% if can?(:create, Budget::Investment.new(budget: @budget))%>
|
||||
<% if current_user %>
|
||||
<% 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 %>
|
||||
<div class="callout warning margin-top">
|
||||
<%= t("budget.investments.index.sidebar.verified_only",
|
||||
verify: link_to(t("budget.investments.index.sidebar.verify_account"), verification_path)).html_safe %>
|
||||
<%= t("budgets.investments.index.sidebar.verified_only",
|
||||
verify: link_to(t("budgets.investments.index.sidebar.verify_account"), verification_path)).html_safe %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="callout primary margin-top">
|
||||
<%= t("budget.investments.index.sidebar.not_logged_in",
|
||||
sign_in: link_to(t("budget.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 %>
|
||||
<%= t("budgets.investments.index.sidebar.not_logged_in",
|
||||
sign_in: link_to(t("budgets.investments.index.sidebar.sign_in"), new_user_session_path),
|
||||
sign_up: link_to(t("budgets.investments.index.sidebar.sign_up"), new_user_registration_path)).html_safe %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -43,7 +43,7 @@
|
||||
<div class="small-12 medium-9 column">
|
||||
<table class="table-fixed">
|
||||
<thead>
|
||||
<th><%= t('budget.show.group') %></th>
|
||||
<th><%= t('budgets.show.group') %></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @budget.groups.each do |group| %>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<%= form_tag search_path, method: :get do %>
|
||||
<div class="input-group">
|
||||
<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">
|
||||
<button type="submit" class="button" title="<%= t("#{i18n_namespace}.button") %>">
|
||||
<span class="sr-only"><%= t("#{i18n_namespace}.button") %></span>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<%= budget.name %>
|
||||
</td>
|
||||
<td>
|
||||
<%= t("budget.phase.#{budget.phase}") %>
|
||||
<%= t("budgets.phase.#{budget.phase}") %>
|
||||
</td>
|
||||
<td>
|
||||
<%= @investments_with_valuation_open[budget.id] %>
|
||||
|
||||
@@ -32,6 +32,7 @@ data:
|
||||
- config/locales/devise_views.%{locale}.yml
|
||||
- config/locales/responders.%{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:
|
||||
# `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}'
|
||||
# - '{devise,simple_form}.*'
|
||||
ignore_missing:
|
||||
- 'budget.*'
|
||||
- 'budgets.*'
|
||||
- 'unauthorized.*'
|
||||
- 'activerecord.models.proposal'
|
||||
- 'activerecord.models.spending_proposal'
|
||||
@@ -109,8 +108,8 @@ ignore_missing:
|
||||
|
||||
## Consider these keys used:
|
||||
ignore_unused:
|
||||
- 'budget.*'
|
||||
- 'budgets.*'
|
||||
- 'budgets.phase.*'
|
||||
- 'budgets.investments.index.orders.*'
|
||||
- 'activerecord.*'
|
||||
- 'activemodel.*'
|
||||
- 'unauthorized.*'
|
||||
@@ -140,11 +139,10 @@ ignore_unused:
|
||||
- 'users.show.filters.*'
|
||||
- 'debates.index.select_order'
|
||||
- 'debates.index.orders.*'
|
||||
- 'debates.index.search_form.*'
|
||||
- 'proposals.index.select_order'
|
||||
- 'proposals.index.orders.*'
|
||||
- 'proposals.index.search_form.*'
|
||||
- 'spending_proposals.index.search_form.*'
|
||||
- '*.index.search_form.*'
|
||||
- 'notifications.index.comments_on*'
|
||||
- 'notifications.index.replies_to*'
|
||||
- 'notifications.index.proposal_notification*'
|
||||
|
||||
@@ -63,6 +63,8 @@ en:
|
||||
external_url: "Link to additional documentation"
|
||||
heading_id: "Heading"
|
||||
title: "Title"
|
||||
location: "Location"
|
||||
organization_name: "If you are proposing in the name of a collective/organization, write its name"
|
||||
comment:
|
||||
body: "Comment"
|
||||
user: "User"
|
||||
|
||||
@@ -58,6 +58,8 @@ es:
|
||||
external_url: "Enlace a documentación adicional"
|
||||
heading_id: "Partida presupuestaria"
|
||||
title: "Título"
|
||||
location: "Ubicación"
|
||||
organization_name: "Si estás proponiendo en nombre de una organización o colectivo, escribe su nombre"
|
||||
comment:
|
||||
body: "Comentario"
|
||||
user: "Usuario"
|
||||
|
||||
@@ -16,30 +16,21 @@ en:
|
||||
not_verified: Only verified users can vote on proposals; %{verify_account}.
|
||||
organization: Organizations are not permitted to vote
|
||||
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
|
||||
different_heading_assigned: You have already voted a different heading
|
||||
groups:
|
||||
show:
|
||||
title: Select a heading
|
||||
budget:
|
||||
phase:
|
||||
accepting: Accepting proposals
|
||||
reviewing: Reviewing proposals
|
||||
selecting: Selecting
|
||||
valuating: Valuating
|
||||
balloting: Balloting
|
||||
selecting: Selecting proposals
|
||||
valuating: Valuating proposals
|
||||
balloting: Balloting proposals
|
||||
reviewing_ballots: Reviewing Ballots
|
||||
finished: Finished
|
||||
groups:
|
||||
index:
|
||||
group_title: "Groups"
|
||||
headings:
|
||||
none: Whole City
|
||||
all: All scopes
|
||||
finished: Finished budget
|
||||
index:
|
||||
name: Budget name
|
||||
phase: Phase
|
||||
title: Participatory budgets
|
||||
investments:
|
||||
form:
|
||||
@@ -58,7 +49,6 @@ en:
|
||||
new: Create
|
||||
title: Investment title
|
||||
index:
|
||||
available: "Available:"
|
||||
title: Participatory budgeting
|
||||
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."
|
||||
@@ -66,25 +56,17 @@ en:
|
||||
by_heading: "Investment projects with scope: %{heading}"
|
||||
search_form:
|
||||
button: Search
|
||||
placeholder: Investment projects...
|
||||
placeholder: Search investment projects...
|
||||
title: Search
|
||||
search_results:
|
||||
one: " containing the term '%{search_term}'"
|
||||
other: " containing the term '%{search_term}'"
|
||||
sidebar:
|
||||
back: Back to select page
|
||||
district: District
|
||||
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:
|
||||
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>"
|
||||
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.
|
||||
verified_only: "To create a new budget investment %{verify}."
|
||||
verify_account: "verify your account"
|
||||
@@ -96,22 +78,13 @@ en:
|
||||
random: random
|
||||
confidence_score: highest rated
|
||||
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:
|
||||
author_deleted: User deleted
|
||||
price_explanation: Price explanation
|
||||
unfeasibility_explanation: Unfeasibility explanation
|
||||
code_html: 'Investment project code: <strong>%{code}</strong>'
|
||||
location_html: 'Location: <strong>%{location}</strong>'
|
||||
location: Location
|
||||
organization_name_html: 'Organization: <strong>%{name}</strong>'
|
||||
share: Share
|
||||
wrong_price_format: Only integer numbers
|
||||
investment:
|
||||
@@ -119,7 +92,6 @@ en:
|
||||
add: Add
|
||||
already_added: You have already added this investment project
|
||||
already_supported: You have already supported this. Share it!
|
||||
forum: District discussion space
|
||||
support_title: Support this project
|
||||
supports:
|
||||
one: 1 support
|
||||
@@ -129,9 +101,8 @@ en:
|
||||
header:
|
||||
check_ballot: Check my ballot
|
||||
different_heading_assigned_html: "You have active votes in another heading: %{heading_link}"
|
||||
progress_bar:
|
||||
available: "Available: "
|
||||
show:
|
||||
group: Group
|
||||
heading: Heading
|
||||
price: Price
|
||||
no_heading: No Heading
|
||||
phase: Actual phase
|
||||
|
||||
@@ -11,35 +11,26 @@ es:
|
||||
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."
|
||||
zero: "Todavía no has votado ninguna propuesta de inversión."
|
||||
reasons_for_not_balloting:
|
||||
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}.
|
||||
organization: Las organizaciones no pueden votar.
|
||||
not_selected: No se pueden votar propuestas inviables.
|
||||
not_enough_money: No hay fondos suficientes
|
||||
no_ballots_allowed: El periodo de votación está cerrado.
|
||||
different_heading_assigned: Ya votaste en una sección distinta del presupuesto.
|
||||
reasons_for_not_balloting:
|
||||
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}.
|
||||
organization: Las organizaciones no pueden votar.
|
||||
not_selected: No se pueden votar propuestas inviables.
|
||||
not_enough_money: No hay fondos suficientes.
|
||||
no_ballots_allowed: El periodo de votación está cerrado.
|
||||
different_heading_assigned: Ya votaste en una sección distinta del presupuesto.
|
||||
groups:
|
||||
show:
|
||||
title: Selecciona una partida
|
||||
budget:
|
||||
phase:
|
||||
accepting: Fase de propuestas
|
||||
reviewing: Fase de revisión de propuestas
|
||||
selecting: Fase de apoyos
|
||||
valuating: Fase de evaluación de propuestas
|
||||
balloting: Fase de votación
|
||||
reviewing_ballots: Fase de revisión de resultados
|
||||
finished: Resultados
|
||||
groups:
|
||||
index:
|
||||
group_title: "Grupos"
|
||||
headings:
|
||||
none: Toda la ciudad
|
||||
all: Todos los ámbitos
|
||||
accepting: Aceptando propuestas
|
||||
reviewing: Revisando propuestas
|
||||
selecting: Selección de propuestas
|
||||
valuating: Evaluación de propuestas
|
||||
balloting: Votación de propuestas
|
||||
reviewing_ballots: Contando resultados
|
||||
finished: Presupuesto terminado
|
||||
index:
|
||||
name: Nombre del presupuesto
|
||||
phase: Fase
|
||||
title: Presupuestos participativos
|
||||
investments:
|
||||
form:
|
||||
@@ -58,7 +49,6 @@ es:
|
||||
new: Crear
|
||||
title: Título de la propuesta de inversión
|
||||
index:
|
||||
available: "Disponible:"
|
||||
title: Presupuestos participativos
|
||||
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.
|
||||
@@ -66,25 +56,17 @@ es:
|
||||
by_heading: "Propuestas de inversión con ámbito: %{heading}"
|
||||
search_form:
|
||||
button: Buscar
|
||||
placeholder: Propuestas de inversión...
|
||||
placeholder: Buscar propuestas de inversión...
|
||||
title: Buscar
|
||||
search_results:
|
||||
one: " que contiene '%{search_term}'"
|
||||
other: " que contienen '%{search_term}'"
|
||||
sidebar:
|
||||
back: Volver a página de selección
|
||||
district: Distrito
|
||||
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:
|
||||
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>"
|
||||
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."
|
||||
verified_only: "Para crear una nueva propuesta de inversión %{verify}."
|
||||
verify_account: "verifica tu cuenta"
|
||||
@@ -96,30 +78,21 @@ es:
|
||||
random: Aleatorias
|
||||
confidence_score: Mejor valoradas
|
||||
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:
|
||||
author_deleted: Usuario eliminado
|
||||
price_explanation: Informe de coste
|
||||
unfeasibility_explanation: Informe de inviabilidad
|
||||
code_html: 'Código propuesta de gasto: <strong>%{code}</strong>'
|
||||
location_html: 'Ubicación: <strong>%{location}</strong>'
|
||||
organization_name_html: 'Organización: <strong>%{name}</strong>'
|
||||
share: Compartir
|
||||
wrong_price_format: Solo puede incluir caracteres numéricos
|
||||
investment:
|
||||
title: Propuesta de inversión
|
||||
add: Añadir
|
||||
already_added: "Ya has añadido esta propuesta de inversión"
|
||||
already_supported: Ya has apoyado este proyecto. ¡Compártelo!
|
||||
forum: Espacio de debate distrital
|
||||
support_title: Apoyar este proyecto
|
||||
already_supported: Ya has apoyado esta propuesta. ¡Compártelo!
|
||||
support_title: Apoyar esta propuesta
|
||||
supports:
|
||||
one: 1 apoyo
|
||||
other: "%{count} apoyos"
|
||||
@@ -128,9 +101,8 @@ es:
|
||||
header:
|
||||
check_ballot: Revisar mis votos
|
||||
different_heading_assigned_html: "Ya apoyaste propuestas de otra sección del presupuesto: %{heading_link}"
|
||||
progress_bar:
|
||||
available: "Disponible: "
|
||||
show:
|
||||
group: Grupo
|
||||
heading: Partida
|
||||
price: Cantidad
|
||||
no_heading: Sin línea
|
||||
phase: Fase actual
|
||||
|
||||
@@ -33,15 +33,6 @@ en:
|
||||
application:
|
||||
close: Close
|
||||
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:
|
||||
comment:
|
||||
admin: Administrator
|
||||
|
||||
@@ -33,15 +33,6 @@ es:
|
||||
application:
|
||||
close: Cerrar
|
||||
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:
|
||||
comment:
|
||||
admin: Administrador
|
||||
|
||||
@@ -348,7 +348,7 @@ Budget::PHASES.each_with_index do |phase, i|
|
||||
geozones = Geozone.reorder("RANDOM()").limit([2, 5, 6, 7].sample)
|
||||
geozones.each do |geozone|
|
||||
group.headings << group.headings.create!(name: geozone.name,
|
||||
geozone: geozone,
|
||||
#geozone: geozone,
|
||||
price: rand(1 .. 100) * 100000)
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddOrganizationNameFieldToBudgetInvestment < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :budget_investments, :organization_name, :string
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# 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
|
||||
enable_extension "plpgsql"
|
||||
@@ -142,6 +142,7 @@ ActiveRecord::Schema.define(version: 20170103170147) do
|
||||
t.integer "group_id"
|
||||
t.boolean "selected", default: false
|
||||
t.string "location"
|
||||
t.string "organization_name"
|
||||
end
|
||||
|
||||
add_index "budget_investments", ["administrator_id"], name: "index_budget_investments_on_administrator_id", using: :btree
|
||||
|
||||
@@ -23,7 +23,7 @@ feature 'Admin budgets' do
|
||||
visit admin_budgets_path
|
||||
|
||||
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
|
||||
|
||||
scenario 'Filters by phase' do
|
||||
|
||||
@@ -70,6 +70,7 @@ feature 'Budget Investments' do
|
||||
end
|
||||
|
||||
context("Orders") do
|
||||
before(:each) { budget.update(phase: 'selecting') }
|
||||
|
||||
scenario "Default order is random" do
|
||||
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'
|
||||
check 'budget_investment_terms_of_service'
|
||||
|
||||
click_button 'Create'
|
||||
click_button 'Create Investment'
|
||||
|
||||
expect(page.status_code).to eq(200)
|
||||
expect(page.html).to be_empty
|
||||
@@ -169,7 +170,7 @@ feature 'Budget Investments' do
|
||||
fill_in 'budget_investment_description', with: 'This is the description'
|
||||
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(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/'
|
||||
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 'You can access it from My activity'
|
||||
@@ -204,9 +205,21 @@ feature 'Budget Investments' do
|
||||
login_as(author)
|
||||
|
||||
visit new_budget_investment_path(budget_id: budget.id)
|
||||
click_button 'Create'
|
||||
click_button 'Create Investment'
|
||||
expect(page).to have_content error_message
|
||||
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
|
||||
|
||||
scenario "Show" do
|
||||
@@ -280,7 +293,7 @@ feature 'Budget Investments' do
|
||||
|
||||
end
|
||||
|
||||
context "Phase 3 - Final Voting" do
|
||||
context "Balloting Phase" do
|
||||
|
||||
background do
|
||||
budget.update(phase: "balloting")
|
||||
@@ -403,5 +416,17 @@ feature 'Budget Investments' do
|
||||
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
|
||||
@@ -35,12 +35,12 @@ feature 'Budget Investments' do
|
||||
fill_in 'budget_investment_external_url', with: 'http://moarparks.com'
|
||||
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 '2016'
|
||||
expect(page).to have_content 'Whole city'
|
||||
expect(page).to have_content '2017'
|
||||
#expect(page).to have_content 'Whole city'
|
||||
expect(page).to have_content 'Health'
|
||||
expect(page).to have_content 'Build a park in my neighborhood'
|
||||
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_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.description)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -107,7 +106,6 @@ feature 'Budget Investments' do
|
||||
expect(page).to_not have_content(budget_investment1.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.description)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -135,9 +133,7 @@ feature 'Budget Investments' do
|
||||
within("#budget-investments") do
|
||||
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.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.description)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -64,5 +64,27 @@ describe Budget do
|
||||
expect(budget.heading_price(create(:budget_heading))).to eq(-1)
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user