Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Eric Berry
committed
Nov 10, 2009
1 parent
3cb4643
commit a75fd50
Showing
7 changed files
with
115 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<ul id="flits_list"> | ||
<% @friends.each do |friend| %> | ||
<li<% if @friends.first == friend %> class="first"<% end %> id="<%= friend.username %>"> | ||
<%= image_tag friend.gravatar_url %> | ||
<div class="flit_message_container" style="width: 305px;"> | ||
<h3><%= link_to friend.username, user_flits_path(friend.username) %></h3> | ||
<% if friend.flits.length > 0 %> | ||
<%= h friend.flits.last.message %> | ||
<%= distance_of_time_in_words_to_now(friend.flits.last.created_at) %> ago | ||
<% end %> | ||
</div> | ||
<div class="button_container"> | ||
<input type="button" name="<%= friend.username %>" class="button ajax_button" value="Stop Following"/> | ||
</div> | ||
<div class="clear"></div> | ||
</li> | ||
<% end %> | ||
</ul> | ||
|
||
<script type="text/javascript"> | ||
$(function() { | ||
$('.ajax_button').click(function() { | ||
$.ajax({ | ||
type: "POST", | ||
url: "/remove_friend/" + $(this).attr('name'), | ||
success: function(msg){ | ||
//alert( "You are no longer following: " + msg ); | ||
$('#' + msg).slideUp('slow'); | ||
} | ||
}); | ||
}) | ||
}); | ||
</script> |
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,38 @@ | ||
<ul id="flits_list"> | ||
<% @friends.each do |friend| %> | ||
<li<% if @friends.first == friend %> class="first"<% end %> id="<%= friend.username %>"> | ||
<%= image_tag friend.gravatar_url %> | ||
<div class="flit_message_container" style="width: 305px;"> | ||
<h3><%= link_to friend.username, user_flits_path(friend.username) %></h3> | ||
<% if friend.flits.length > 0 %> | ||
<%= h friend.flits.last.message %> | ||
<%= distance_of_time_in_words_to_now(friend.flits.last.created_at) %> ago | ||
<% end %> | ||
</div> | ||
<div class="button_container"> | ||
<input type="button" name="<%= friend.username %>" id="btn_<%= friend.username %>" class="button ajax_button" | ||
value="<% if current_user.is_friend? friend %>Stop Following<% else %>Follow<% end %>"/> | ||
</div> | ||
<div class="clear"></div> | ||
</li> | ||
<% end %> | ||
</ul> | ||
|
||
<script type="text/javascript"> | ||
$(function() { | ||
$('.ajax_button').click(function() { | ||
$.ajax({ | ||
type: "POST", | ||
url: "/" + $(this).attr('name') + "/toggle_follow_via_ajax", | ||
success: function(msg){ | ||
elm = $('#btn_' + msg); | ||
if (elm.val() == "Stop Following") { | ||
elm.val("Follow"); | ||
} else { | ||
elm.val("Stop Following"); | ||
} | ||
} | ||
}); | ||
}) | ||
}); | ||
</script> |
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 @@ | ||
<div id="my_info_container"> | ||
<%= link_to image_tag(current_user.gravatar_url(:size => 30), :border => 0), user_flits_path(current_user.username) %> | ||
<div class="contents"> | ||
<%= link_to current_user.username, user_flits_path(current_user.username) %><br/> | ||
<span class="small"><%= pluralize(current_user.flits.length, "Flit") %></span> | ||
</div> | ||
</div> | ||
<div class="clear"></div> | ||
|
||
<div id="side_content_container"> | ||
<h4><%= link_to "#{current_user.friends.count} following", following_path %></h4> | ||
<h4><%= pluralize(current_user.friends_of.count, "follower") %></h4> | ||
</div> | ||
|
||
<% form_tag search_path do %> | ||
<div id="search_bar"> | ||
<%= text_field_tag :q, @q, :class => "text" %> | ||
<div id="search_submit_button"> </div> | ||
</div> | ||
<% end %> | ||
|
||
<div id="side_content_container"> | ||
<h4>Followers</h4> | ||
<% current_user.friends_of.each do |friend| %> | ||
<%= link_to image_tag(friend.gravatar_url(:size => 25), :border => 0, :alt => friend.username, :title => friend.username), user_flits_path(friend.username) %> | ||
<% end %> | ||
</div> |
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,17 @@ | ||
class AddIndexesToUsers < ActiveRecord::Migration | ||
def self.up | ||
add_index :users, :username | ||
add_index :users, :email | ||
add_index :friendships, :user_id | ||
add_index :friendships, :friend_id | ||
add_index :flits, :user_id | ||
end | ||
|
||
def self.down | ||
remove_index :users, :username | ||
remove_index :users, :email | ||
remove_index :friendships, :user_id | ||
remove_index :friendships, :friend_id | ||
remove_index :flits, :user_id | ||
end | ||
end |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.