forked from jnunemaker/twitter-app
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Just throwing statuses in so you can tell you've been auth'd.
- Loading branch information
1 parent
d4171cd
commit defad89
Showing
3 changed files
with
30 additions
and
3 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 |
---|---|---|
@@ -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 |
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,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 -%> |
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,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> |