From bf3e301bb181adb3497dc618957c092b5918a398 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 6 Mar 2017 12:29:13 +0100 Subject: [PATCH 1/2] changes button text depending of poll status --- app/views/polls/_poll_group.html.erb | 10 +++++++++- config/locales/en.yml | 2 ++ config/locales/es.yml | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/views/polls/_poll_group.html.erb b/app/views/polls/_poll_group.html.erb index 6595e3721..f4dcc5423 100644 --- a/app/views/polls/_poll_group.html.erb +++ b/app/views/polls/_poll_group.html.erb @@ -60,7 +60,15 @@
- <%= link_to t("polls.index.participate_button"), poll, class: "button expanded" %> + <%= link_to poll, class: "button expanded" do %> + <% if poll.expired? %> + <%= t("polls.index.participate_button_expired") %> + <% elsif poll.incoming? %> + <%= t("polls.index.participate_button_incoming") %> + <% else %> + <%= t("polls.index.participate_button") %> + <% end %> + <% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index 9697cb913..bc676128d 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -403,6 +403,8 @@ en: expired: "Expired" title: "Polls" participate_button: "Participate in this poll" + participate_button_incoming: "More information" + participate_button_expired: "Poll ended" no_geozone_restricted: "All city" geozone_restricted: "Districts" geozone_info: "Can participate people in the Census of: " diff --git a/config/locales/es.yml b/config/locales/es.yml index fc4b87029..cae74281d 100755 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -403,6 +403,8 @@ es: expired: "Terminadas" title: "Votaciones" participate_button: "Participar en esta votación" + participate_button_incoming: "Más información" + participate_button_expired: "Votación terminada" no_geozone_restricted: "Toda la ciudad" geozone_restricted: "Distritos" geozone_info: "Pueden participar las personas empadronadas en: " From fa976d7b0590714595912c24de729e91b61ef022 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Mon, 6 Mar 2017 12:29:49 +0100 Subject: [PATCH 2/2] adds texts on specs --- spec/features/polls/polls_spec.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/features/polls/polls_spec.rb b/spec/features/polls/polls_spec.rb index fe5957181..047c71146 100644 --- a/spec/features/polls/polls_spec.rb +++ b/spec/features/polls/polls_spec.rb @@ -22,18 +22,21 @@ feature 'Polls' do visit polls_path expect(page).to have_content('Current poll') + expect(page).to have_link('Participate in this poll') expect(page).to_not have_content('Incoming poll') expect(page).to_not have_content('Expired poll') visit polls_path(filter: 'incoming') expect(page).to_not have_content('Current poll') expect(page).to have_content('Incoming poll') + expect(page).to have_link('More information') expect(page).to_not have_content('Expired poll') visit polls_path(filter: 'expired') expect(page).to_not have_content('Current poll') expect(page).to_not have_content('Incoming poll') expect(page).to have_content('Expired poll') + expect(page).to have_link('Poll ended') end scenario "Current filter is properly highlighted" do