The personal finance app for everyone
Remove unused settings temporarily (#1136)
Zach Gollwitzerc05ee9b5725a
diff --git a/app/controllers/settings/billings_controller.rb b/app/controllers/settings/billings_controller.rbdeleted file mode 100644index c4bdd1f5..00000000--- a/app/controllers/settings/billings_controller.rb+++ /dev/null@@ -1,7 +0,0 @@-class Settings::BillingsController < SettingsController- def edit- end-- def update- end-enddiff --git a/app/controllers/settings/notifications_controller.rb b/app/controllers/settings/notifications_controller.rbdeleted file mode 100644index bb458dc7..00000000--- a/app/controllers/settings/notifications_controller.rb+++ /dev/null@@ -1,7 +0,0 @@-class Settings::NotificationsController < SettingsController- def edit- end-- def update- end-enddiff --git a/app/controllers/settings/securities_controller.rb b/app/controllers/settings/securities_controller.rbdeleted file mode 100644index 9d3bac42..00000000--- a/app/controllers/settings/securities_controller.rb+++ /dev/null@@ -1,7 +0,0 @@-class Settings::SecuritiesController < SettingsController- def edit- end-- def update- end-enddiff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rbindex eca2075c..3f4be356 100644--- a/app/helpers/settings_helper.rb+++ b/app/helpers/settings_helper.rb@@ -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 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]- def previous_setting(title, path)- render partial: "settings/nav_link_large", locals: { path: path, direction: "previous", title: title }+ render partial: "settings/nav_link_large", locals: {+ path: send(adjacent[:path]),+ direction: offset > 0 ? "next" : "previous",+ title: adjacent[:name]+ }enddef 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+ endenddiff --git a/app/views/accounts/index.html.erb b/app/views/accounts/index.html.erbindex 6ef4a852..ec9294a9 100644--- a/app/views/accounts/index.html.erb+++ b/app/views/accounts/index.html.erb@@ -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>diff --git a/app/views/categories/index.html.erb b/app/views/categories/index.html.erbindex f06a59fe..6e79fa13 100644--- a/app/views/categories/index.html.erb+++ b/app/views/categories/index.html.erb@@ -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>diff --git a/app/views/imports/index.html.erb b/app/views/imports/index.html.erbindex c6be1f0f..c62d3b61 100644--- a/app/views/imports/index.html.erb+++ b/app/views/imports/index.html.erb@@ -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>diff --git a/app/views/merchants/index.html.erb b/app/views/merchants/index.html.erbindex 6a31839a..e5fcfbfa 100644--- a/app/views/merchants/index.html.erb+++ b/app/views/merchants/index.html.erb@@ -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>diff --git a/app/views/pages/changelog.html.erb b/app/views/pages/changelog.html.erbindex ba2302a7..df40a0af 100644--- a/app/views/pages/changelog.html.erb+++ b/app/views/pages/changelog.html.erb@@ -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>diff --git a/app/views/pages/feedback.html.erb b/app/views/pages/feedback.html.erbindex af242487..2953316a 100644--- a/app/views/pages/feedback.html.erb+++ b/app/views/pages/feedback.html.erb@@ -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>diff --git a/app/views/pages/invites.html.erb b/app/views/pages/invites.html.erbdeleted file mode 100644index a838cecc..00000000--- a/app/views/pages/invites.html.erb+++ /dev/null@@ -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>diff --git a/app/views/settings/_nav.html.erb b/app/views/settings/_nav.html.erbindex dda0e9db..3ed3c58b 100644--- a/app/views/settings/_nav.html.erb+++ b/app/views/settings/_nav.html.erb@@ -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>diff --git a/app/views/settings/billings/show.html.erb b/app/views/settings/billings/show.html.erbdeleted file mode 100644index 62f0a19f..00000000--- a/app/views/settings/billings/show.html.erb+++ /dev/null@@ -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>diff --git a/app/views/settings/hostings/show.html.erb b/app/views/settings/hostings/show.html.erbindex 4b9dff76..b785a757 100644--- a/app/views/settings/hostings/show.html.erb+++ b/app/views/settings/hostings/show.html.erb@@ -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>diff --git a/app/views/settings/notifications/show.html.erb b/app/views/settings/notifications/show.html.erbdeleted file mode 100644index 3a217fc6..00000000--- a/app/views/settings/notifications/show.html.erb+++ /dev/null@@ -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>diff --git a/app/views/settings/preferences/show.html.erb b/app/views/settings/preferences/show.html.erbindex 0a6609ca..7230cc50 100644--- a/app/views/settings/preferences/show.html.erb+++ b/app/views/settings/preferences/show.html.erb@@ -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>diff --git a/app/views/settings/profiles/show.html.erb b/app/views/settings/profiles/show.html.erbindex edcab295..b2eda05c 100644--- a/app/views/settings/profiles/show.html.erb+++ b/app/views/settings/profiles/show.html.erb@@ -89,7 +89,6 @@</div><% end %></div>- <div class="flex gap-4">- <%= next_setting("Preferences", settings_preferences_path) %>- </div>++ <%= settings_nav_footer %></div>diff --git a/app/views/settings/securities/show.html.erb b/app/views/settings/securities/show.html.erbdeleted file mode 100644index 38fb8db5..00000000--- a/app/views/settings/securities/show.html.erb+++ /dev/null@@ -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>diff --git a/app/views/tags/index.html.erb b/app/views/tags/index.html.erbindex 610939bf..5ba44963 100644--- a/app/views/tags/index.html.erb+++ b/app/views/tags/index.html.erb@@ -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>diff --git a/config/locales/views/settings/en.yml b/config/locales/views/settings/en.ymlindex b1b9d267..5484cf82 100644--- a/config/locales/views/settings/en.yml+++ b/config/locales/views/settings/en.yml@@ -51,23 +51,18 @@ en:success: Settings updated successfully.nav:accounts_label: Accounts- billing_label: Billingcategories_label: Categoriesfeedback_label: Feedbackgeneral_section_title: Generalimports_label: Imports- invite_label: Invite friendsmerchants_label: Merchants- notifications_label: Notificationsother_section_title: Morepreferences_label: Preferencesprofile_label: Account- rules_label: Rules- security_label: Security- self_hosting_label: Self-Hosting+ self_hosting_label: Self hostingtags_label: Tagstransactions_section_title: Transactions- whats_new_label: What's New+ whats_new_label: What's newnav_link_large:next: Nextprevious: Backdiff --git a/config/routes.rb b/config/routes.rbindex c6eff485..63380659 100644--- a/config/routes.rb+++ b/config/routes.rb@@ -3,7 +3,6 @@ Rails.application.routes.draw doget "changelog" => "pages#changelog", as: :changelogget "feedback" => "pages#feedback", as: :feedback- get "invites" => "pages#invites", as: :invitesresource :registrationresource :session@@ -17,12 +16,9 @@ Rails.application.routes.draw donamespace :settings doresource :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] dopost :send_test_email, on: :collectionend- resource :security, only: %i[show update]endresources :imports, except: :show do@@ -58,10 +54,6 @@ Rails.application.routes.draw donamespace :account doresources :transfers, only: %i[new create destroy]-- namespace :transaction do- resources :rules, only: %i[index]- endendresources :accounts dodiff --git a/test/controllers/settings/billings_controller_test.rb b/test/controllers/settings/billings_controller_test.rbdeleted file mode 100644index e69de29b..00000000diff --git a/test/controllers/settings/notifications_controller_test.rb b/test/controllers/settings/notifications_controller_test.rbdeleted file mode 100644index bbd63ffb..00000000--- a/test/controllers/settings/notifications_controller_test.rb+++ /dev/null@@ -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-enddiff --git a/test/controllers/settings/securities_controller_test.rb b/test/controllers/settings/securities_controller_test.rbdeleted file mode 100644index eb5cc481..00000000--- a/test/controllers/settings/securities_controller_test.rb+++ /dev/null@@ -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-enddiff --git a/test/system/settings_test.rb b/test/system/settings_test.rbindex d090b848..07a9434b 100644--- a/test/system/settings_test.rb+++ b/test/system/settings_test.rb@@ -5,20 +5,15 @@ class SettingsTest < ApplicationSystemTestCasesign_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 < ApplicationSystemTestCaseopen_settings_from_sidebarassert_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+ endendprivate