This repository has been archived by the owner on Jan 24, 2024. It is now read-only.
forked from Growstuff/growstuff
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Growstuff#751 from GabrielSandoval/search_form
Added search form on the places index page.
- Loading branch information
Showing
9 changed files
with
63 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
%form{:action => search_places_path, :method => :get, :class => 'form-inline', :role => 'form'} | ||
.form-group | ||
= label_tag :new_place, "Change location:", :class => 'sr-only' | ||
= text_field_tag :new_place, '', :class => 'form-control', :placeholder => "New location..." | ||
= submit_tag "Search", :class => 'btn btn-primary', :id => "search_button" | ||
%br/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
-content_for :title, "#{ENV['GROWSTUFF_SITE_NAME']} Community Map" | ||
|
||
= render partial: 'search_form' | ||
%div#placesmap | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require "rails_helper" | ||
|
||
RSpec.feature "User searches", :type => :feature do | ||
|
||
scenario "with a valid place" do | ||
visit places_path | ||
search_with("Philippines") | ||
expect(page).to have_content "members near Philippines" | ||
expect(page).to have_button "search_button" | ||
page.has_content?('placesmap') | ||
expect(page).to have_content "Nearby members" | ||
end | ||
|
||
scenario "with a blank search string" do | ||
visit places_path | ||
search_with("") | ||
expect(page).to have_content "Please enter a valid location" | ||
expect(page).to have_button "search_button" | ||
page.has_content?('placesmap') | ||
end | ||
|
||
def search_with(search_string) | ||
fill_in "new_place", :with => search_string | ||
click_button "search_button" | ||
end | ||
|
||
end |