REFACTOR: remove AgeWord calls from serializers and do it in javascript

This commit is contained in:
Neil Lalonde 2017-11-17 17:08:49 -05:00
parent f00b9b15e2
commit 7c6f991313
7 changed files with 14 additions and 14 deletions

View File

@ -429,7 +429,7 @@
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.users.last_emailed'}}</div>
<div class='value'>{{format-date model.last_emailed_at leaveAgo="true"}}</div>
<div class='value'>{{format-date model.last_emailed_at}}</div>
</div>
<div class='display-row'>
<div class='field'>{{i18n 'last_seen'}}</div>
@ -474,7 +474,7 @@
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.time_read'}}</div>
<div class='value'>{{{model.time_read}}}</div>
<div class='value'>{{{format-duration model.time_read}}}</div>
</div>
<div class='display-row'>
<div class='field'>{{i18n 'user.invited.days_visited'}}</div>

View File

@ -60,10 +60,10 @@
{{unbound user.email}}
</td>
<td>
{{{unbound user.last_emailed_age}}}
{{{format-duration user.last_emailed_age}}}
</td>
<td>
{{{unbound user.last_seen_age}}}
{{{format-duration user.last_seen_age}}}
</td>
<td>
{{number user.topics_entered}}
@ -72,11 +72,11 @@
{{number user.posts_read_count}}
</td>
<td>
{{{unbound user.time_read}}}
{{{format-duration user.time_read}}}
</td>
<td>
{{{unbound user.created_at_age}}}
{{{format-duration user.created_at_age}}}
</td>
{{#if showApproval}}

View File

@ -7,5 +7,5 @@
<td>{{number item.posts_read}}</td>
<td>{{number item.days_visited}}</td>
{{#if showTimeRead}}
<td><span class='time-read'>{{unbound item.time_read}}</span></td>
<td><span class='time-read'>{{format-duration item.time_read}}</span></td>
{{/if}}

View File

@ -71,7 +71,7 @@
<td>{{format-date invite.user.last_seen_at}}</td>
<td>{{number invite.user.topics_entered}}</td>
<td>{{number invite.user.posts_read_count}}</td>
<td>{{{unbound invite.user.time_read}}}</td>
<td>{{{format-duration invite.user.time_read}}}</td>
<td><span title="{{i18n 'user.invited.days_visited'}}">{{{unbound invite.user.days_visited}}}</span>
/
<span title="{{i18n 'user.invited.account_age_days'}}">{{{unbound invite.user.days_since_created}}}</span></td>

View File

@ -80,7 +80,7 @@ class AdminUserListSerializer < BasicUserSerializer
def last_emailed_age
return nil if object.last_emailed_at.blank?
AgeWords.age_words(Time.now - object.last_emailed_at)
Time.now - object.last_emailed_at
end
def last_seen_at
@ -90,16 +90,16 @@ class AdminUserListSerializer < BasicUserSerializer
def last_seen_age
return nil if object.last_seen_at.blank?
AgeWords.age_words(Time.now - object.last_seen_at)
Time.now - object.last_seen_at
end
def time_read
return nil if object.user_stat.time_read.blank?
AgeWords.age_words(object.user_stat.time_read)
object.user_stat.time_read
end
def created_at_age
AgeWords.age_words(Time.now - object.created_at)
Time.now - object.created_at
end
def can_approve

View File

@ -11,7 +11,7 @@ class DirectoryItemSerializer < ApplicationSerializer
end
def time_read
AgeWords.age_words(object.user_stat.time_read)
object.user_stat.time_read
end
def include_time_read?

View File

@ -10,7 +10,7 @@ class InvitedUserSerializer < BasicUserSerializer
attr_accessor :invited_by
def time_read
AgeWords.age_words(object.user_stat.time_read)
object.user_stat.time_read
end
def include_time_read?