Skip to content

Commit d4b7238

Browse files
authored
Merge pull request #512 from coopdevs/feature/add-phones-search-managers
Feature/add phones search feature (only for managers)
2 parents d341be9 + d977d53 commit d4b7238

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

app/views/users/manage.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<div class="col-md-12">
1212
<%= search_form_for(@search, class: "navbar-form navbar-left", url: manage_users_path) do |f| %>
1313
<div class="form-group">
14-
<%= f.search_field :user_username_or_user_email_or_member_uid_search_contains, class: "form-control" %>
14+
<%= f.search_field :user_username_or_user_email_or_user_phone_or_user_alt_phone_or_member_uid_search_contains, class: "form-control" %>
1515
</div>
1616
<button class="btn btn-default" type="submit">
1717
<%= t 'global.search' %>

spec/controllers/users_controller_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,17 @@
146146
end
147147
end
148148
end
149+
150+
context 'when searching' do
151+
it 'allows to search by phone' do
152+
user = Fabricate(:user, phone: 123456789)
153+
member = Fabricate(:member, user: user, organization: test_organization)
154+
155+
get :manage, q: { user_username_or_user_email_or_user_phone_or_user_alt_phone_or_member_uid_search_contains: 123456789 }
156+
157+
expect(assigns(:members)).to include(member)
158+
end
159+
end
149160
end
150161

151162
describe "GET #show" do

0 commit comments

Comments
 (0)