diff --git a/app/assets/javascripts/friends.js b/app/assets/javascripts/friends.js new file mode 100644 index 0000000..1eb2c4c --- /dev/null +++ b/app/assets/javascripts/friends.js @@ -0,0 +1,15 @@ +$(document).on('ready page:load', function(){ + var friend_cell = $(".friend"); + + $("#search").keyup(function() { + var val = $.trim(this.value).toUpperCase(); + if (val === "") + friend_cell.show(); + else { + friend_cell.hide(); + friend_cell.filter(function() { + return -1 != $(this).text().toUpperCase().indexOf(val); }).show(); + } + }); +}); + diff --git a/app/views/friends/index.html.erb b/app/views/friends/index.html.erb index d70c8f1..1398d71 100644 --- a/app/views/friends/index.html.erb +++ b/app/views/friends/index.html.erb @@ -3,9 +3,12 @@
+ + +
-
+
<%= link_to new_friend_path(uid: @user.uid, name: @user.name) do %>
@@ -17,7 +20,7 @@
<% (@friends*200).each do |f| %> -
+
<%= link_to new_friend_path(uid: f['id'], name: f['name']) do %>
/picture?height=192&width=192">