mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
Show subscription expiration date nicely
This commit is contained in:
parent
41604d71a6
commit
85d04eb75c
3 changed files with 17 additions and 4 deletions
|
|
@ -137,4 +137,17 @@ module ApplicationHelper
|
|||
|
||||
speed * 3.6
|
||||
end
|
||||
|
||||
def days_left(active_until)
|
||||
return unless active_until
|
||||
|
||||
time_words = distance_of_time_in_words(Time.zone.now, active_until)
|
||||
|
||||
content_tag(
|
||||
:span,
|
||||
time_words,
|
||||
class: 'tooltip',
|
||||
data: { tip: "Expires on #{active_until.iso8601}" }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<%= link_to 'Background Jobs', settings_background_jobs_path, role: 'tab', class: "tab #{active_tab?(settings_background_jobs_path)}" %>
|
||||
<% end %>
|
||||
<%= link_to 'Map', settings_maps_path, role: 'tab', class: "tab #{active_tab?(settings_maps_path)}" %>
|
||||
<%# if !DawarichSettings.self_hosted? %>
|
||||
<% if !DawarichSettings.self_hosted? %>
|
||||
<%= link_to 'Subscriptions', settings_subscriptions_path, role: 'tab', class: "tab #{active_tab?(settings_subscriptions_path)}" %>
|
||||
<%# end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@
|
|||
<div class="hero-content text-center">
|
||||
<div class="max-w-md">
|
||||
<h1 class="text-5xl font-bold">Hello there!</h1>
|
||||
<% if current_user.active? %>
|
||||
<% if current_user.active_until.future? %>
|
||||
<p class="py-6">
|
||||
You are currently subscribed to Dawarich, hurray!
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Your subscription will be valid for the next <span class="text-accent"><%= 365 %> days</span> and will be <span class="text-accent"><%= current_user.active? ? 'renewed automatically' : 'renewed manually' %></span>.
|
||||
Your subscription will be valid for the next <span class="text-accent"><%= days_left(current_user.active_until) %></span>.
|
||||
</p>
|
||||
|
||||
<%= link_to 'Manage subscription', "#{ENV['SUBSCRIPTION_URL']}/auth/dawarich?token=#{current_user.generate_subscription_token}", class: 'btn btn-primary my-4' %>
|
||||
|
|
|
|||
Loading…
Reference in a new issue