renames html ids that have js behaviour
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
App.AdvancedSearch =
|
||||
|
||||
advanced_search_terms: ->
|
||||
$('#advanced-search').data('advanced-search-terms')
|
||||
$('#js-advanced-search').data('advanced-search-terms')
|
||||
|
||||
decorate_link: (id) ->
|
||||
$('.advanced-search-title').addClass 'blue'
|
||||
@@ -10,19 +10,19 @@ App.AdvancedSearch =
|
||||
$('.advanced-search-title').removeClass 'blue'
|
||||
|
||||
toggle_form: ->
|
||||
$('#advanced-search').slideToggle()
|
||||
$('#js-advanced-search').slideToggle()
|
||||
|
||||
toggle_date_options: ->
|
||||
if $('#advanced_search_date_min').val() == 'custom'
|
||||
$('.customized-date').show()
|
||||
$('.customized-date input').prop 'disabled', false
|
||||
if $('#js-advanced-search-date-min').val() == 'custom'
|
||||
$('#js-customized-date').show()
|
||||
$('#js-customized-date input').prop 'disabled', false
|
||||
else
|
||||
$('.customized-date').hide()
|
||||
$('.customized-date input').prop 'disabled', true
|
||||
$('#js-customized-date').hide()
|
||||
$('#js-customized-date input').prop 'disabled', true
|
||||
|
||||
initialize: ->
|
||||
if App.AdvancedSearch.advanced_search_terms()
|
||||
$('#advanced-search').show()
|
||||
$('#js-advanced-search').show()
|
||||
App.AdvancedSearch.toggle_date_options()
|
||||
|
||||
$('.advanced-search-title').on
|
||||
@@ -33,6 +33,6 @@ App.AdvancedSearch =
|
||||
mouseleave: ->
|
||||
App.AdvancedSearch.undecorate_link()
|
||||
|
||||
$('#advanced_search_date_min').on
|
||||
$('#js-advanced-search-date-min').on
|
||||
change: ->
|
||||
App.AdvancedSearch.toggle_date_options()
|
||||
@@ -3,7 +3,7 @@
|
||||
</div>
|
||||
|
||||
<%= form_tag search_path, method: :get do %>
|
||||
<div id='advanced-search'
|
||||
<div id='js-advanced-search'
|
||||
data-advanced-search-terms=<%= @advanced_search_terms.present? %>
|
||||
style="display: none">
|
||||
|
||||
@@ -28,9 +28,10 @@
|
||||
<div class="small-12 advanced-search columns">
|
||||
<h5 class='search-option'><%= t("shared.advanced_search.date") %></h5>
|
||||
<%= select_tag('advanced_search[date_min]', date_range_options,
|
||||
include_blank: t("shared.advanced_search.date_range_blank")) %>
|
||||
include_blank: t("shared.advanced_search.date_range_blank"),
|
||||
id: 'js-advanced-search-date-min') %>
|
||||
|
||||
<div class='customized-date inline-block' style="display: none">
|
||||
<div id='js-customized-date' class='inline-block' style="display: none">
|
||||
|
||||
<%= t("shared.advanced_search.from") %>:
|
||||
<div class='inline-block'>
|
||||
|
||||
@@ -570,7 +570,7 @@ feature 'Debates' do
|
||||
visit debates_path
|
||||
|
||||
find("h4.advanced-search-title").click
|
||||
select "Last 24 hours", from: "advanced_search_date_min"
|
||||
select "Last 24 hours", from: "js-advanced-search-date-min"
|
||||
click_button "Filter"
|
||||
|
||||
within("#debates") do
|
||||
@@ -590,7 +590,7 @@ feature 'Debates' do
|
||||
visit debates_path
|
||||
|
||||
find("h4.advanced-search-title").click
|
||||
select "Customized", from: "advanced_search_date_min"
|
||||
select "Customized", from: "js-advanced-search-date-min"
|
||||
fill_in "advanced_search_date_min", with: 7.days.ago
|
||||
fill_in "advanced_search_date_max", with: 1.days.ago
|
||||
click_button "Filter"
|
||||
@@ -618,7 +618,7 @@ feature 'Debates' do
|
||||
fill_in "Write the text", with: "Schwifty"
|
||||
fill_in "Write the author name", with: "Ana06"
|
||||
select "Public employee", from: "advanced_search_official_level"
|
||||
select "Last 24 hours", from: "advanced_search_date_min"
|
||||
select "Last 24 hours", from: "js-advanced-search-date-min"
|
||||
|
||||
click_button "Filter"
|
||||
|
||||
@@ -635,11 +635,11 @@ feature 'Debates' do
|
||||
fill_in "Write the text", with: "Schwifty"
|
||||
fill_in "Write the author name", with: "Ana06"
|
||||
select "Public employee", from: "advanced_search_official_level"
|
||||
select "Last 24 hours", from: "advanced_search_date_min"
|
||||
select "Last 24 hours", from: "js-advanced-search-date-min"
|
||||
|
||||
click_button "Filter"
|
||||
|
||||
within "#advanced-search" do
|
||||
within "#js-advanced-search" do
|
||||
expect(page).to have_selector("input[name='search'][value='Schwifty']")
|
||||
expect(page).to have_selector("input[name='advanced_search[author]'][value='Ana06']")
|
||||
expect(page).to have_select('advanced_search[official_level]', selected: 'Public employee')
|
||||
@@ -651,12 +651,12 @@ feature 'Debates' do
|
||||
visit debates_path
|
||||
find("h4.advanced-search-title").click
|
||||
|
||||
select "Customized", from: "advanced_search_date_min"
|
||||
select "Customized", from: "js-advanced-search-date-min"
|
||||
fill_in "advanced_search_date_min", with: 7.days.ago
|
||||
fill_in "advanced_search_date_max", with: 1.days.ago
|
||||
click_button "Filter"
|
||||
|
||||
within "#advanced-search" do
|
||||
within "#js-advanced-search" do
|
||||
expect(page).to have_select('advanced_search[date_min]', selected: 'Customized')
|
||||
expect(page).to have_selector("input[name='advanced_search[date_min]'][value*='#{7.days.ago.strftime('%Y-%m-%d')}']")
|
||||
expect(page).to have_selector("input[name='advanced_search[date_max]'][value*='#{1.day.ago.strftime('%Y-%m-%d')}']")
|
||||
|
||||
@@ -633,7 +633,7 @@ feature 'Proposals' do
|
||||
visit proposals_path
|
||||
|
||||
find("h4.advanced-search-title").click
|
||||
select "Last 24 hours", from: "advanced_search_date_min"
|
||||
select "Last 24 hours", from: "js-advanced-search-date-min"
|
||||
click_button "Filter"
|
||||
|
||||
within("#proposals") do
|
||||
@@ -653,7 +653,7 @@ feature 'Proposals' do
|
||||
visit proposals_path
|
||||
|
||||
find("h4.advanced-search-title").click
|
||||
select "Customized", from: "advanced_search_date_min"
|
||||
select "Customized", from: "js-advanced-search-date-min"
|
||||
fill_in "advanced_search_date_min", with: 7.days.ago
|
||||
fill_in "advanced_search_date_max", with: 1.days.ago
|
||||
click_button "Filter"
|
||||
@@ -681,7 +681,7 @@ feature 'Proposals' do
|
||||
fill_in "Write the text", with: "Schwifty"
|
||||
fill_in "Write the author name", with: "Ana06"
|
||||
select "Public employee", from: "advanced_search_official_level"
|
||||
select "Last 24 hours", from: "advanced_search_date_min"
|
||||
select "Last 24 hours", from: "js-advanced-search-date-min"
|
||||
|
||||
click_button "Filter"
|
||||
|
||||
@@ -692,18 +692,18 @@ feature 'Proposals' do
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Maintain advanced search criteria", :js, :focus do
|
||||
scenario "Maintain advanced search criteria", :js do
|
||||
visit proposals_path
|
||||
find("h4.advanced-search-title").click
|
||||
|
||||
fill_in "Write the text", with: "Schwifty"
|
||||
fill_in "Write the author name", with: "Ana06"
|
||||
select "Public employee", from: "advanced_search_official_level"
|
||||
select "Last 24 hours", from: "advanced_search_date_min"
|
||||
select "Last 24 hours", from: "js-advanced-search-date-min"
|
||||
|
||||
click_button "Filter"
|
||||
|
||||
within "#advanced-search" do
|
||||
within "#js-advanced-search" do
|
||||
expect(page).to have_selector("input[name='search'][value='Schwifty']")
|
||||
expect(page).to have_selector("input[name='advanced_search[author]'][value='Ana06']")
|
||||
expect(page).to have_select('advanced_search[official_level]', selected: 'Public employee')
|
||||
@@ -715,12 +715,12 @@ feature 'Proposals' do
|
||||
visit proposals_path
|
||||
find("h4.advanced-search-title").click
|
||||
|
||||
select "Customized", from: "advanced_search_date_min"
|
||||
select "Customized", from: "js-advanced-search-date-min"
|
||||
fill_in "advanced_search_date_min", with: 7.days.ago
|
||||
fill_in "advanced_search_date_max", with: 1.days.ago
|
||||
click_button "Filter"
|
||||
|
||||
within "#advanced-search" do
|
||||
within "#js-advanced-search" do
|
||||
expect(page).to have_select('advanced_search[date_min]', selected: 'Customized')
|
||||
expect(page).to have_selector("input[name='advanced_search[date_min]'][value*='#{7.days.ago.strftime('%Y-%m-%d')}']")
|
||||
expect(page).to have_selector("input[name='advanced_search[date_max]'][value*='#{1.day.ago.strftime('%Y-%m-%d')}']")
|
||||
|
||||
Reference in New Issue
Block a user