From 0c5063add9daec0402d2abcfb5aa18085da5685a Mon Sep 17 00:00:00 2001 From: Fernando Blat Date: Thu, 5 Jan 2017 09:36:08 +0100 Subject: [PATCH] Show message when there aren't processes --- app/views/legislation/processes/index.html.erb | 8 ++++++-- config/locales/en.yml | 3 +++ config/locales/es.yml | 3 +++ spec/features/legislation/processes_spec.rb | 11 +++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/views/legislation/processes/index.html.erb b/app/views/legislation/processes/index.html.erb index 1400f7854..1d2e6caa3 100644 --- a/app/views/legislation/processes/index.html.erb +++ b/app/views/legislation/processes/index.html.erb @@ -19,8 +19,12 @@
- <%= render @processes %> - <%= paginate @processes %> + <% if @processes.any? %> + <%= render @processes %> + <%= paginate @processes %> + <% else %> + <%= t(".no_#{@current_filter}_processes") %> + <% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index 0e1a2c829..f192a441c 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -254,6 +254,9 @@ en: open: Open processes next: Next past: Past + no_open_processes: There aren't open processes + no_next_processes: There aren't planned processes + no_past_processes: There aren't past processes phase_not_open: not_open: This phase is not open yet phase_empty: diff --git a/config/locales/es.yml b/config/locales/es.yml index 3459f3494..eabc14e48 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -254,6 +254,9 @@ es: open: Procesos activos next: Próximamente past: Terminados + no_open_processes: No hay procesos activos + no_next_processes: No hay procesos planeados + no_past_processes: No hay procesos terminados phase_not_open: not_open: Esta fase del proceso todavía no está abierta phase_empty: diff --git a/spec/features/legislation/processes_spec.rb b/spec/features/legislation/processes_spec.rb index 8ae51c559..66356dff8 100644 --- a/spec/features/legislation/processes_spec.rb +++ b/spec/features/legislation/processes_spec.rb @@ -4,6 +4,17 @@ feature 'Legislation' do context 'processes home page' do + scenario 'Processes can be listed' do + visit legislation_processes_path + expect(page).to have_text "There aren't open processes" + + visit legislation_processes_path(filter: 'next') + expect(page).to have_text "There aren't planned processes" + + visit legislation_processes_path(filter: 'past') + expect(page).to have_text "There aren't past processes" + end + scenario 'Processes can be listed' do processes = create_list(:legislation_process, 3)