Merge pull request #1336 from aspgems/bug_filter_advance_search

Fixes values of official_level options for selects in search filters.
This commit is contained in:
Juanjo Bazán
2017-01-13 11:00:00 +01:00
committed by GitHub
7 changed files with 19 additions and 44 deletions

View File

@@ -1,12 +1,7 @@
module SearchHelper
def official_level_search_options
options_for_select([
[t("shared.advanced_search.author_type_1"), 1],
[t("shared.advanced_search.author_type_2"), 2],
[t("shared.advanced_search.author_type_3"), 3],
[t("shared.advanced_search.author_type_4"), 4],
[t("shared.advanced_search.author_type_5"), 5]],
options_for_select((1..5).map{ |i| [setting["official_level_#{i}_name"], i] },
params[:advanced_search].try(:[], :official_level))
end

View File

@@ -414,11 +414,6 @@ en:
advanced_search:
author_type: 'By author category'
author_type_blank: 'Select a category'
author_type_1: 'Public employee'
author_type_2: 'Municipal Organization'
author_type_3: 'General director'
author_type_4: 'City councillor'
author_type_5: 'Mayoress'
date: 'By date'
date_placeholder: 'DD/MM/YYYY'
date_range_blank: 'Choose a date'

View File

@@ -414,11 +414,6 @@ es:
advanced_search:
author_type: 'Por categoría de autor'
author_type_blank: 'Elige una categoría'
author_type_1: 'Empleado público'
author_type_2: 'Organización Municipal'
author_type_3: 'Director general'
author_type_4: 'Concejal'
author_type_5: 'Alcaldesa'
date: 'Por fecha'
date_placeholder: 'DD/MM/AAAA'
date_range_blank: 'Elige una fecha'

View File

@@ -1361,11 +1361,6 @@ fr:
shared:
advanced_search:
author_type: Par catégorie d'auteur
author_type_1: Fonctionnaire
author_type_2: Organisation municipale
author_type_3: Directeur général
author_type_4: Conseiller municipal
author_type_5: Maire
author_type_blank: Sélectionner une catégorie
date: Par date
date_1: Dernières 24 heures

View File

@@ -1383,11 +1383,6 @@ pt-BR:
shared:
advanced_search:
author_type: Por categoria de autor
author_type_1: Servidor público
author_type_2: Organização municipal
author_type_3: Diretor geral
author_type_4: Conselheiro municipal
author_type_5: Prefeita
author_type_blank: Selecione um categoria
date: Por data
date_1: "Últimas 24 horas"

View File

@@ -426,7 +426,7 @@ feature 'Debates' do
visit debates_path
click_link "Advanced search"
select "Public employee", from: "advanced_search_official_level"
select Setting['official_level_1_name'], from: "advanced_search_official_level"
click_button "Filter"
expect(page).to have_content("There are 2 debates")
@@ -449,7 +449,7 @@ feature 'Debates' do
visit debates_path
click_link "Advanced search"
select "Municipal Organization", from: "advanced_search_official_level"
select Setting['official_level_2_name'], from: "advanced_search_official_level"
click_button "Filter"
expect(page).to have_content("There are 2 debates")
@@ -472,7 +472,7 @@ feature 'Debates' do
visit debates_path
click_link "Advanced search"
select "General director", from: "advanced_search_official_level"
select Setting['official_level_3_name'], from: "advanced_search_official_level"
click_button "Filter"
expect(page).to have_content("There are 2 debates")
@@ -495,7 +495,7 @@ feature 'Debates' do
visit debates_path
click_link "Advanced search"
select "City councillor", from: "advanced_search_official_level"
select Setting['official_level_4_name'], from: "advanced_search_official_level"
click_button "Filter"
expect(page).to have_content("There are 2 debates")
@@ -518,7 +518,7 @@ feature 'Debates' do
visit debates_path
click_link "Advanced search"
select "Mayoress", from: "advanced_search_official_level"
select Setting['official_level_5_name'], from: "advanced_search_official_level"
click_button "Filter"
expect(page).to have_content("There are 2 debates")
@@ -652,7 +652,7 @@ feature 'Debates' do
click_link "Advanced search"
fill_in "Write the text", with: "Schwifty"
select "Public employee", from: "advanced_search_official_level"
select Setting['official_level_1_name'], from: "advanced_search_official_level"
select "Last 24 hours", from: "js-advanced-search-date-min"
click_button "Filter"
@@ -668,14 +668,14 @@ feature 'Debates' do
click_link "Advanced search"
fill_in "Write the text", with: "Schwifty"
select "Public employee", from: "advanced_search_official_level"
select Setting['official_level_1_name'], from: "advanced_search_official_level"
select "Last 24 hours", from: "js-advanced-search-date-min"
click_button "Filter"
within "#js-advanced-search" do
expect(page).to have_selector("input[name='search'][value='Schwifty']")
expect(page).to have_select('advanced_search[official_level]', selected: 'Public employee')
expect(page).to have_select('advanced_search[official_level]', selected: Setting['official_level_1_name'])
expect(page).to have_select('advanced_search[date_min]', selected: 'Last 24 hours')
end
end

View File

@@ -766,7 +766,7 @@ feature 'Proposals' do
visit proposals_path
click_link "Advanced search"
select "Public employee", from: "advanced_search_official_level"
select Setting['official_level_1_name'], from: "advanced_search_official_level"
click_button "Filter"
expect(page).to have_content("There are 2 citizen proposals")
@@ -789,7 +789,7 @@ feature 'Proposals' do
visit proposals_path
click_link "Advanced search"
select "Municipal Organization", from: "advanced_search_official_level"
select Setting['official_level_2_name'], from: "advanced_search_official_level"
click_button "Filter"
expect(page).to have_content("There are 2 citizen proposals")
@@ -812,7 +812,7 @@ feature 'Proposals' do
visit proposals_path
click_link "Advanced search"
select "General director", from: "advanced_search_official_level"
select Setting['official_level_3_name'], from: "advanced_search_official_level"
click_button "Filter"
expect(page).to have_content("There are 2 citizen proposals")
@@ -835,7 +835,7 @@ feature 'Proposals' do
visit proposals_path
click_link "Advanced search"
select "City councillor", from: "advanced_search_official_level"
select Setting['official_level_4_name'], from: "advanced_search_official_level"
click_button "Filter"
expect(page).to have_content("There are 2 citizen proposals")
@@ -858,7 +858,7 @@ feature 'Proposals' do
visit proposals_path
click_link "Advanced search"
select "Mayoress", from: "advanced_search_official_level"
select Setting['official_level_5_name'], from: "advanced_search_official_level"
click_button "Filter"
expect(page).to have_content("There are 2 citizen proposals")
@@ -992,7 +992,7 @@ feature 'Proposals' do
click_link "Advanced search"
fill_in "Write the text", with: "Schwifty"
select "Public employee", from: "advanced_search_official_level"
select Setting['official_level_1_name'], from: "advanced_search_official_level"
select "Last 24 hours", from: "js-advanced-search-date-min"
click_button "Filter"
@@ -1009,7 +1009,7 @@ feature 'Proposals' do
click_link "Advanced search"
fill_in "Write the text", with: "Schwifty"
select "Public employee", from: "advanced_search_official_level"
select Setting['official_level_1_name'], from: "advanced_search_official_level"
select "Last 24 hours", from: "js-advanced-search-date-min"
click_button "Filter"
@@ -1018,7 +1018,7 @@ feature 'Proposals' do
within "#js-advanced-search" do
expect(page).to have_selector("input[name='search'][value='Schwifty']")
expect(page).to have_select('advanced_search[official_level]', selected: 'Public employee')
expect(page).to have_select('advanced_search[official_level]', selected: Setting['official_level_1_name'])
expect(page).to have_select('advanced_search[date_min]', selected: 'Last 24 hours')
end
end