mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: update TwitterApi for prettifying like/retweet count
This commit is contained in:
@@ -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 specific style
|
||||||
.mobile-view article.onebox-body {
|
.mobile-view article.onebox-body {
|
||||||
border-top: none;
|
border-top: none;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
class TwitterApi
|
class TwitterApi
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
include ActionView::Helpers::NumberHelper
|
||||||
|
|
||||||
def prettify_tweet(tweet)
|
def prettify_tweet(tweet)
|
||||||
text = tweet["full_text"].dup
|
text = tweet["full_text"].dup
|
||||||
@@ -32,6 +33,10 @@ class TwitterApi
|
|||||||
result
|
result
|
||||||
end
|
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)
|
def user_timeline(screen_name)
|
||||||
JSON.parse(twitter_get(user_timeline_uri_for screen_name))
|
JSON.parse(twitter_get(user_timeline_uri_for screen_name))
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user