diff --git a/app/controllers/budgets/ballot/lines_controller.rb b/app/controllers/budgets/ballot/lines_controller.rb new file mode 100644 index 000000000..5483f40a3 --- /dev/null +++ b/app/controllers/budgets/ballot/lines_controller.rb @@ -0,0 +1,77 @@ +module Budgets + module Ballot + class LinesController < ApplicationController + before_action :authenticate_user! + #before_action :ensure_final_voting_allowed + before_action :load_budget + before_action :load_ballot + + before_action :load_investments + + load_and_authorize_resource :budget + load_and_authorize_resource :ballot, class: "Budget::Ballot" + load_and_authorize_resource :line, through: :ballot, find_by: :investment_id, class: "Budget::Ballot::Line" + + def create + load_investment + load_heading + + if @ballot.add_investment(@investment) + #@ballot.set_geozone(@geozone) + #@current_user.update(representative_id: nil) + if request.get? + redirect_to @spending_proposal, notice: t('spending_proposals.notice.voted') + end + else + if request.get? + redirect_to @spending_proposal, notice: t('spending_proposals.notice.could_not_vote') + else + render :new + end + end + end + + def destroy + @investment = @line.investment + load_heading + + @line.destroy + load_investments + #@ballot.reset_geozone + end + + private + + def ensure_final_voting_allowed + return head(:forbidden) unless @budget.balloting? + end + + def line_params + params.permit(:investment_id) + end + + def load_budget + @budget = Budget.find(params[:budget_id]) + end + + def load_ballot + @ballot = Budget::Ballot.where(user: current_user, budget: @budget).first_or_create + end + + def load_investment + @investment = Budget::Investment.find(params[:investment_id]) + end + + def load_investments + if params[:investments_ids].present? + @investments = Budget::Investment.where(id: params[:investments_ids]) + end + end + + def load_heading + @heading = @investment.heading + end + + end + end +end \ No newline at end of file diff --git a/app/controllers/budgets/ballots_controller.rb b/app/controllers/budgets/ballots_controller.rb new file mode 100644 index 000000000..3c163253d --- /dev/null +++ b/app/controllers/budgets/ballots_controller.rb @@ -0,0 +1,18 @@ +module Budgets + class BallotsController < ApplicationController + before_action :authenticate_user! + load_and_authorize_resource :budget + before_action :load_ballot + + def show + render template: "budgets/ballot/show" + end + + private + + def load_ballot + @ballot = Budget::Ballot.where(user: current_user, budget: @budget).first_or_create + end + + end +end \ No newline at end of file diff --git a/app/controllers/budgets/groups_controller.rb b/app/controllers/budgets/groups_controller.rb new file mode 100644 index 000000000..e55974a6a --- /dev/null +++ b/app/controllers/budgets/groups_controller.rb @@ -0,0 +1,10 @@ +module Budgets + class GroupsController < ApplicationController + load_and_authorize_resource :budget + load_and_authorize_resource :group, class: "Budget::Group" + + def show + end + + end +end \ No newline at end of file diff --git a/app/controllers/budgets/investments_controller.rb b/app/controllers/budgets/investments_controller.rb index 44e6efd73..fafea9734 100644 --- a/app/controllers/budgets/investments_controller.rb +++ b/app/controllers/budgets/investments_controller.rb @@ -99,7 +99,7 @@ module Budgets end def load_heading - @heading = @budget.headings.find(params[:heading_id]) if params[:geozone_id].present? + @heading = @budget.headings.find(params[:heading_id]) if params[:heading_id].present? end end diff --git a/app/helpers/ballots_helper.rb b/app/helpers/ballots_helper.rb new file mode 100644 index 000000000..ece1be9fa --- /dev/null +++ b/app/helpers/ballots_helper.rb @@ -0,0 +1,7 @@ +module BallotsHelper + + def progress_bar_width(amount_available, amount_spent) + (amount_spent/amount_available.to_f * 100).to_s + "%" + end + +end \ No newline at end of file diff --git a/app/helpers/budget_helper.rb b/app/helpers/budget_helper.rb index 8c19516e8..af239f074 100644 --- a/app/helpers/budget_helper.rb +++ b/app/helpers/budget_helper.rb @@ -20,4 +20,17 @@ module BudgetHelper budget_investment_path(investment, options) end end + + def display_budget_countdown?(budget) + budget.balloting? + end + + def css_for_ballot_heading(heading) + return '' unless current_ballot.present? + current_ballot.has_lines_in_heading?(heading) ? 'active' : '' + end + + def current_ballot + Budget::Ballot.where(user: current_user, budget: @budget).first + end end diff --git a/app/models/abilities/common.rb b/app/models/abilities/common.rb index fb03cbea2..fddf4918b 100644 --- a/app/models/abilities/common.rb +++ b/app/models/abilities/common.rb @@ -45,9 +45,10 @@ module Abilities can :vote, SpendingProposal can :create, SpendingProposal - can :create, Budget::Investment, budget: { phase: "accepting" } - can :vote, Budget::Investment, budget: { phase: "selecting" } - can :create, Budget::Ballot, budget: { phase: "balloting" } + can :create, Budget::Investment, budget: { phase: "accepting" } + can :vote, Budget::Investment, budget: { phase: "selecting" } + can [:show, :create], Budget::Ballot, budget: { phase: "balloting" } + can [:create, :destroy], Budget::Ballot::Line#, budget: { phase: "balloting" } can :create, DirectMessage can :show, DirectMessage, sender_id: user.id diff --git a/app/models/abilities/everyone.rb b/app/models/abilities/everyone.rb index 561ac5994..cf8af477b 100644 --- a/app/models/abilities/everyone.rb +++ b/app/models/abilities/everyone.rb @@ -6,13 +6,14 @@ module Abilities can [:read, :map], Debate can [:read, :map, :summary], Proposal can :read, Comment - can :read, Budget + can [:read, :welcome], Budget can :read, Budget::Investment can :read, SpendingProposal can :read, Legislation can :read, User can [:search, :read], Annotation can [:read], Budget + can [:read], Budget::Group can [:read], Budget::Investment can :new, DirectMessage end diff --git a/app/models/budget/ballot.rb b/app/models/budget/ballot.rb index 848e2f22d..fa7317dc8 100644 --- a/app/models/budget/ballot.rb +++ b/app/models/budget/ballot.rb @@ -5,6 +5,8 @@ class Budget has_many :lines, dependent: :destroy has_many :investments, through: :lines + has_many :groups, -> { uniq }, through: :lines + has_many :headings, -> { uniq }, through: :groups def add_investment(investment) lines.create!(budget: budget, investment: investment, heading: investment.heading, group_id: investment.heading.group_id) @@ -22,6 +24,10 @@ class Budget budget.heading_price(heading) - amount_spent(heading.id) end + def has_lines_in_group?(group) + self.groups.include?(group) + end + def valid_heading?(heading) group = heading.group return false if group.budget_id != budget_id @@ -40,8 +46,17 @@ class Budget self.heading_id.present? end + def has_lines_in_heading?(heading) + investments.by_heading(heading.id).any? + end + def has_investment?(investment) self.investment_ids.include?(investment.id) end + + def heading_for_group(group) + self.headings.where(group: group).first + end + end end diff --git a/app/models/budget/ballot/line.rb b/app/models/budget/ballot/line.rb index 8f0375a58..31cdcd230 100644 --- a/app/models/budget/ballot/line.rb +++ b/app/models/budget/ballot/line.rb @@ -13,15 +13,15 @@ class Budget #needed? validates :ballot_id, :budget_id, :group_id, :heading_id, :investment_id, presence: true def insufficient_funds - errors.add(:money, "") if ballot.amount_available(investment.heading) < investment.price.to_i + errors.add(:money, "insufficient funds") if ballot.amount_available(investment.heading) < investment.price.to_i end def different_geozone - errors.add(:heading, "") if (ballot.heading.present? && investment.heading != ballot.heading) + errors.add(:heading, "different heading assigned") if (ballot.heading.present? && investment.heading != ballot.heading) end def unfeasible - errors.add(:unfeasible, "") unless investment.feasible? + errors.add(:unfeasible, "unfeasible investment") unless investment.feasible? end def heading_proposal? diff --git a/app/models/budget/investment.rb b/app/models/budget/investment.rb index 56ae67d41..619602b2a 100644 --- a/app/models/budget/investment.rb +++ b/app/models/budget/investment.rb @@ -45,6 +45,7 @@ class Budget scope :undecided, -> { where(feasibility: "undecided") } scope :with_supports, -> { where('cached_votes_up > 0') } + scope :by_group, -> (group_id) { where(group_id: group_id) } scope :by_heading, -> (heading_id) { where(heading_id: heading_id) } scope :by_admin, -> (admin_id) { where(administrator_id: admin_id) } scope :by_tag, -> (tag_name) { tagged_with(tag_name) } diff --git a/app/views/budgets/ballots/_add.html.erb b/app/views/budgets/ballot/_add.html.erb similarity index 100% rename from app/views/budgets/ballots/_add.html.erb rename to app/views/budgets/ballot/_add.html.erb diff --git a/app/views/budgets/ballot/_ballot.html.erb b/app/views/budgets/ballot/_ballot.html.erb new file mode 100644 index 000000000..a6529306b --- /dev/null +++ b/app/views/budgets/ballot/_ballot.html.erb @@ -0,0 +1,55 @@ +
+ + <%= render 'shared/back_link' %> + +

<%= t("budgets.ballots.show.title") %>

+ +
+

+ <%= t("budgets.ballots.show.voted_html", + count: @ballot.investments.count) %> +

+

+ + <%= t("budgets.ballots.show.voted_info_html") %> + +

+
+
+ +
+ <% @ballot.groups.each do |group| %> +
+

+ <%= group.name %> - <%= group.headings.first.name %> +

+ <% if @ballot.has_lines_in_group?(group) %> +

+ <%= t("budgets.ballots.show.amount_spent") %> + + <%= format_price(@budget, @ballot.amount_spent(@ballot.heading_for_group(group).id)) %> + +

+ <% else %> +

+ <%= t("budgets.ballots.show.zero") %>
+ <%= link_to t("budgets.ballots.show.heading_link"), + budget_investments_path(budget, heading_id: heading.id), + data: { no_turbolink: true } %> +

+ <% end %> + +
    + <%= render partial: 'budgets/ballot/investment', + collection: @ballot.investments.by_group(group.id) %> +
+ +

+ <%= t("budgets.ballots.show.remaining", + amount_city: format_price(@budget, @ballot.amount_available(@ballot.heading_for_group(group)))).html_safe %> +

+
+ <% end %> +
+
\ No newline at end of file diff --git a/app/views/budgets/ballots/_investment.html.erb b/app/views/budgets/ballot/_investment.html.erb similarity index 59% rename from app/views/budgets/ballots/_investment.html.erb rename to app/views/budgets/ballot/_investment.html.erb index af78b4168..db30e4167 100644 --- a/app/views/budgets/ballots/_investment.html.erb +++ b/app/views/budgets/ballot/_investment.html.erb @@ -1,9 +1,9 @@
  • - <%= link_to investment.title, investment %> - <%= format_price(investment.price) %> + <%= link_to investment.title, budget_investment_path(@budget, investment) %> + <%= format_price(@budget, investment.price) %> <% if @budget.balloting? %> - <%= link_to ballot_line_path(id: investment.id), + <%= link_to budget_ballot_line_path(@budget, id: investment.id), title: t('budgets.ballots.show.remove'), class: "remove-investment-project", method: :delete, diff --git a/app/views/budgets/ballots/_investment_for_sidebar.html.erb b/app/views/budgets/ballot/_investment_for_sidebar.html.erb similarity index 64% rename from app/views/budgets/ballots/_investment_for_sidebar.html.erb rename to app/views/budgets/ballot/_investment_for_sidebar.html.erb index c229cc93b..d9b3d9e69 100644 --- a/app/views/budgets/ballots/_investment_for_sidebar.html.erb +++ b/app/views/budgets/ballot/_investment_for_sidebar.html.erb @@ -1,10 +1,10 @@
  • <%= investment.title %> - <%= format_price(investment.price) %> + <%= format_price(@budget, investment.price) %> <% if @budget.balloting? %> - <%= link_to ballot_line_path(id: investment.id, - investments_ids: investment_ids), + <%= link_to budget_ballot_line_url(id: investment.id, + investments_ids: investment_ids), title: t('budgets.ballots.show.remove'), class: "remove-investment-project", method: :delete, diff --git a/app/views/budgets/ballot/_progress_bar.html.erb b/app/views/budgets/ballot/_progress_bar.html.erb new file mode 100644 index 000000000..58214bbb3 --- /dev/null +++ b/app/views/budgets/ballot/_progress_bar.html.erb @@ -0,0 +1,28 @@ + + <%= format_price(@budget, @budget.heading_price(@heading)) %> + + +
    +
    +
    +
    + +
    + +

    + <%= format_price(@budget, @ballot.amount_spent(@heading.id)) %> + + <%= t("spending_proposals.index.available") %> + <%= format_price(@budget, @ballot.amount_available(@heading)) %> + +

    +
    +
    diff --git a/app/views/budgets/ballots/_remove.html.erb b/app/views/budgets/ballot/_remove.html.erb similarity index 82% rename from app/views/budgets/ballots/_remove.html.erb rename to app/views/budgets/ballot/_remove.html.erb index 5511e60c7..e789b0ae6 100644 --- a/app/views/budgets/ballots/_remove.html.erb +++ b/app/views/budgets/ballot/_remove.html.erb @@ -4,12 +4,12 @@

    - <%= format_price(investment.price) %> + <%= format_price(@budget, investment.price) %>

    <% if @budget.balloting? %> <%= link_to t('budgets.ballots.show.remove'), - ballot_line_path(id: investment.id, + budget_ballot_line_path(id: investment.id, investments_ids: investment_ids), class: "delete small expanded", method: :delete, diff --git a/app/views/budgets/ballot/lines/_refresh_ballots.js.erb b/app/views/budgets/ballot/lines/_refresh_ballots.js.erb new file mode 100644 index 000000000..69b5aae0b --- /dev/null +++ b/app/views/budgets/ballot/lines/_refresh_ballots.js.erb @@ -0,0 +1,5 @@ +<% if @investments.present? %> + <% @investments.each do |investment| %> + $("#<%= dom_id(investment) %>_ballot").html('<%= j render("budgets/investments/ballot", investment: investment) %>'); + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/budgets/ballot/lines/create.js.erb b/app/views/budgets/ballot/lines/create.js.erb new file mode 100644 index 000000000..5680fb063 --- /dev/null +++ b/app/views/budgets/ballot/lines/create.js.erb @@ -0,0 +1,5 @@ +$("#progress_bar").html('<%= j render("budgets/ballot/progress_bar", ballot: @ballot) %>'); +$("#sidebar").html('<%= j render("budgets/investments/sidebar") %>'); +$("#<%= dom_id(@investment) %>_ballot").html('<%= j render("budgets/investments/ballot", investment: @investment) %>'); + +<%= render 'refresh_ballots' %> diff --git a/app/views/budgets/ballot/lines/destroy.js.erb b/app/views/budgets/ballot/lines/destroy.js.erb new file mode 100644 index 000000000..aaa5ea302 --- /dev/null +++ b/app/views/budgets/ballot/lines/destroy.js.erb @@ -0,0 +1,6 @@ +$("#progress_bar").html('<%= j render("budgets/ballot/progress_bar", ballot: @ballot) %>'); +$("#sidebar").html('<%= j render("budgets/investments/sidebar") %>'); +$("#ballot").html('<%= j render("budgets/ballot/ballot") %>') +$("#<%= dom_id(@investment) %>_ballot").html('<%= j render("budgets/investments/ballot", investment: @investment) %>'); + +<%= render 'refresh_ballots' %> diff --git a/app/views/budgets/ballot/lines/new.js.erb b/app/views/budgets/ballot/lines/new.js.erb new file mode 100644 index 000000000..2e8254866 --- /dev/null +++ b/app/views/budgets/ballot/lines/new.js.erb @@ -0,0 +1,2 @@ +$("#<%= dom_id(@spending_proposal) %>_ballot").html('<%= j render("spending_proposals/ballot", spending_proposal: @spending_proposal) %>'); +$(".no-supports-allowed").show(); \ No newline at end of file diff --git a/app/views/budgets/ballot/show.html.erb b/app/views/budgets/ballot/show.html.erb new file mode 100644 index 000000000..b4aaa2d46 --- /dev/null +++ b/app/views/budgets/ballot/show.html.erb @@ -0,0 +1,3 @@ +
    + <%= render "budgets/ballot/ballot" %> +
    diff --git a/app/views/budgets/ballots/_ballot.html.erb b/app/views/budgets/ballots/_ballot.html.erb deleted file mode 100644 index a3b0d22f3..000000000 --- a/app/views/budgets/ballots/_ballot.html.erb +++ /dev/null @@ -1,94 +0,0 @@ -
    - - <%= render 'shared/back_link' %> - -

    <%= t("budgets.ballots.show.title") %>

    - -
    -

    - <%= t("budgets.ballots.show.voted_html", - count: @ballot.investments.count) %> -

    - - <% if @ballot.geozone.present? && district_wide_amount_spent(@ballot) > 0 %> - <%= social_share_button_tag("#{t('budgets.ballots.show.social_share', - amount: format_price(district_wide_amount_spent(@ballot)), - geozone: @ballot.geozone.name)} #{setting['twitter_hashtag']}", - url: participatory_budget_url) %> - <% end %> - -

    - <%= t("budgets.ballots.show.remaining_city_html", - amount_city: format_price(@ballot.amount_available(nil))) %> -

    - - <% if @ballot.geozone.present? %> -

    - <%= t("budgets.ballots.show.remaining_district_html", - amount_district: format_price(@ballot.amount_available(@ballot.geozone)), - geozone: @ballot.geozone.name) %> -

    - <% end %> - -

    - - <%= t("budgets.ballots.show.voted_info_html") %> - -

    -
    - -
    - -
    -
    -

    - <%= t("budgets.ballots.show.city_wide") %> -

    - <% if @ballot.investments.by_geozone(nil).count > 0 %> -

    - <%= t("budgets.ballots.show.amount_spent") %> - <%= format_price(city_wide_amount_spent(@ballot)) %> -

    - <% else %> -

    - <%= t("budgets.ballots.show.zero") %>
    - <%= link_to t("budgets.ballots.show.city_link"), - investments_path(geozone: 'all'), - data: { no_turbolink: true } %> -

    - <% end %> - -
      - <%= render partial: 'budgets/ballots/investment', - collection: @ballot.investments.no_heading %> -
    -
    - -
    -

    - <%= t("budgets.ballots.show.district_wide") %> - - <% if @ballot.geozone.present? %> - (<%= @ballot.geozone.name %>) - <% end %> - -

    - <% if @ballot.geozone.present? %> -

    - <%= t("budgets.ballots.show.amount_spent") %> - <%= format_price(district_wide_amount_spent(@ballot)) %> -

    - <% else %> -

    - <%= t("budgets.ballots.show.zero") %>
    - <%= link_to t("budgets.ballots.show.districts_link"), select_district_path %> -

    - <% end %> - -
      - <%= render partial: 'budgets/ballots/investment', - collection: @ballot.investments.with_heading %> -
    -
    -
    -
    diff --git a/app/views/budgets/ballots/show.html.erb b/app/views/budgets/ballots/show.html.erb deleted file mode 100644 index 393444368..000000000 --- a/app/views/budgets/ballots/show.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -
    - <%= render partial: "ballots/ballot" %> -
    diff --git a/app/views/budgets/groups/show.html.erb b/app/views/budgets/groups/show.html.erb new file mode 100644 index 000000000..0ae0a2a50 --- /dev/null +++ b/app/views/budgets/groups/show.html.erb @@ -0,0 +1,29 @@ +
    +
    + <%= link_to budget_path(@budget), class: "back" do %> + + <%= t('shared.back') %> + <% end %> + +

    <%# t("spending_proposals.welcome.districts") %>

    + +
    + <% @group.headings.each_slice(7) do |slice| %> +
    + <% slice.each do |heading| %> + + <%= link_to heading.name, + budget_investments_path(heading_id: heading.id), + data: { no_turbolink: true } %>
    +
    + <% end %> +
    + <% end %> +
    +
    + +
    + <%= image_tag "map.jpg" %> +
    +
    \ No newline at end of file diff --git a/app/views/budgets/investments/_ballot.html.erb b/app/views/budgets/investments/_ballot.html.erb index 6634ae1fa..b4aa8af97 100644 --- a/app/views/budgets/investments/_ballot.html.erb +++ b/app/views/budgets/investments/_ballot.html.erb @@ -1,9 +1,13 @@ <% reason = investment.reason_for_not_being_ballotable_by(current_user, @ballot) %>
    <% if @ballot.has_investment?(investment) %> - <%= render 'budgets/ballots/remove', investment: investment %> + <%= render 'budgets/ballot/remove', + investment: investment, + investment_ids: @investments %> <% else %> - <%= render 'budgets/ballots/add', investment: investment %> + <%= render 'budgets/ballot/add', + investment: investment, + investment_ids: @investments %> <% end %> <% if reason.present? && !@ballot.has_investment?(investment) %> @@ -14,7 +18,7 @@ verify_account: link_to(t("votes.verify_account"), verification_path), signin: link_to(t("votes.signin"), new_user_session_path), signup: link_to(t("votes.signup"), new_user_registration_path), - my_heading: link_to(@ballot.heading.try(:name), budget_investments_path(budget_id: @budget.id, heading_id: @ballot.heading_id)) + my_heading: link_to(@ballot.try(:heading).try(:name), budget_investments_path(budget_id: @budget.id, heading_id: @ballot.try(:heading_id))) ).html_safe %>

    diff --git a/app/views/budgets/investments/_header.html.erb b/app/views/budgets/investments/_header.html.erb index 4aa0b35f4..468d1b3c6 100644 --- a/app/views/budgets/investments/_header.html.erb +++ b/app/views/budgets/investments/_header.html.erb @@ -4,13 +4,15 @@
    - <%= link_to @budget, class: "back" do %> + <%= link_to budget_group_path(@budget, @heading.group), class: "back" do %> <%= t("shared.back") %> <% end %> <% if can? :show, @ballot %> - <%= link_to t("budget.investments.header.check_ballot"), budget_ballot_path(@budget, @ballot), class: "button float-right" %> + <%= link_to t("budget.investments.header.check_ballot"), + budget_ballot_path(@budget, @ballot), + class: "button float-right" %> <% end %>
    @@ -21,10 +23,15 @@

    <%= @filter_geozone_name %>

    - <% if @heading.present? && @ballot.heading.present? && @ballot.heading != @heading %> + <% if false + #@heading.present? && + #@ballot.heading.present? && + #@ballot.heading != @heading + %>

    <%= t("budget.investments.header.different_heading_active") %> @@ -32,7 +39,7 @@

    <% else %>
    - <%= render 'progress_bar' %> + <%= render 'budgets/ballot/progress_bar' %>
    <% end %> diff --git a/app/views/budgets/investments/_investment.html.erb b/app/views/budgets/investments/_investment.html.erb index 84f105c18..773f11929 100644 --- a/app/views/budgets/investments/_investment.html.erb +++ b/app/views/budgets/investments/_investment.html.erb @@ -43,18 +43,23 @@ <% unless investment.unfeasible? %> - <% if feature?("investment_features.phase2") %> + + <% if @budget.selecting? || @budget.on_hold? %> +
    <%= render 'votes', - { investment: investment, vote_url: vote_investment_path(investment, value: 'yes') } %> + { investment: investment, + vote_url: vote_budget_investment_path(@budget, investment, value: 'yes') } %>
    - <% elsif feature?("investment_features.phase3") %> + + <% elsif @budget.balloting? %>
    <%= render 'ballot', investment: investment %>
    <% end %> + <% end %> diff --git a/app/views/budgets/investments/_progress_bar.html.erb b/app/views/budgets/investments/_progress_bar.html.erb deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/views/budgets/investments/_sidebar.html.erb b/app/views/budgets/investments/_sidebar.html.erb index 53c5e98bc..d9981d6c7 100644 --- a/app/views/budgets/investments/_sidebar.html.erb +++ b/app/views/budgets/investments/_sidebar.html.erb @@ -13,7 +13,7 @@ <%= t("budget.investments.index.sidebar.voted_html", count: @ballot.investments.by_heading(@heading.id).count, - amount_spent: format_price(@ballot.amount_spent(@heading))) %> + amount_spent: format_price(@budget, @ballot.amount_spent(@heading))) %>

    <% else %> @@ -22,7 +22,9 @@ diff --git a/app/views/budgets/investments/_votes.html.erb b/app/views/budgets/investments/_votes.html.erb index 62ea74283..d243535d1 100644 --- a/app/views/budgets/investments/_votes.html.erb +++ b/app/views/budgets/investments/_votes.html.erb @@ -13,7 +13,7 @@
    <%= t("budget.investments.investment.already_supported") %>
    - <% elsif voting_allowed %> + <% elsif @budget.selecting? %> <%= link_to vote_url, class: "button button-support small expanded", diff --git a/app/views/budgets/investments/index.html.erb b/app/views/budgets/investments/index.html.erb index 1f587c5ca..1709f3fd8 100644 --- a/app/views/budgets/investments/index.html.erb +++ b/app/views/budgets/investments/index.html.erb @@ -7,7 +7,9 @@
    - <%= render 'header' %> + <% unless params[:search].present? %> + <%= render 'header' %> + <% end %>
    diff --git a/app/views/budgets/investments/show.html.erb b/app/views/budgets/investments/show.html.erb index 5a751e615..2488262f8 100644 --- a/app/views/budgets/investments/show.html.erb +++ b/app/views/budgets/investments/show.html.erb @@ -45,15 +45,19 @@
    <% if (@budget.selecting? && !@investment.unfeasible?) || - (@budget.balloting? && @investment.feasible?) %> + (@budget.balloting? && @investment.feasible? || + (@budget.on_hold?)) %>