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 module SettingsHelper
def next_setting(title, path) SETTINGS_ORDER = [
render partial: "settings/nav_link_large", locals: { path: path, direction: "next", title: title } { name: I18n.t("settings.nav.profile_label"), path: :settings_profile_path },
end { 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) def adjacent_setting(current_path, offset)
render partial: "settings/nav_link_large", locals: { path: path, direction: "previous", title: title } 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 end
def settings_section(title:, subtitle: nil, &block) def settings_section(title:, subtitle: nil, &block)
content = capture(&block) content = capture(&block)
render partial: "settings/section", locals: { title: title, subtitle: subtitle, content: content } render partial: "settings/section", locals: { title: title, subtitle: subtitle, content: content }
end 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 end

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,7 @@
<% content_for :sidebar do %> <% content_for :sidebar do %>
<%= render "settings/nav" %> <%= render "settings/nav" %>
<% end %> <% end %>
<div class="space-y-4"> <div class="space-y-4">
<h1 class="text-gray-900 text-xl font-medium mb-4"><%= t(".title") %></h1> <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"> <div class="bg-white shadow-xs border border-alpha-black-25 rounded-xl p-4">
@ -24,8 +25,6 @@
</div> </div>
<% end %> <% end %>
</div> </div>
<div class="flex justify-between gap-4">
<%= previous_setting("Imports", imports_path) %> <%= settings_nav_footer %>
<%= next_setting("Feedback", feedback_path) %>
</div>
</div> </div>

View file

@ -1,6 +1,7 @@
<% content_for :sidebar do %> <% content_for :sidebar do %>
<%= render "settings/nav" %> <%= render "settings/nav" %>
<% end %> <% end %>
<div class="space-y-4"> <div class="space-y-4">
<h1 class="text-gray-900 text-xl font-medium mb-4">Feedback</h1> <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"> <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> <p class="text-gray-500">Feedback coming soon...</p>
</div> </div>
</div> </div>
<div class="flex justify-between gap-4">
<%= previous_setting("What's New", changelog_path) %> <%= settings_nav_footer %>
<%= next_setting("Invite friends", invites_path) %>
</div>
</div> </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> <li>
<%= sidebar_link_to t(".preferences_label"), settings_preferences_path, icon: "bolt" %> <%= sidebar_link_to t(".preferences_label"), settings_preferences_path, icon: "bolt" %>
</li> </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? %> <% if self_hosted? %>
<li> <li>
<%= sidebar_link_to t(".self_hosting_label"), settings_hosting_path, icon: "database" %> <%= sidebar_link_to t(".self_hosting_label"), settings_hosting_path, icon: "database" %>
@ -55,9 +46,6 @@
<li> <li>
<%= sidebar_link_to t(".merchants_label"), merchants_path, icon: "store" %> <%= sidebar_link_to t(".merchants_label"), merchants_path, icon: "store" %>
</li> </li>
<li>
<%= sidebar_link_to t(".rules_label"), rules_transactions_path, icon: "list-checks" %>
</li>
<li> <li>
<%= sidebar_link_to t(".imports_label"), imports_path, icon: "download" %> <%= sidebar_link_to t(".imports_label"), imports_path, icon: "download" %>
</li> </li>
@ -72,7 +60,6 @@
<li> <li>
<%= sidebar_link_to t(".whats_new_label"), changelog_path, icon: "box" %> <%= 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(".feedback_label"), feedback_path, icon: "megaphone" %>
<%= sidebar_link_to t(".invite_label"), invites_path, icon: "gift" %>
</li> </li>
</ul> </ul>
</section> </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 %> <% content_for :sidebar do %>
<%= render "settings/nav" %> <%= render "settings/nav" %>
<% end %> <% end %>
<div class="space-y-4"> <div class="space-y-4">
<h1 class="text-gray-900 text-xl font-medium mb-4"><%= t(".page_title") %></h1> <h1 class="text-gray-900 text-xl font-medium mb-4"><%= t(".page_title") %></h1>
<%= settings_section title: t(".general_settings_title") do %> <%= settings_section title: t(".general_settings_title") do %>
@ -82,8 +83,5 @@
<% end %> <% end %>
<% end %> <% end %>
<div class="flex justify-between gap-4"> <%= settings_nav_footer %>
<%= previous_setting("Billing", settings_billing_path) %>
<%= next_setting("Accounts", accounts_path) %>
</div>
</div> </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 %> <% content_for :sidebar do %>
<%= render "settings/nav" %> <%= render "settings/nav" %>
<% end %> <% end %>
<div class="space-y-4"> <div class="space-y-4">
<h1 class="text-gray-900 text-xl font-medium mb-4"><%= t(".page_title") %></h1> <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 %> <%= settings_section title: t(".general_title"), subtitle: t(".general_subtitle") do %>
@ -39,8 +40,6 @@
<% end %> <% end %>
</div> </div>
<% end %> <% end %>
<div class="flex justify-between gap-4">
<%= previous_setting("Account", settings_profile_path) %> <%= settings_nav_footer %>
<%= next_setting("Notifications", settings_notifications_path) %>
</div>
</div> </div>

View file

@ -89,7 +89,6 @@
</div> </div>
<% end %> <% end %>
</div> </div>
<div class="flex gap-4">
<%= next_setting("Preferences", settings_preferences_path) %> <%= settings_nav_footer %>
</div>
</div> </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 %> <% end %>
</div> </div>
<footer class="flex justify-between gap-4"> <%= settings_nav_footer %>
<%= previous_setting("Accounts", accounts_path) %>
<%= next_setting("Categories", categories_path) %>
</footer>
</section> </section>

View file

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

View file

@ -3,7 +3,6 @@ Rails.application.routes.draw do
get "changelog" => "pages#changelog", as: :changelog get "changelog" => "pages#changelog", as: :changelog
get "feedback" => "pages#feedback", as: :feedback get "feedback" => "pages#feedback", as: :feedback
get "invites" => "pages#invites", as: :invites
resource :registration resource :registration
resource :session resource :session
@ -17,12 +16,9 @@ Rails.application.routes.draw do
namespace :settings do namespace :settings do
resource :profile, only: %i[show update destroy] resource :profile, only: %i[show update destroy]
resource :preferences, only: %i[show update] 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 resource :hosting, only: %i[show update] do
post :send_test_email, on: :collection post :send_test_email, on: :collection
end end
resource :security, only: %i[show update]
end end
resources :imports, except: :show do resources :imports, except: :show do
@ -58,10 +54,6 @@ Rails.application.routes.draw do
namespace :account do namespace :account do
resources :transfers, only: %i[new create destroy] resources :transfers, only: %i[new create destroy]
namespace :transaction do
resources :rules, only: %i[index]
end
end end
resources :accounts do 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) sign_in @user = users(:family_admin)
@settings_links = [ @settings_links = [
[ "Account", "Account", settings_profile_path ], [ "Account", settings_profile_path ],
[ "Preferences", "Preferences", settings_preferences_path ], [ "Preferences", settings_preferences_path ],
[ "Notifications", "Notifications", settings_notifications_path ], [ "Accounts", accounts_path ],
[ "Security", "Security", settings_security_path ], [ "Tags", tags_path ],
[ "Billing", "Billing", settings_billing_path ], [ "Categories", categories_path ],
[ "Accounts", "Accounts", accounts_path ], [ "Merchants", merchants_path ],
[ "Tags", "Tags", tags_path ], [ "Imports", imports_path ],
[ "Categories", "Categories", categories_path ], [ "What's new", changelog_path ],
[ "Merchants", "Merchants", merchants_path ], [ "Feedback", feedback_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 ]
] ]
end end
@ -26,6 +21,12 @@ class SettingsTest < ApplicationSystemTestCase
open_settings_from_sidebar open_settings_from_sidebar
assert_selector "h1", text: "Account" assert_selector "h1", text: "Account"
assert_current_path settings_profile_path 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 end
private private