Skip to content

Commit

Permalink
Just throwing statuses in so you can tell you've been auth'd.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnunemaker committed Apr 4, 2009
1 parent d4171cd commit defad89
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
13 changes: 13 additions & 0 deletions app/helpers/application_helper.rb
@@ -1,3 +1,16 @@
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
def pretty_datetime(datetime)
str = datetime.strftime('%b %d, %Y^%H:%M%p')
str.gsub!(/\^0/, '^')
str.tr!('AM', 'am')
str.tr!('PM', 'pm')
date, time = str.split('^')
content_tag(:span, date, :class => 'date') + " " + content_tag(:span, time, :class => 'time')
end

def linkup_replies(text)
text.gsub!(/@([\w]+)(\W)?/, '@<a href="/users/\1">\1</a>\2')
text
end
end
6 changes: 3 additions & 3 deletions app/views/home/index.html.erb
@@ -1,9 +1,9 @@
<h2>Yo!</h2>

<%- if current_user.authorized? -%>
<div id="statuses">
<%- for tweet in current_user.client.friends_timeline -%>
<%= debug tweet %><br /><br />
<%= render :partial => 'statuses/status', :object => tweet %>
<%- end -%>
</div>
<%- else -%>
<p>We need you to authorize this app. <%= link_to 'Authorize', new_authorization_url %></p>
<%- end -%>
14 changes: 14 additions & 0 deletions app/views/statuses/_status.html.erb
@@ -0,0 +1,14 @@
<div id="status_<%= status.id %>" class="status">
<div class="info">
<%= link_to image_tag(status.user.profile_image_url), '#', :class => 'profile_image' %>

<p>
<%= link_to status.user.screen_name, user_url(status.user) %><br />
<%= pretty_datetime Time.parse(status.created_at) %>
</p>
</div>

<div class="text">
<%= linkup_replies(auto_link(status.text)) %>
</div>
</div>

0 comments on commit defad89

Please sign in to comment.