Added format_large_number to hit/view/follower counts, removed hits_english/views_english

This commit is contained in:
Victoria Wang 2014-11-09 22:49:53 -06:00
parent 5dcac62bf2
commit d7ec37b13b
4 changed files with 11 additions and 19 deletions

View file

@ -912,14 +912,6 @@ class Site < Sequel::Model
end
end
def hits_english
values[:hits].to_s.reverse.gsub(/...(?=.)/,'\&,').reverse
end
def views_english
values[:views].to_s.reverse.gsub(/...(?=.)/,'\&,').reverse
end
def screenshots_delete(path)
SCREENSHOT_RESOLUTIONS.each do |res|
begin

View file

@ -80,9 +80,9 @@
<div class="site-stats">
<a href="/site/<%= site.username %>">
<% if params[:sort_by] == 'hits' %>
<%= site.hits %>&nbsp;hit<%= site.hits == 1 ? '' : 's' %>
<%= site.hits.format_large_number %>&nbsp;hit<%= site.hits == 1 ? '' : 's' %>
<% else %>
<%= site.views %>&nbsp;view<%= site.views == 1 ? '' : 's' %>
<%= site.views.format_large_number %>&nbsp;view<%= site.views == 1 ? '' : 's' %>
<% end %>
</a>
</div>

View file

@ -67,7 +67,7 @@
</div>
<div class="site-stats">
<a href="/site/<%= suggested_site.username %>">
<%= suggested_site.views %>&nbsp;view<%= suggested_site.views == 1 ? '' : 's' %>
<%= suggested_site.views.format_large_number %>&nbsp;view<%= suggested_site.views == 1 ? '' : 's' %>
</a>
</div>
<div class="site-tags">
@ -97,9 +97,9 @@
<% end %>
</div>
<div class="col col-50">
<div><strong><%= site.views_english %></strong> unique views</div>
<div><strong><%= site.hits_english %></strong> hits</div>
<div><strong><%= site.follows_dataset.count %></strong> followers</div>
<div><strong><%= site.views.format_large_number %></strong> unique views</div>
<div><strong><%= site.hits.format_large_number %></strong> hits</div>
<div><strong><%= site.follows_dataset.count.format_large_number %></strong> followers</div>
</div>
</div>

View file

@ -22,9 +22,9 @@
<h2 class="eps title-with-badge"><span><%= site.title %></span> <% if site.supporter? %><a href="/plan" class="supporter-badge" title="Neocities Supporter"></a> <% end %></h2>
<p class="site-url"><a href="/surf/<%= site.username %>"><%= site.host %></a></p>
<div class="stats">
<div class="stat"><strong><%= site.views_english %></strong> <span>views</span></div>
<div class="stat"><strong><%= site.hits_english %></strong> <span>hits</span></div>
<div class="stat"><strong><%= site.follows_dataset.count %></strong> <span>followers</span></div>
<div class="stat"><strong><%= site.views.format_large_number %></strong> <span>views</span></div>
<div class="stat"><strong><%= site.hits.format_large_number %></strong> <span>hits</span></div>
<div class="stat"><strong><%= site.follows_dataset.count.format_large_number %></strong> <span>followers</span></div>
<!-- <div class="stat tips"><strong><%= site.tips_dataset.count %></strong> <span>tips</span></div> -->
</div>
<div class="actions">
@ -107,8 +107,8 @@
<% end %>
</strong>
</div>
<div class="stat"><span>Number of updates</span><strong><%= site.changed_count %></strong></div>
<div class="stat"><span>Created</span><strong><%= site.created_at.strftime('%B %-d, %Y') %></strong></div>
<div class="stat"><span>Number of updates</span><strong><%= site.changed_count.format_large_number %></strong></div>
<div class="stat"><span>Created</span><strong><%= site.created_at.strftime('%b %-d, %Y') %></strong></div>
</div>
<%== erb :'_follows', layout: false, locals: {site: site, is_current_site: site == current_site} %>