Add Privacy and ToS pages, footer menu
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Release Drafter / Update release notes draft (pull_request) Successful in 3s

This commit is contained in:
Râu Cao 2025-05-30 13:18:38 +04:00
parent 32cd4d896d
commit f2e8ca790c
Signed by: raucao
GPG Key ID: 37036C356E56CC51
10 changed files with 63 additions and 7 deletions

View File

@ -1,4 +1,4 @@
<main class="w-full max-w-xl mx-auto pb-12 px-4 sm:px-6 lg:px-8">
<main class="w-full max-w-xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="bg-white rounded-lg shadow px-6 sm:px-12 py-8 sm:py-12">
<%= content %>
</div>

View File

@ -1,4 +1,4 @@
<main class="w-full max-w-6xl mx-auto pb-12 px-4 md:px-6 lg:px-8">
<main class="w-full max-w-6xl mx-auto px-4 md:px-6 lg:px-8">
<div class="md:min-h-[50vh] bg-white rounded-lg shadow px-6 sm:px-12 py-8 sm:py-12">
<%= content %>
</div>

View File

@ -1,4 +1,4 @@
<main class="w-full max-w-6xl mx-auto pb-12 px-4 md:px-6 lg:px-8">
<main class="w-full max-w-6xl mx-auto px-4 md:px-6 lg:px-8">
<div class="bg-white rounded-lg shadow">
<div class="md:min-h-[50vh] divide-y divide-gray-200 lg:grid lg:grid-cols-12 lg:divide-y-0 lg:divide-x">
<aside class="py-6 sm:py-8 lg:col-span-3">

View File

@ -1,4 +1,4 @@
<main class="w-full max-w-6xl mx-auto pb-12 px-4 md:px-6 lg:px-8">
<main class="w-full max-w-6xl mx-auto px-4 md:px-6 lg:px-8">
<div class="md:min-h-[50vh] bg-white rounded-lg shadow">
<div class="px-6 sm:px-12 pt-2 sm:pt-4">
<%= render partial: @tabnav_partial %>

View File

@ -0,0 +1,9 @@
class PagesController < ApplicationController
def privacy
@current_section = :privacy
end
def tos
@current_section = :tos
end
end

View File

@ -10,7 +10,7 @@
<%= javascript_importmap_tags %>
</head>
<body <%= @context.present? ? "id=#{@context}" : "" %> class="h-full <%= @context == :admin ? "bg-red-500" : "bg-sky-900" %>">
<div class="min-h-full">
<div class="min-h-full flex flex-col">
<nav data-controller="topbar">
<div class="max-w-6xl mx-auto sm:px-6 lg:px-8">
<div class="border-b border-gray-200/10">
@ -96,7 +96,18 @@
</div>
</div>
<%= yield %>
<div class="flex-grow">
<%= yield %>
</div>
<% if user_signed_in? && current_user.confirmed? %>
<nav id="footer" class="max-w-6xl mx-auto pt-4 sm:px-6 lg:px-8">
<div class="flex justify-end items-center space-x-4 h-16">
<%= link_to "Terms", tos_page_path, class: main_nav_class(@current_section, :tos) %>
<%= link_to "Privacy", privacy_page_path, class: main_nav_class(@current_section, :privacy) %>
</div>
</nav>
<% end %>
</div>
</body>
</html>

View File

@ -0,0 +1,17 @@
<%= render HeaderComponent.new(title: "Privacy Policy") %>
<%= render MainSimpleComponent.new do %>
<section>
<%= render EditableContentComponent.new(
context: "privacy", key: "body", rich_text: true,
default: "No content yet. Please add a privacy policy.") %>
<% if current_user.is_admin? %>
<div class="mt-8 pt-6 border-t border-gray-200 text-right">
<%= render EditContentButtonComponent.new(
context: "privacy", key: "body", rich_text: true,
redirect_to: request.path) do %>Edit content<% end %>
</div>
<% end %>
</section>
<% end %>

View File

@ -0,0 +1,17 @@
<%= render HeaderComponent.new(title: "Terms of Service") %>
<%= render MainSimpleComponent.new do %>
<section>
<%= render EditableContentComponent.new(
context: "tos", key: "body", rich_text: true,
default: "No content yet. Please add your terms of service.") %>
<% if current_user.is_admin? %>
<div class="mt-8 pt-6 border-t border-gray-200 text-right">
<%= render EditContentButtonComponent.new(
context: "tos", key: "body", rich_text: true,
redirect_to: request.path) do %>Edit content<% end %>
</div>
<% end %>
</section>
<% end %>

View File

@ -34,7 +34,7 @@
<label class="block">
<p class="font-bold mb-1">Avatar</p>
<p class="text-gray-500">Default profile picture</p>
<div class="flex items-center gap-6">
<div class="flex flex-col sm:flex-row items-center gap-6">
<% if @user.avatar.attached? %>
<p class="flex-none">
<%= image_tag image_url_for(@user.avatar), class: "h-24 w-24 rounded-lg" %>

View File

@ -15,6 +15,8 @@ Rails.application.routes.draw do
match 'signup/:step', to: 'signup#steps', as: :signup_steps, via: [:get, :post]
post 'signup_validate', to: 'signup#validate'
get 'privacy', to: 'pages#privacy', as: :privacy_page
get 'tos', to: 'pages#tos', as: :tos_page
get "users/:username/avatars/:hash", to: "avatars#show", as: :user_avatar