1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 13:19:39 +02:00

Remove unused settings temporarily (#1136)

This commit is contained in:
Zach Gollwitzer 2024-08-27 17:10:31 -04:00 committed by GitHub
parent 38c2b4670c
commit c05ee9b572
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 84 additions and 207 deletions

View file

@ -1,7 +0,0 @@
class Settings::BillingsController < SettingsController
def edit
end
def update
end
end

View file

@ -1,7 +0,0 @@
class Settings::NotificationsController < SettingsController
def edit
end
def update
end
end

View file

@ -1,7 +0,0 @@
class Settings::SecuritiesController < SettingsController
def edit
end
def update
end
end

View file

@ -1,14 +1,46 @@
module SettingsHelper
def next_setting(title, path)
render partial: "settings/nav_link_large", locals: { path: path, direction: "next", title: title }
end
SETTINGS_ORDER = [
{ name: I18n.t("settings.nav.profile_label"), path: :settings_profile_path },
{ name: I18n.t("settings.nav.preferences_label"), path: :settings_preferences_path },
{ name: I18n.t("settings.nav.self_hosting_label"), path: :settings_hosting_path, condition: :self_hosted? },
{ name: I18n.t("settings.nav.accounts_label"), path: :accounts_path },
{ name: I18n.t("settings.nav.tags_label"), path: :tags_path },
{ name: I18n.t("settings.nav.categories_label"), path: :categories_path },
{ name: I18n.t("settings.nav.merchants_label"), path: :merchants_path },
{ name: I18n.t("settings.nav.imports_label"), path: :imports_path },
{ name: I18n.t("settings.nav.whats_new_label"), path: :changelog_path },
{ name: I18n.t("settings.nav.feedback_label"), path: :feedback_path }
]
def previous_setting(title, path)
render partial: "settings/nav_link_large", locals: { path: path, direction: "previous", title: title }
def adjacent_setting(current_path, offset)
visible_settings = SETTINGS_ORDER.select { |setting| setting[:condition].nil? || send(setting[:condition]) }
current_index = visible_settings.index { |setting| send(setting[:path]) == current_path }
return nil unless current_index
adjacent_index = current_index + offset
return nil if adjacent_index < 0 || adjacent_index >= visible_settings.size
adjacent = visible_settings[adjacent_index]
render partial: "settings/nav_link_large", locals: {
path: send(adjacent[:path]),
direction: offset > 0 ? "next" : "previous",
title: adjacent[:name]
}
end
def settings_section(title:, subtitle: nil, &block)
content = capture(&block)
render partial: "settings/section", locals: { title: title, subtitle: subtitle, content: content }
end
def settings_nav_footer
previous_setting = adjacent_setting(request.path, -1)
next_setting = adjacent_setting(request.path, 1)
content_tag :div, class: "flex justify-between gap-4" do
concat(previous_setting)
concat(next_setting)
end
end
end

View file

@ -42,12 +42,5 @@
</div>
<% end %>
<div class="flex justify-between gap-4">
<% if self_hosted? %>
<%= previous_setting("Self-Hosting", settings_hosting_path) %>
<% else %>
<%= previous_setting("Billing", settings_billing_path) %>
<% end %>
<%= next_setting("Tags", tags_path) %>
</div>
<%= settings_nav_footer %>
</div>

View file

@ -40,8 +40,5 @@
<% end %>
</div>
<footer class="flex justify-between gap-4">
<%= previous_setting("Tags", tags_path) %>
<%= next_setting("Merchants", merchants_path) %>
</footer>
<%= settings_nav_footer %>
</section>

View file

@ -24,8 +24,6 @@
</div>
<% end %>
</div>
<div class="flex justify-between gap-4">
<%= previous_setting("Rules", rules_transactions_path) %>
<%= next_setting("What's new", changelog_path) %>
</div>
<%= settings_nav_footer %>
</div>

View file

@ -40,8 +40,5 @@
<% end %>
</div>
<footer class="flex justify-between gap-4">
<%= previous_setting("Categories", categories_path) %>
<%= next_setting("Rules", rules_transactions_path) %>
</footer>
</section>
<%= settings_nav_footer %>
</div>

View file

@ -1,6 +1,7 @@
<% content_for :sidebar do %>
<%= render "settings/nav" %>
<% end %>
<div class="space-y-4">
<h1 class="text-gray-900 text-xl font-medium mb-4"><%= t(".title") %></h1>
<div class="bg-white shadow-xs border border-alpha-black-25 rounded-xl p-4">
@ -11,12 +12,12 @@
<div class="text-white shrink-0 w-9 h-9">
<%= image_tag release_notes[:avatar], class: "rounded-full w-full h-full object-cover" %>
</div>
<div>
<div class="text-gray-900 font-medium text-sm"><%= release_notes[:name] %></div>
<div class="text-gray-500 text-sm"><%= release_notes[:published_at].strftime("%B %d, %Y") %></div>
<div>
<div class="text-gray-900 font-medium text-sm"><%= release_notes[:name] %></div>
<div class="text-gray-500 text-sm"><%= release_notes[:published_at].strftime("%B %d, %Y") %></div>
</div>
</div>
</div>
</div>
<div class="w-2/3 text-gray-500 text-sm prose prose--github-release-notes">
<h2 class="mb-5 text-xl text-gray-900"><%= release_notes[:name] %></h2>
<%= release_notes[:body].html_safe %>
@ -24,8 +25,6 @@
</div>
<% end %>
</div>
<div class="flex justify-between gap-4">
<%= previous_setting("Imports", imports_path) %>
<%= next_setting("Feedback", feedback_path) %>
</div>
<%= settings_nav_footer %>
</div>

View file

@ -1,6 +1,7 @@
<% content_for :sidebar do %>
<%= render "settings/nav" %>
<% end %>
<div class="space-y-4">
<h1 class="text-gray-900 text-xl font-medium mb-4">Feedback</h1>
<div class="bg-white shadow-xs border border-alpha-black-25 rounded-xl p-4">
@ -8,8 +9,6 @@
<p class="text-gray-500">Feedback coming soon...</p>
</div>
</div>
<div class="flex justify-between gap-4">
<%= previous_setting("What's New", changelog_path) %>
<%= next_setting("Invite friends", invites_path) %>
</div>
<%= settings_nav_footer %>
</div>

View file

@ -1,14 +0,0 @@
<% content_for :sidebar do %>
<%= render "settings/nav" %>
<% end %>
<div class="space-y-4">
<h1 class="text-gray-900 text-xl font-medium mb-4">Invite friends</h1>
<div class="bg-white shadow-xs border border-alpha-black-25 rounded-xl p-4">
<div class="flex justify-center items-center py-20">
<p class="text-gray-500">Invite friends coming soon...</p>
</div>
</div>
<div class="flex justify-between gap-4">
<%= previous_setting("Feedback", feedback_path) %>
</div>
</div>

View file

@ -20,15 +20,6 @@
<li>
<%= sidebar_link_to t(".preferences_label"), settings_preferences_path, icon: "bolt" %>
</li>
<li>
<%= sidebar_link_to t(".notifications_label"), settings_notifications_path, icon: "bell-dot" %>
</li>
<li>
<%= sidebar_link_to t(".security_label"), settings_security_path, icon: "shield-check" %>
</li>
<li>
<%= sidebar_link_to t(".billing_label"), settings_billing_path, icon: "circle-dollar-sign" %>
</li>
<% if self_hosted? %>
<li>
<%= sidebar_link_to t(".self_hosting_label"), settings_hosting_path, icon: "database" %>
@ -55,9 +46,6 @@
<li>
<%= sidebar_link_to t(".merchants_label"), merchants_path, icon: "store" %>
</li>
<li>
<%= sidebar_link_to t(".rules_label"), rules_transactions_path, icon: "list-checks" %>
</li>
<li>
<%= sidebar_link_to t(".imports_label"), imports_path, icon: "download" %>
</li>
@ -72,7 +60,6 @@
<li>
<%= sidebar_link_to t(".whats_new_label"), changelog_path, icon: "box" %>
<%= sidebar_link_to t(".feedback_label"), feedback_path, icon: "megaphone" %>
<%= sidebar_link_to t(".invite_label"), invites_path, icon: "gift" %>
</li>
</ul>
</section>

View file

@ -1,19 +0,0 @@
<% content_for :sidebar do %>
<%= render "settings/nav" %>
<% end %>
<div class="space-y-4">
<h1 class="text-gray-900 text-xl font-medium mb-4">Billing</h1>
<div class="bg-white shadow-xs border border-alpha-black-25 rounded-xl p-4">
<div class="flex justify-center items-center py-20">
<p class="text-gray-500">Billing settings coming soon...</p>
</div>
</div>
<div class="flex justify-between gap-4">
<%= previous_setting("Security", settings_security_path) %>
<% if self_hosted? %>
<%= next_setting("Self-Hosting", settings_hosting_path) %>
<% else %>
<%= next_setting("Accounts", accounts_path) %>
<% end %>
</div>
</div>

View file

@ -1,6 +1,7 @@
<% content_for :sidebar do %>
<%= render "settings/nav" %>
<% end %>
<div class="space-y-4">
<h1 class="text-gray-900 text-xl font-medium mb-4"><%= t(".page_title") %></h1>
<%= settings_section title: t(".general_settings_title") do %>
@ -17,8 +18,8 @@
<span class="font-medium"><%= t(".upgrades.manual.title") %></span>
<br>
<span class="text-gray-500">
<%= t(".upgrades.manual.description") %>
</span>
<%= t(".upgrades.manual.description") %>
</span>
<% end %>
</div>
<div class="flex items-center gap-4">
@ -27,8 +28,8 @@
<span class="font-medium"><%= t(".upgrades.latest_release.title") %></span>
<br>
<span class="text-gray-500">
<%= t(".upgrades.latest_release.description") %>
</span>
<%= t(".upgrades.latest_release.description") %>
</span>
<% end %>
</div>
<div class="flex items-center gap-4">
@ -37,8 +38,8 @@
<span class="font-medium"><%= t(".upgrades.latest_commit.title") %></span>
<br>
<span class="text-gray-500">
<%= t(".upgrades.latest_commit.description") %>
</span>
<%= t(".upgrades.latest_commit.description") %>
</span>
<% end %>
</div>
</div>
@ -82,8 +83,5 @@
<% end %>
<% end %>
<div class="flex justify-between gap-4">
<%= previous_setting("Billing", settings_billing_path) %>
<%= next_setting("Accounts", accounts_path) %>
</div>
<%= settings_nav_footer %>
</div>

View file

@ -1,15 +0,0 @@
<% content_for :sidebar do %>
<%= render "settings/nav" %>
<% end %>
<div class="space-y-4">
<h1 class="text-gray-900 text-xl font-medium mb-4">Notifications</h1>
<div class="bg-white shadow-xs border border-alpha-black-25 rounded-xl p-4">
<div class="flex justify-center items-center py-20">
<p class="text-gray-500">Notifications coming soon...</p>
</div>
</div>
<div class="flex justify-between gap-4">
<%= previous_setting("Preferences", settings_preferences_path) %>
<%= next_setting("Security", settings_security_path) %>
</div>
</div>

View file

@ -1,6 +1,7 @@
<% content_for :sidebar do %>
<%= render "settings/nav" %>
<% end %>
<div class="space-y-4">
<h1 class="text-gray-900 text-xl font-medium mb-4"><%= t(".page_title") %></h1>
<%= settings_section title: t(".general_title"), subtitle: t(".general_subtitle") do %>
@ -39,8 +40,6 @@
<% end %>
</div>
<% end %>
<div class="flex justify-between gap-4">
<%= previous_setting("Account", settings_profile_path) %>
<%= next_setting("Notifications", settings_notifications_path) %>
</div>
<%= settings_nav_footer %>
</div>

View file

@ -89,7 +89,6 @@
</div>
<% end %>
</div>
<div class="flex gap-4">
<%= next_setting("Preferences", settings_preferences_path) %>
</div>
<%= settings_nav_footer %>
</div>

View file

@ -1,15 +0,0 @@
<% content_for :sidebar do %>
<%= render "settings/nav" %>
<% end %>
<div class="space-y-4">
<h1 class="text-gray-900 text-xl font-medium mb-4">Security</h1>
<div class="bg-white shadow-xs border border-alpha-black-25 rounded-xl p-4">
<div class="flex justify-center items-center py-20">
<p class="text-gray-500">Security settings coming soon...</p>
</div>
</div>
<div class="flex justify-between gap-4">
<%= previous_setting("Notifications", settings_notifications_path) %>
<%= next_setting("Billing", settings_billing_path) %>
</div>
</div>

View file

@ -40,8 +40,5 @@
<% end %>
</div>
<footer class="flex justify-between gap-4">
<%= previous_setting("Accounts", accounts_path) %>
<%= next_setting("Categories", categories_path) %>
</footer>
<%= settings_nav_footer %>
</section>

View file

@ -51,23 +51,18 @@ en:
success: Settings updated successfully.
nav:
accounts_label: Accounts
billing_label: Billing
categories_label: Categories
feedback_label: Feedback
general_section_title: General
imports_label: Imports
invite_label: Invite friends
merchants_label: Merchants
notifications_label: Notifications
other_section_title: More
preferences_label: Preferences
profile_label: Account
rules_label: Rules
security_label: Security
self_hosting_label: Self-Hosting
self_hosting_label: Self hosting
tags_label: Tags
transactions_section_title: Transactions
whats_new_label: What's New
whats_new_label: What's new
nav_link_large:
next: Next
previous: Back

View file

@ -3,7 +3,6 @@ Rails.application.routes.draw do
get "changelog" => "pages#changelog", as: :changelog
get "feedback" => "pages#feedback", as: :feedback
get "invites" => "pages#invites", as: :invites
resource :registration
resource :session
@ -17,12 +16,9 @@ Rails.application.routes.draw do
namespace :settings do
resource :profile, only: %i[show update destroy]
resource :preferences, only: %i[show update]
resource :notifications, only: %i[show update]
resource :billing, only: %i[show update]
resource :hosting, only: %i[show update] do
post :send_test_email, on: :collection
end
resource :security, only: %i[show update]
end
resources :imports, except: :show do
@ -58,10 +54,6 @@ Rails.application.routes.draw do
namespace :account do
resources :transfers, only: %i[new create destroy]
namespace :transaction do
resources :rules, only: %i[index]
end
end
resources :accounts do

View file

@ -1,11 +0,0 @@
require "test_helper"
class Settings::NotificationsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in users(:family_admin)
end
test "get" do
get settings_notifications_url
assert_response :success
end
end

View file

@ -1,11 +0,0 @@
require "test_helper"
class Settings::SecuritiesControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in users(:family_admin)
end
test "get" do
get settings_security_url
assert_response :success
end
end

View file

@ -5,20 +5,15 @@ class SettingsTest < ApplicationSystemTestCase
sign_in @user = users(:family_admin)
@settings_links = [
[ "Account", "Account", settings_profile_path ],
[ "Preferences", "Preferences", settings_preferences_path ],
[ "Notifications", "Notifications", settings_notifications_path ],
[ "Security", "Security", settings_security_path ],
[ "Billing", "Billing", settings_billing_path ],
[ "Accounts", "Accounts", accounts_path ],
[ "Tags", "Tags", tags_path ],
[ "Categories", "Categories", categories_path ],
[ "Merchants", "Merchants", merchants_path ],
[ "Rules", "Rules", rules_transactions_path ],
[ "Imports", "Imports", imports_path ],
[ "What's New", "What's New", changelog_path ],
[ "Feedback", "Feedback", feedback_path ],
[ "Invite friends", "Invite friends", invites_path ]
[ "Account", settings_profile_path ],
[ "Preferences", settings_preferences_path ],
[ "Accounts", accounts_path ],
[ "Tags", tags_path ],
[ "Categories", categories_path ],
[ "Merchants", merchants_path ],
[ "Imports", imports_path ],
[ "What's new", changelog_path ],
[ "Feedback", feedback_path ]
]
end
@ -26,6 +21,12 @@ class SettingsTest < ApplicationSystemTestCase
open_settings_from_sidebar
assert_selector "h1", text: "Account"
assert_current_path settings_profile_path
@settings_links.each do |name, path|
click_link name
assert_selector "h1", text: name
assert_current_path path
end
end
private