FEATURE: update TwitterApi for prettifying like/retweet count
This commit is contained in:
parent
9f1e8d4f58
commit
7c7509e1bd
|
@ -530,6 +530,14 @@ aside.onebox.stackexchange .onebox-body {
|
|||
}
|
||||
}
|
||||
|
||||
.onebox.twitterstatus {
|
||||
.like,
|
||||
.retweet {
|
||||
color: dark-light-choose($primary-medium, $secondary-medium);
|
||||
padding-left: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
// mobile specific style
|
||||
.mobile-view article.onebox-body {
|
||||
border-top: none;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
class TwitterApi
|
||||
|
||||
class << self
|
||||
include ActionView::Helpers::NumberHelper
|
||||
|
||||
def prettify_tweet(tweet)
|
||||
text = tweet["full_text"].dup
|
||||
|
@ -32,6 +33,10 @@ class TwitterApi
|
|||
result
|
||||
end
|
||||
|
||||
def prettify_number(count)
|
||||
number_to_human(count, :format => '%n%u', :precision => 2, :units => { :thousand => 'K', :million => 'M', :billion => 'B' })
|
||||
end
|
||||
|
||||
def user_timeline(screen_name)
|
||||
JSON.parse(twitter_get(user_timeline_uri_for screen_name))
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue