Shows message only if there is questions on legislation debate

This commit is contained in:
decabeza
2018-03-22 12:15:59 +01:00
parent 56f64779ba
commit b93543cbf9
3 changed files with 32 additions and 13 deletions

View File

@@ -1,15 +1,17 @@
<div class="small-12 medium-9 column">
<div class="debate-list">
<% if process.questions.empty? %>
<p><%= t('.empty_questions') %></p>
<p><%= t("legislation.processes.debate.empty_questions") %></p>
<% else %>
<%= render process.questions %>
<% end %>
</div>
</div>
<div class="small-12 medium-3 column">
<div class="callout success">
<p><%= t('.participate') %></p>
<% if process.questions.any? %>
<div class="small-12 medium-3 column">
<div class="callout success">
<p><%= t("legislation.processes.debate.participate") %></p>
</div>
</div>
</div>
<% end %>

View File

@@ -13,7 +13,7 @@
<div class="debate-list">
<% if @process.questions.empty? %>
<div class="callout primary">
<p><%= t('.empty_questions') %></p>
<p><%= t("legislation.processes.debate.empty_questions") %></p>
</div>
<% else %>
<%= render @process.questions %>
@@ -21,11 +21,13 @@
</div>
</div>
<div class="small-12 medium-3 column">
<div class="callout success">
<p><%= t('.participate') %></p>
<% if @process.questions.any? %>
<div class="small-12 medium-3 column">
<div class="callout success">
<p><%= t("legislation.processes.debate.participate") %></p>
</div>
</div>
</div>
<% end %>
</div>
</div>
</div>

View File

@@ -149,15 +149,30 @@ feature 'Legislation' do
visit legislation_process_path(process)
expect(page).to have_content("This phase is not open yet")
expect(page).to have_content("This phase is not open yet")
expect(page).to_not have_content("Participate in the debate")
end
scenario 'open' do
scenario 'open without questions' do
process = create(:legislation_process, debate_start_date: Date.current - 1.day, debate_end_date: Date.current + 2.days)
visit legislation_process_path(process)
expect(page).to have_content("Participate in the debate")
expect(page).to_not have_content("Participate in the debate")
expect(page).to_not have_content("This phase is not open yet")
end
scenario 'open with questions' do
process = create(:legislation_process, debate_start_date: Date.current - 1.day, debate_end_date: Date.current + 2.days)
create(:legislation_question, process: process, title: "Question 1")
create(:legislation_question, process: process, title: "Question 2")
visit legislation_process_path(process)
expect(page).to have_content("Question 1")
expect(page).to have_content("Question 2")
expect(page).to have_content("Participate in the debate")
expect(page).to_not have_content("This phase is not open yet")
end
include_examples "not published permissions", :debate_legislation_process_path