diff --git a/app/controllers/settings/subscriptions_controller.rb b/app/controllers/settings/subscriptions_controller.rb new file mode 100644 index 00000000..10bbfd51 --- /dev/null +++ b/app/controllers/settings/subscriptions_controller.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class Settings::SubscriptionsController < ApplicationController + before_action :authenticate_user! + + def index; end +end diff --git a/app/views/settings/_navigation.html.erb b/app/views/settings/_navigation.html.erb index 8b5e51e0..7bddbe9c 100644 --- a/app/views/settings/_navigation.html.erb +++ b/app/views/settings/_navigation.html.erb @@ -5,4 +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? %> + <%= link_to 'Subscriptions', settings_subscriptions_path, role: 'tab', class: "tab #{active_tab?(settings_subscriptions_path)}" %> + <%# end %> diff --git a/app/views/settings/subscriptions/index.html.erb b/app/views/settings/subscriptions/index.html.erb new file mode 100644 index 00000000..4d9104be --- /dev/null +++ b/app/views/settings/subscriptions/index.html.erb @@ -0,0 +1,30 @@ +<% content_for :title, "Subscriptions" %> + +
+ <%= render 'settings/navigation' %> + +
+
+
+

Hello there!

+ <% if current_user.active? %> +

+ You are currently subscribed to Dawarich, hurray! +

+ +

+ Your subscription will be valid for the next <%= 365 %> days and will be <%= current_user.active? ? 'renewed automatically' : 'renewed manually' %>. +

+ + <%= link_to 'Manage subscription', '#', class: 'btn btn-primary my-4' %> + <% else %> +

+ You are currently not subscribed to Dawarich. How about we fix that? +

+ + <%= link_to 'Manage subscription', '#', class: 'btn btn-primary my-4' %> + <% end %> +
+
+
+
diff --git a/config/routes.rb b/config/routes.rb index 8cabfc85..fda9b13d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -22,6 +22,7 @@ Rails.application.routes.draw do resources :users, only: %i[index create destroy edit update] resources :maps, only: %i[index] patch 'maps', to: 'maps#update' + resources :subscriptions, only: %i[index] end patch 'settings', to: 'settings#update' diff --git a/spec/requests/settings/subscriptions_spec.rb b/spec/requests/settings/subscriptions_spec.rb new file mode 100644 index 00000000..09862f55 --- /dev/null +++ b/spec/requests/settings/subscriptions_spec.rb @@ -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