Hides balloting controls when not in the balloting phase

This commit is contained in:
kikito
2017-01-05 15:17:49 +01:00
parent a5b4a79f62
commit 28e6a10382
5 changed files with 61 additions and 30 deletions

View File

@@ -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),

View File

@@ -21,12 +21,11 @@
<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 %>
<% if can? :show, @ballot %>
<div id="check-ballot" style="display: none;">
<%= link_to t("budget.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' %>
@@ -41,6 +40,9 @@
) %>
</p>
<% end %>
<% else %>
<%= @budget.formatted_heading_price(@heading) %>
<% end %>
</div>
</div>
</div>

View File

@@ -1,6 +1,6 @@
<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" %>
<% else %>
@@ -11,29 +11,33 @@
<% 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 %>
<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("budget.investments.index.sidebar.my_ballot") %></h2>
<% if @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 %>
</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("budget.investments.index.sidebar.voted_info") %></p>
<% end %>

View File

@@ -17,7 +17,7 @@
<%= t("budgets.phases.#{@budget.phase}") %>
</p>
<% 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(@budget), class: "button margin-top" %>
<% else %>