From defad893cc7779a1daa522a09a6369ca8f563a6f Mon Sep 17 00:00:00 2001 From: John Nunemaker Date: Sat, 4 Apr 2009 02:52:42 -0400 Subject: [PATCH] Just throwing statuses in so you can tell you've been auth'd. --- app/helpers/application_helper.rb | 13 +++++++++++++ app/views/home/index.html.erb | 6 +++--- app/views/statuses/_status.html.erb | 14 ++++++++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 app/views/statuses/_status.html.erb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 22a7940..ff86007 100644 --- a/app/helpers/application_helper.rb +++ b/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)?/, '@\1\2') + text + end end diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index cd16b15..64ba1fe 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,9 +1,9 @@ -

Yo!

- <%- if current_user.authorized? -%> +
<%- for tweet in current_user.client.friends_timeline -%> - <%= debug tweet %>

+ <%= render :partial => 'statuses/status', :object => tweet %> <%- end -%> +
<%- else -%>

We need you to authorize this app. <%= link_to 'Authorize', new_authorization_url %>

<%- end -%> \ No newline at end of file diff --git a/app/views/statuses/_status.html.erb b/app/views/statuses/_status.html.erb new file mode 100644 index 0000000..6f144ee --- /dev/null +++ b/app/views/statuses/_status.html.erb @@ -0,0 +1,14 @@ +
+
+ <%= link_to image_tag(status.user.profile_image_url), '#', :class => 'profile_image' %> + +

+ <%= link_to status.user.screen_name, user_url(status.user) %>
+ <%= pretty_datetime Time.parse(status.created_at) %> +

+
+ +
+ <%= linkup_replies(auto_link(status.text)) %> +
+
\ No newline at end of file