Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

fix: Broken `/terms` and `/privacy` routes (#749)

Juan José Mata5ba051c8cff3
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
index b1053b0265..4657d8a992 100644
--- a/app/controllers/pages_controller.rb
+++ b/app/controllers/pages_controller.rb
@@ -1,7 +1,7 @@
class PagesController < ApplicationController
include Periodable
- skip_authentication only: :redis_configuration_error
+ skip_authentication only: %i[redis_configuration_error privacy terms]
def dashboard
@balance_sheet = Current.family.balance_sheet
@@ -55,6 +55,14 @@ class PagesController < ApplicationController
render layout: "blank"
end
+ def privacy
+ render layout: "blank"
+ end
+
+ def terms
+ render layout: "blank"
+ end
+
private
def preferences_params
prefs = params.require(:preferences)
diff --git a/app/views/pages/privacy.html.erb b/app/views/pages/privacy.html.erb
new file mode 100644
index 0000000000..303f18766b
--- /dev/null
+++ b/app/views/pages/privacy.html.erb
@@ -0,0 +1,12 @@
+<% content_for :title, t(".title") %>
+
+<div class="flex items-center justify-center h-full p-4 sm:p-6 lg:p-8">
+ <div class="w-full max-w-md sm:max-w-lg lg:max-w-2xl">
+ <div class="bg-container border border-primary rounded-xl p-6 sm:p-8 shadow-sm">
+ <div class="text-center">
+ <h1 class="text-xl sm:text-2xl font-bold text-primary mb-4"><%= t(".heading") %></h1>
+ <p class="text-sm sm:text-base text-muted"><%= t(".placeholder") %></p>
+ </div>
+ </div>
+ </div>
+</div>
diff --git a/app/views/pages/terms.html.erb b/app/views/pages/terms.html.erb
new file mode 100644
index 0000000000..303f18766b
--- /dev/null
+++ b/app/views/pages/terms.html.erb
@@ -0,0 +1,12 @@
+<% content_for :title, t(".title") %>
+
+<div class="flex items-center justify-center h-full p-4 sm:p-6 lg:p-8">
+ <div class="w-full max-w-md sm:max-w-lg lg:max-w-2xl">
+ <div class="bg-container border border-primary rounded-xl p-6 sm:p-8 shadow-sm">
+ <div class="text-center">
+ <h1 class="text-xl sm:text-2xl font-bold text-primary mb-4"><%= t(".heading") %></h1>
+ <p class="text-sm sm:text-base text-muted"><%= t(".placeholder") %></p>
+ </div>
+ </div>
+ </div>
+</div>
diff --git a/config/locales/views/pages/en.yml b/config/locales/views/pages/en.yml
index f193226781..bded845ee2 100644
--- a/config/locales/views/pages/en.yml
+++ b/config/locales/views/pages/en.yml
@@ -3,6 +3,14 @@ en:
pages:
changelog:
title: What's new
+ privacy:
+ title: Privacy Policy
+ heading: Privacy Policy
+ placeholder: Privacy policy content will be displayed here.
+ terms:
+ title: Terms of Service
+ heading: Terms of Service
+ placeholder: Terms of service content will be displayed here.
dashboard:
welcome: "Welcome back, %{name}"
subtitle: "Here's what's happening with your finances"
diff --git a/config/routes.rb b/config/routes.rb
index ffd81b3721..69e1f4fc11 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -450,8 +450,10 @@ Rails.application.routes.draw do
get "imports/:import_id/upload/sample_csv", to: "import/uploads#sample_csv", as: :import_upload_sample_csv
- get "privacy", to: redirect("about:blank")
- get "terms", to: redirect("about:blank")
+ privacy_url = ENV["LEGAL_PRIVACY_URL"].presence
+ terms_url = ENV["LEGAL_TERMS_URL"].presence
+ get "privacy", to: privacy_url ? redirect(privacy_url) : "pages#privacy"
+ get "terms", to: terms_url ? redirect(terms_url) : "pages#terms"
# Admin namespace for super admin functionality
namespace :admin do