Refactor process phases pages

This commit is contained in:
Amaia Castro
2017-01-04 11:27:47 +01:00
parent b6b33ff85b
commit 2b6df62dd7
11 changed files with 69 additions and 62 deletions

View File

@@ -8,18 +8,53 @@ class Legislation::ProcessesController < Legislation::BaseController
end
def show
if @process.show_phase?(:debate)
render :show
else
render :phase_not_open
end
end
def draft_publication
phase :draft_publication
if @process.show_phase?(@phase)
if draft_version = @process.draft_versions.published.last
redirect_to legislation_process_draft_version_path(@process, draft_version)
else
render :phase_empty
end
else
render :phase_not_open
end
end
def allegations
phase :allegations
if @process.show_phase?(@phase)
if draft_version = @process.draft_versions.published.last
redirect_to legislation_process_draft_version_path(@process, draft_version)
else
render :phase_empty
end
else
render :phase_not_open
end
end
def final_version_publication
phase :final_version_publication
if @process.show_phase?(@phase)
if final_version = @process.final_draft_version
redirect_to legislation_process_draft_version_path(@process, final_version)
else
render :phase_empty
end
else
render :phase_not_open
end
end
private
@@ -27,6 +62,5 @@ class Legislation::ProcessesController < Legislation::BaseController
def phase(phase)
@process = ::Legislation::Process.find(params[:process_id])
@phase = phase
render :phase
end
end

View File

@@ -1,9 +0,0 @@
<% if process.draft_versions.any? %>
<ul>
<% process.draft_versions.published.each do |draft_version| %>
<li><%= link_to draft_version.title, legislation_process_draft_version_path(process, draft_version) %></li>
<% end %>
</ul>
<% else %>
<p><%= t('.empty') %></p>
<% end %>

View File

@@ -1,9 +0,0 @@
<% if process.draft_versions.any? %>
<ul>
<% process.draft_versions.published.each do |draft_version| %>
<li><%= link_to draft_version.title, legislation_process_draft_version_path(process, draft_version) %></li>
<% end %>
</ul>
<% else %>
<p><%= t('.empty') %></p>
<% end %>

View File

@@ -1,5 +0,0 @@
<% if process.final_draft_version %>
<p><%= legislation_process_draft_version_path(process.final_draft_version) %></p>
<% else %>
<p><%= t('.empty') %></p>
<% end %>

View File

@@ -1,13 +0,0 @@
<div class="debate-draft">
<div class="small-12 medium-7 column">
<h3><%= t('.not_open') %></h3>
<p>Suscríbete al proceso para recibir un aviso en el momento en que se abra.</p>
</div>
<div class="small-12 medium-5 column">
<button class="button-subscribe expanded button strong" title="Suscríbete al proceso" data-remote="true" rel="nofollow" data-method="post" href="/proposals/6-soluta-sed-sapiente-dolores/vote?value=yes">
<h3>Suscríbete al proceso</h3>
<p>Recibe notificaciones clave sobre el proceso</p>
</button>
</div>
</div>

View File

@@ -7,11 +7,7 @@
<div class="debate-chooser">
<div class="row">
<% if @process.show_phase?(@phase) %>
<%= render "phase_#{@phase}", process: @process %>
<% else %>
<%= render 'legislation/processes/phase_not_open' %>
<% end %>
<p><%= t(".empty") %></p>
</div>
</div>
</div>

View File

@@ -0,0 +1,25 @@
<% provide :title do %><%= @process.title %><% end %>
<%= render 'legislation/processes/header_full', process: @process %>
<div class="row">
<%= render 'legislation/processes/key_dates', process: @process, phase: @phase %>
<div class="debate-chooser">
<div class="row">
<div class="debate-draft">
<div class="small-12 medium-7 column">
<h3><%= t('.not_open') %></h3>
<p>Suscríbete al proceso para recibir un aviso en el momento en que se abra.</p>
</div>
<div class="small-12 medium-5 column">
<button class="button-subscribe expanded button strong" title="Suscríbete al proceso" data-remote="true" rel="nofollow" data-method="post" href="/proposals/6-soluta-sed-sapiente-dolores/vote?value=yes">
<h3>Suscríbete al proceso</h3>
<p>Recibe notificaciones clave sobre el proceso</p>
</button>
</div>
</div>
</div>
</div>
</div>

View File

@@ -7,11 +7,7 @@
<div class="debate-chooser">
<div class="row">
<% if @process.show_phase?(:debate) %>
<%= render 'debate', process: @process %>
<% else %>
<%= render 'phase_not_open' %>
<% end %>
</div>
</div>
</div>

View File

@@ -256,12 +256,8 @@ en:
past: Past
phase_not_open:
not_open: This phase is not open yet
phase_draft_publication:
empty: There are no drafts published
phase_allegations:
empty: There are no drafts published
phase_final_version_publication:
empty: Results have not been published yet
phase_empty:
empty: Nothing published yet
process:
see_latest_comments: See latest comments
see_latest_comments_title: Comment on this process

View File

@@ -256,12 +256,8 @@ es:
past: Terminados
phase_not_open:
not_open: Esta fase del proceso todavía no está abierta
phase_draft_publication:
empty: No se ha publicado ningún borrador
phase_allegations:
empty: No se ha publicado ningún borrador
phase_final_version_publication:
empty: No se ha publicado el resultado todavía
phase_empty:
empty: No hay nada publicado todavía
process:
see_latest_comments: Ver últimas aportaciones
see_latest_comments_title: Aportar a este proceso

View File

@@ -69,7 +69,7 @@ feature 'Legislation' do
visit legislation_process_draft_publication_path(process)
expect(page).to have_content("There are no drafts published")
expect(page).to have_content("Nothing published yet")
end
end
@@ -87,7 +87,7 @@ feature 'Legislation' do
visit legislation_process_allegations_path(process)
expect(page).to have_content("There are no drafts published")
expect(page).to have_content("Nothing published yet")
end
end
@@ -105,7 +105,7 @@ feature 'Legislation' do
visit legislation_process_final_version_publication_path(process)
expect(page).to have_content("Results have not been published yet")
expect(page).to have_content("Nothing published yet")
end
end
end