about summary refs log tree commit diff
path: root/app/helpers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-02-28 14:02:53 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-02-28 14:02:53 +0100
commit2825991e09272d6e7227da9d9b8dc387614a83df (patch)
tree74edf6c23928ae3b448e5247e78d60cd5c86b572 /app/helpers
parent5ae54f9e364880e1350ddcc8251a23cf79ae55fc (diff)
Improving status display design, including replies and threads
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/profile_helper.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/helpers/profile_helper.rb b/app/helpers/profile_helper.rb
index 2abe67635..cb19638d3 100644
--- a/app/helpers/profile_helper.rb
+++ b/app/helpers/profile_helper.rb
@@ -10,4 +10,21 @@ module ProfileHelper
   def status_url(status)
     status.local? ? super(name: status.account.username, id: status.stream_entry.id) : status.url
   end
+
+  def avatar_for_status_url(status)
+    status.reblog? ? status.reblog.account.avatar.url(:small) : status.account.avatar.url(:small)
+  end
+
+  def entry_classes(status, is_predecessor, is_successor, include_threads)
+    classes = ['entry']
+    classes << 'entry-reblog' if status.reblog?
+    classes << 'entry-predecessor' if is_predecessor
+    classes << 'entry-successor' if is_successor
+    classes << 'entry-center' if include_threads
+    classes.join(' ')
+  end
+
+  def relative_time(date)
+    date < 5.days.ago ? date.strftime("%d.%m.%Y") : "#{time_ago_in_words(date)} ago"
+  end
 end