mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
show bandwidth on dashboard, fix extra stats one_to_many, clarify stats retainent and fix typo
This commit is contained in:
parent
2dd1f55119
commit
a81a708be5
5 changed files with 29 additions and 11 deletions
|
@ -205,8 +205,6 @@ class Site < Sequel::Model
|
|||
one_to_many :reports
|
||||
one_to_many :reportings, key: :reporting_site_id, class: :Report
|
||||
|
||||
one_to_many :stats
|
||||
|
||||
one_to_many :events
|
||||
|
||||
one_to_many :site_changes
|
||||
|
@ -1903,6 +1901,16 @@ class Site < Sequel::Model
|
|||
true
|
||||
end
|
||||
|
||||
def maximum_monthly_bandwidth
|
||||
PLAN_FEATURES[(parent? ? self : parent).plan_type.to_sym][:bandwidth].to_i
|
||||
end
|
||||
|
||||
def monthly_bandwidth_used
|
||||
stat = stats_dataset.order(:created_at.desc).select(:bandwidth).first
|
||||
return 0 if stat.nil?
|
||||
stat[:bandwidth]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def store_file(path, uploaded, opts={})
|
||||
|
|
|
@ -36,10 +36,13 @@
|
|||
<% if current_site.site_updated_at %>
|
||||
<li>Last updated <strong class="local-date-title" data-timestamp="<%= current_site.site_updated_at.to_i %>"><%= current_site.site_updated_at.ago.downcase %></strong></li>
|
||||
<% end %>
|
||||
<li>Using <strong><%= current_site.space_percentage_used %>% (<%= current_site.total_space_used.to_space_pretty %>) of your <%= current_site.maximum_space.to_space_pretty %></strong>.
|
||||
<li>Using <strong><%= current_site.space_percentage_used %>% (<%= current_site.total_space_used.to_space_pretty %>)</strong> of your <strong><%= current_site.maximum_space.to_space_pretty %></strong> storage.
|
||||
<br>
|
||||
<% unless current_site.is_education || current_site.supporter? %>Need more space? <a href="/supporter">Become a Supporter!</a><% end %></li>
|
||||
<li><strong><%= current_site.views.format_large_number %></strong> views</li>
|
||||
<li>
|
||||
Used <strong><%= current_site.monthly_bandwidth_used.to_bytes_pretty %></strong> of bandwidth this month.
|
||||
<br>
|
||||
<% unless current_site.is_education || current_site.supporter? %>Need more space? <a href="/supporter">Become a Supporter!</a><% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@
|
|||
<li><a href="?days=sincethebigbang">All time</a></li>
|
||||
</ul>
|
||||
<% else %>
|
||||
<p>(<a href="/supporter">Upgrade</a> to see up to see stats for all time)</p>
|
||||
<p>Stats for free sites are retained for <%= Stat::FREE_RETAINMENT_DAYS %> days. <a href="/supporter">Become a supporter</a> to start retaining stats for all time.</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -114,6 +114,13 @@
|
|||
<td><i class="fa fa-check"></i></td>
|
||||
</tr>
|
||||
-->
|
||||
<tr>
|
||||
<td class="feature-column">
|
||||
<span data-original-title="How long views and hits are tracked for your site. Free sites are limited to <%= Stat::FREE_RETAINMENT_DAYS %> days.">Site Stats History</span>
|
||||
</td>
|
||||
<td></td>
|
||||
<td><i class="fa fa-check"></i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="feature-column">
|
||||
<span data-original-title="You can mount your Neocities site to your computer as a hard drive, making it easy to update with your favorite HTML editor.">WebDAV Uploading</span>
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
Upgrade for $<%= Site::PLAN_FEATURES[:supporter][:price] %>/mo
|
||||
</a>
|
||||
<br>
|
||||
or pay with <strong><a href="/supporter/paypal" style="color: #00308a; text-decoration: underline;"><span style="color: #00308a">Pay</span><span style="color: #029be1">Pal</span></a></strong> or <strong><a href="/supporter/bitcoin" style="color: #f79319; text-decoration: underline;">Bitcoin</a></strong>
|
||||
or pay with <strong><a href="/supporter/paypal" style="color: #00308a; text-decoration: underline;"><span style="color: #00308a">Pay</span><span style="color: #029be1">Pal</span></a></strong>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue