mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Add simple button to manage subscription
This commit is contained in:
parent
ff6d5f1c97
commit
95717db1bf
5 changed files with 48 additions and 0 deletions
7
app/controllers/settings/subscriptions_controller.rb
Normal file
7
app/controllers/settings/subscriptions_controller.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class Settings::SubscriptionsController < ApplicationController
|
||||||
|
before_action :authenticate_user!
|
||||||
|
|
||||||
|
def index; end
|
||||||
|
end
|
||||||
|
|
@ -5,4 +5,7 @@
|
||||||
<%= link_to 'Background Jobs', settings_background_jobs_path, role: 'tab', class: "tab #{active_tab?(settings_background_jobs_path)}" %>
|
<%= link_to 'Background Jobs', settings_background_jobs_path, role: 'tab', class: "tab #{active_tab?(settings_background_jobs_path)}" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= link_to 'Map', settings_maps_path, role: 'tab', class: "tab #{active_tab?(settings_maps_path)}" %>
|
<%= link_to 'Map', settings_maps_path, role: 'tab', class: "tab #{active_tab?(settings_maps_path)}" %>
|
||||||
|
<%# if !DawarichSettings.self_hosted? %>
|
||||||
|
<%= link_to 'Subscriptions', settings_subscriptions_path, role: 'tab', class: "tab #{active_tab?(settings_subscriptions_path)}" %>
|
||||||
|
<%# end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
30
app/views/settings/subscriptions/index.html.erb
Normal file
30
app/views/settings/subscriptions/index.html.erb
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
<% content_for :title, "Subscriptions" %>
|
||||||
|
|
||||||
|
<div class="min-h-content w-full my-5">
|
||||||
|
<%= render 'settings/navigation' %>
|
||||||
|
|
||||||
|
<div class="hero bg-base-200 min-h-80">
|
||||||
|
<div class="hero-content text-center">
|
||||||
|
<div class="max-w-md">
|
||||||
|
<h1 class="text-5xl font-bold">Hello there!</h1>
|
||||||
|
<% if current_user.active? %>
|
||||||
|
<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>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<%= link_to 'Manage subscription', '#', class: 'btn btn-primary my-4' %>
|
||||||
|
<% else %>
|
||||||
|
<p class="py-6">
|
||||||
|
You are currently not subscribed to Dawarich. How about we fix that?
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<%= link_to 'Manage subscription', '#', class: 'btn btn-primary my-4' %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -22,6 +22,7 @@ Rails.application.routes.draw do
|
||||||
resources :users, only: %i[index create destroy edit update]
|
resources :users, only: %i[index create destroy edit update]
|
||||||
resources :maps, only: %i[index]
|
resources :maps, only: %i[index]
|
||||||
patch 'maps', to: 'maps#update'
|
patch 'maps', to: 'maps#update'
|
||||||
|
resources :subscriptions, only: %i[index]
|
||||||
end
|
end
|
||||||
|
|
||||||
patch 'settings', to: 'settings#update'
|
patch 'settings', to: 'settings#update'
|
||||||
|
|
|
||||||
7
spec/requests/settings/subscriptions_spec.rb
Normal file
7
spec/requests/settings/subscriptions_spec.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "Settings::Subscriptions", type: :request do
|
||||||
|
describe "GET /index" do
|
||||||
|
pending "add some examples (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in a new issue