Define some actions on legislation processes as member actions
This commit is contained in:
@@ -13,14 +13,13 @@ class Legislation::ProcessesController < Legislation::BaseController
|
||||
if @process.allegations_phase.enabled? && @process.allegations_phase.started? && draft_version.present?
|
||||
redirect_to legislation_process_draft_version_path(@process, draft_version)
|
||||
elsif @process.debate_phase.enabled?
|
||||
redirect_to legislation_process_debate_path(@process)
|
||||
redirect_to debate_legislation_process_path(@process)
|
||||
else
|
||||
redirect_to legislation_process_allegations_path(@process)
|
||||
redirect_to allegations_legislation_process_path(@process)
|
||||
end
|
||||
end
|
||||
|
||||
def debate
|
||||
set_process
|
||||
@phase = :debate_phase
|
||||
|
||||
if @process.debate_phase.started?
|
||||
@@ -31,7 +30,6 @@ class Legislation::ProcessesController < Legislation::BaseController
|
||||
end
|
||||
|
||||
def draft_publication
|
||||
set_process
|
||||
@phase = :draft_publication
|
||||
|
||||
if @process.draft_publication.started?
|
||||
@@ -48,7 +46,6 @@ class Legislation::ProcessesController < Legislation::BaseController
|
||||
end
|
||||
|
||||
def allegations
|
||||
set_process
|
||||
@phase = :allegations_phase
|
||||
|
||||
if @process.allegations_phase.started?
|
||||
@@ -65,7 +62,6 @@ class Legislation::ProcessesController < Legislation::BaseController
|
||||
end
|
||||
|
||||
def result_publication
|
||||
set_process
|
||||
@phase = :result_publication
|
||||
|
||||
if @process.result_publication.started?
|
||||
@@ -81,9 +77,5 @@ class Legislation::ProcessesController < Legislation::BaseController
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_process
|
||||
@process = ::Legislation::Process.find(params[:process_id])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<ul>
|
||||
<% if process.debate_phase.enabled? %>
|
||||
<li <%= "class=active" if phase == :debate_phase %>>
|
||||
<%= link_to legislation_process_debate_path(process) do %>
|
||||
<%= link_to debate_legislation_process_path(process) do %>
|
||||
<h4><%= t('legislation.processes.shared.debate_dates') %></h4>
|
||||
<p><%= format_date(process.debate_start_date) %> - <%= format_date(process.debate_end_date) %></p>
|
||||
<% end %>
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<% if process.draft_publication.enabled? %>
|
||||
<li <%= "class=active" if phase == :draft_publication %>>
|
||||
<%= link_to legislation_process_draft_publication_path(process) do %>
|
||||
<%= link_to draft_publication_legislation_process_path(process) do %>
|
||||
<h4><%= t('legislation.processes.shared.draft_publication_date') %></h4>
|
||||
<p><%= format_date(process.draft_publication_date) %></p>
|
||||
<% end %>
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
<% if process.allegations_phase.enabled? %>
|
||||
<li <%= "class=active" if phase == :allegations_phase %>>
|
||||
<%= link_to legislation_process_allegations_path(process) do %>
|
||||
<%= link_to allegations_legislation_process_path(process) do %>
|
||||
<h4><%= t('legislation.processes.shared.allegations_dates') %></h4>
|
||||
<p><%= format_date(process.allegations_start_date) %> - <%= format_date(process.allegations_end_date) %></p>
|
||||
<% end %>
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
<% if process.result_publication.enabled? %>
|
||||
<li <%= "class=active" if phase == :result_publication %>>
|
||||
<%= link_to legislation_process_result_publication_path(process) do %>
|
||||
<%= link_to result_publication_legislation_process_path(process) do %>
|
||||
<h4><%= t('legislation.processes.shared.result_publication_date') %></h4>
|
||||
<p><%= format_date(process.result_publication_date) %></p>
|
||||
<% end %>
|
||||
|
||||
@@ -109,10 +109,12 @@ Rails.application.routes.draw do
|
||||
|
||||
namespace :legislation do
|
||||
resources :processes, only: [:index, :show] do
|
||||
get :debate
|
||||
get :draft_publication
|
||||
get :allegations
|
||||
get :result_publication
|
||||
member do
|
||||
get :debate
|
||||
get :draft_publication
|
||||
get :allegations
|
||||
get :result_publication
|
||||
end
|
||||
resources :questions, only: [:show] do
|
||||
resources :answers, only: [:create]
|
||||
end
|
||||
|
||||
@@ -70,7 +70,7 @@ feature 'Legislation' do
|
||||
scenario 'not open' do
|
||||
process = create(:legislation_process, draft_publication_date: Date.current + 1.day)
|
||||
|
||||
visit legislation_process_draft_publication_path(process)
|
||||
visit draft_publication_legislation_process_path(process)
|
||||
|
||||
expect(page).to have_content("This phase is not open yet")
|
||||
end
|
||||
@@ -78,7 +78,7 @@ feature 'Legislation' do
|
||||
scenario 'open' do
|
||||
process = create(:legislation_process, draft_publication_date: Date.current)
|
||||
|
||||
visit legislation_process_draft_publication_path(process)
|
||||
visit draft_publication_legislation_process_path(process)
|
||||
|
||||
expect(page).to have_content("Nothing published yet")
|
||||
end
|
||||
@@ -88,7 +88,7 @@ feature 'Legislation' do
|
||||
scenario 'not open' do
|
||||
process = create(:legislation_process, allegations_start_date: Date.current + 1.day, allegations_end_date: Date.current + 2.days)
|
||||
|
||||
visit legislation_process_allegations_path(process)
|
||||
visit allegations_legislation_process_path(process)
|
||||
|
||||
expect(page).to have_content("This phase is not open yet")
|
||||
end
|
||||
@@ -96,7 +96,7 @@ feature 'Legislation' do
|
||||
scenario 'open' do
|
||||
process = create(:legislation_process, allegations_start_date: Date.current - 1.day, allegations_end_date: Date.current + 2.days)
|
||||
|
||||
visit legislation_process_allegations_path(process)
|
||||
visit allegations_legislation_process_path(process)
|
||||
|
||||
expect(page).to have_content("Nothing published yet")
|
||||
end
|
||||
@@ -106,7 +106,7 @@ feature 'Legislation' do
|
||||
scenario 'not open' do
|
||||
process = create(:legislation_process, result_publication_date: Date.current + 1.day)
|
||||
|
||||
visit legislation_process_result_publication_path(process)
|
||||
visit result_publication_legislation_process_path(process)
|
||||
|
||||
expect(page).to have_content("This phase is not open yet")
|
||||
end
|
||||
@@ -114,7 +114,7 @@ feature 'Legislation' do
|
||||
scenario 'open' do
|
||||
process = create(:legislation_process, result_publication_date: Date.current)
|
||||
|
||||
visit legislation_process_result_publication_path(process)
|
||||
visit result_publication_legislation_process_path(process)
|
||||
|
||||
expect(page).to have_content("Nothing published yet")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user