-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added autocomplete for users with nickname and email
Removed the rails4 autocomplete gem
- Loading branch information
1 parent
c12fe46
commit 696ef6a
Showing
10 changed files
with
33 additions
and
11 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
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,11 @@ | ||
# Using jquery-ui autocomplete for users | ||
$('#event_organizer_user_email').autocomplete( | ||
source: $('#event_organizer_user_email').data('users'), | ||
minLength: 2, | ||
response: ( event, ui ) -> | ||
ui.content[0] = {0: "No existing matches", 1: ""} if ui.content.length == 0 | ||
select: ( event, ui ) -> | ||
$( '#event_organizer_user_email' ).val( ui.item[1] ) | ||
return false | ||
).autocomplete('instance')._renderItem = (ul, item) -> | ||
$('<li>').append('<div> <strong>Nickname</strong>: ' + item[0] + '<br>' + '<strong>Email</strong>: ' + item[1] + '</div>').appendTo ul |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
%h3 Add an event organizer for #{@event.name} | ||
.col-md-3 | ||
.col-md-4 | ||
= simple_form_for(resource, url: event_event_organizers_path) do |f| | ||
= f.error :user_id | ||
= f.input :user_email, url: autocomplete_user_email_event_event_organizers_path, as: :autocomplete, label: false, :input_html => {class: 'form-control', placeholder: 'Search by email'} | ||
= f.input :user_email,label: false, :input_html => {"data-users" => autocomplete_user_event_event_organizers_path, class: 'form-control', placeholder: 'Search by email or nickname'} | ||
.form-group | ||
= f.submit "Add", class: 'btn btn-primary btn-sm' |
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