diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index fce6e71f..131de698 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -2,6 +2,18 @@ class AccountsController < ApplicationController include Filterable before_action :set_account, only: %i[ show update destroy sync ] + def index + @accounts = Current.family.accounts + end + + def summary + snapshot = Current.family.snapshot(@period) + @net_worth_series = snapshot[:net_worth_series] + @asset_series = snapshot[:asset_series] + @liability_series = snapshot[:liability_series] + @account_groups = Current.family.accounts.by_group(period: @period, currency: Current.family.currency) + end + def new @account = Account.new( balance: nil, diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 7c10feb5..3ca53b26 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -8,4 +8,13 @@ class PagesController < ApplicationController @liability_series = snapshot[:liability_series] @account_groups = Current.family.accounts.by_group(period: @period, currency: Current.family.currency) end + + def changelog + end + + def feedback + end + + def invites + end end diff --git a/app/controllers/settings/billings_controller.rb b/app/controllers/settings/billings_controller.rb new file mode 100644 index 00000000..d218beaa --- /dev/null +++ b/app/controllers/settings/billings_controller.rb @@ -0,0 +1,7 @@ +class Settings::BillingsController < ApplicationController + def edit + end + + def update + end +end diff --git a/app/controllers/settings/hostings_controller.rb b/app/controllers/settings/hostings_controller.rb new file mode 100644 index 00000000..7d3a6639 --- /dev/null +++ b/app/controllers/settings/hostings_controller.rb @@ -0,0 +1,46 @@ +class Settings::HostingsController < ApplicationController + before_action :verify_hosting_mode + + def show + end + + def update + if all_updates_valid? + hosting_params.keys.each do |key| + Setting.send("#{key}=", hosting_params[key].strip) + end + + redirect_to settings_hosting_path, notice: t(".success") + else + flash.now[:error] = @errors.first.message + render :edit, status: :unprocessable_entity + end + end + + private + def all_updates_valid? + @errors = ActiveModel::Errors.new(Setting) + hosting_params.keys.each do |key| + setting = Setting.new(var: key) + setting.value = hosting_params[key].strip + + unless setting.valid? + @errors.merge!(setting.errors) + end + end + + if hosting_params[:upgrades_mode] == "auto" && hosting_params[:render_deploy_hook].blank? + @errors.add(:render_deploy_hook, t("settings.hostings.update.render_deploy_hook_error")) + end + + @errors.empty? + end + + def hosting_params + params.require(:setting).permit(:render_deploy_hook, :upgrades_mode, :upgrades_target) + end + + def verify_hosting_mode + head :not_found unless self_hosted? + end +end diff --git a/app/controllers/settings/notifications_controller.rb b/app/controllers/settings/notifications_controller.rb new file mode 100644 index 00000000..8fceff14 --- /dev/null +++ b/app/controllers/settings/notifications_controller.rb @@ -0,0 +1,7 @@ +class Settings::NotificationsController < ApplicationController + def edit + end + + def update + end +end diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb new file mode 100644 index 00000000..aecbce53 --- /dev/null +++ b/app/controllers/settings/preferences_controller.rb @@ -0,0 +1,7 @@ +class Settings::PreferencesController < ApplicationController + def edit + end + + def update + end +end diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings/profiles_controller.rb similarity index 90% rename from app/controllers/settings_controller.rb rename to app/controllers/settings/profiles_controller.rb index b990f90b..d510bf05 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings/profiles_controller.rb @@ -1,5 +1,5 @@ -class SettingsController < ApplicationController - def edit +class Settings::ProfilesController < ApplicationController + def show end def update diff --git a/app/controllers/settings/securities_controller.rb b/app/controllers/settings/securities_controller.rb new file mode 100644 index 00000000..6e49acf0 --- /dev/null +++ b/app/controllers/settings/securities_controller.rb @@ -0,0 +1,7 @@ +class Settings::SecuritiesController < ApplicationController + def edit + end + + def update + end +end diff --git a/app/controllers/settings/self_hosting_controller.rb b/app/controllers/settings/self_hosting_controller.rb deleted file mode 100644 index 7bd71791..00000000 --- a/app/controllers/settings/self_hosting_controller.rb +++ /dev/null @@ -1,46 +0,0 @@ -class Settings::SelfHostingController < ApplicationController - before_action :verify_self_hosting_enabled - - def edit - end - - def update - if all_updates_valid? - self_hosting_params.keys.each do |key| - Setting.send("#{key}=", self_hosting_params[key].strip) - end - - redirect_to edit_settings_self_hosting_path, notice: t(".success") - else - flash.now[:error] = @errors.first.message - render :edit, status: :unprocessable_entity - end - end - - private - def all_updates_valid? - @errors = ActiveModel::Errors.new(Setting) - self_hosting_params.keys.each do |key| - setting = Setting.new(var: key) - setting.value = self_hosting_params[key].strip - - unless setting.valid? - @errors.merge!(setting.errors) - end - end - - if self_hosting_params[:upgrades_mode] == "auto" && self_hosting_params[:render_deploy_hook].blank? - @errors.add(:render_deploy_hook, t("settings.self_hosting.update.render_deploy_hook_error")) - end - - @errors.empty? - end - - def self_hosting_params - params.require(:setting).permit(:render_deploy_hook, :upgrades_mode, :upgrades_target) - end - - def verify_self_hosting_enabled - head :not_found unless self_hosted? - end -end diff --git a/app/controllers/transactions/categories_controller.rb b/app/controllers/transactions/categories_controller.rb index 9a1834b1..036ea4bf 100644 --- a/app/controllers/transactions/categories_controller.rb +++ b/app/controllers/transactions/categories_controller.rb @@ -1,6 +1,9 @@ class Transactions::CategoriesController < ApplicationController before_action :set_category, only: [ :update, :destroy ] + def index + end + def create if Current.family.transaction_categories.create(category_params) redirect_to transactions_path, notice: t(".success") diff --git a/app/controllers/transactions/merchants_controller.rb b/app/controllers/transactions/merchants_controller.rb new file mode 100644 index 00000000..dae8ba3a --- /dev/null +++ b/app/controllers/transactions/merchants_controller.rb @@ -0,0 +1,4 @@ +class Transactions::MerchantsController < ApplicationController + def index + end +end diff --git a/app/controllers/transactions/rules_controller.rb b/app/controllers/transactions/rules_controller.rb new file mode 100644 index 00000000..ff27f690 --- /dev/null +++ b/app/controllers/transactions/rules_controller.rb @@ -0,0 +1,4 @@ +class Transactions::RulesController < ApplicationController + def index + end +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 87913e3c..d37472bd 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -38,21 +38,16 @@ module ApplicationHelper end def sidebar_link_to(name, path, options = {}) - base_class_names = [ "block", "border", "border-transparent", "rounded-xl", "-ml-2", "p-2", "text-sm", "font-medium", "text-gray-500", "flex", "items-center" ] - hover_class_names = [ "hover:bg-white", "hover:border-alpha-black-50", "hover:text-gray-900", "hover:shadow-xs" ] - current_page_class_names = [ "bg-white", "border-alpha-black-50", "text-gray-900", "shadow-xs" ] + is_current = current_page?(path) || (request.path.start_with?(path) && path != "/") - link_class_names = if current_page?(path) || (request.path.start_with?(path) && path != "/") - base_class_names.delete("border-transparent") - base_class_names + hover_class_names + current_page_class_names - else - base_class_names + hover_class_names - end + classes = [ + "flex items-center gap-2 px-3 py-2 rounded-xl border text-sm font-medium text-gray-500", + (is_current ? "bg-white text-gray-900 shadow-xs border-alpha-black-50" : "hover:bg-gray-100 border-transparent") + ].compact.join(" ") - merged_options = options.reverse_merge(class: link_class_names.join(" ")).except(:icon) - - link_to path, merged_options do - lucide_icon(options[:icon], class: "w-5 h-5 mr-2") + name + link_to path, **options.merge(class: classes), aria: { current: ("page" if current_page?(path)) } do + concat(lucide_icon(options[:icon], class: "w-5 h-5")) if options[:icon] + concat(name) end end diff --git a/app/helpers/settings/hosting_helper.rb b/app/helpers/settings/hosting_helper.rb new file mode 100644 index 00000000..b92b592b --- /dev/null +++ b/app/helpers/settings/hosting_helper.rb @@ -0,0 +1,2 @@ +module Settings::HostingHelper +end diff --git a/app/helpers/settings/self_hosting_helper.rb b/app/helpers/settings/self_hosting_helper.rb deleted file mode 100644 index 7240b433..00000000 --- a/app/helpers/settings/self_hosting_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module Settings::SelfHostingHelper -end diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb new file mode 100644 index 00000000..f62f9af1 --- /dev/null +++ b/app/helpers/settings_helper.rb @@ -0,0 +1,9 @@ +module SettingsHelper + def next_setting(title, path) + render partial: "settings/nav_link_large", locals: { path: path, direction: "next", title: title } + end + + def previous_setting(title, path) + render partial: "settings/nav_link_large", locals: { path: path, direction: "previous", title: title } + end +end diff --git a/app/javascript/controllers/hotkey_controller.js b/app/javascript/controllers/hotkey_controller.js index 88df7f9d..b7b346e3 100644 --- a/app/javascript/controllers/hotkey_controller.js +++ b/app/javascript/controllers/hotkey_controller.js @@ -1,13 +1,17 @@ -import { Controller } from "@hotwired/stimulus" -import { install, uninstall } from "@github/hotkey" +import { Controller } from "@hotwired/stimulus"; +import { install, uninstall } from "@github/hotkey"; // Connects to data-controller="hotkey" export default class extends Controller { connect() { - install(this.element) + install(this.element); } disconnect() { - uninstall(this.element) + uninstall(this.element); + } + + navigateBack(event) { + window.history.back(); } } diff --git a/app/javascript/tailwindColors.js b/app/javascript/tailwindColors.js index 5006b01d..2f5e1a4f 100644 --- a/app/javascript/tailwindColors.js +++ b/app/javascript/tailwindColors.js @@ -38,17 +38,17 @@ export default { 900: "rgba(255, 255, 255, 0.7)", }, "alpha-black": { - 25: "rgba(20, 20, 20, 0.03)", - 50: "rgba(20, 20, 20, 0.05)", - 100: "rgba(20, 20, 20, 0.08)", - 200: "rgba(20, 20, 20, 0.1)", - 300: "rgba(20, 20, 20, 0.15)", - 400: "rgba(20, 20, 20, 0.2)", - 500: "rgba(20, 20, 20, 0.3)", - 600: "rgba(20, 20, 20, 0.4)", - 700: "rgba(20, 20, 20, 0.5)", - 800: "rgba(20, 20, 20, 0.6)", - 900: "rgba(20, 20, 20, 0.7)", + 25: "rgba(11, 11, 11, 0.03)", + 50: "rgba(11, 11, 11, 0.05)", + 100: "rgba(11, 11, 11, 0.08)", + 200: "rgba(11, 11, 11, 0.1)", + 300: "rgba(11, 11, 11, 0.15)", + 400: "rgba(11, 11, 11, 0.2)", + 500: "rgba(11, 11, 11, 0.3)", + 600: "rgba(11, 11, 11, 0.4)", + 700: "rgba(11, 11, 11, 0.5)", + 800: "rgba(11, 11, 11, 0.6)", + 900: "rgba(11, 11, 11, 0.7)", }, red: { 25: "#FFFBFB", diff --git a/app/views/accounts/index.html.erb b/app/views/accounts/index.html.erb index b0ecf2b9..c14d2aa3 100644 --- a/app/views/accounts/index.html.erb +++ b/app/views/accounts/index.html.erb @@ -1,3 +1,6 @@ +<% content_for :sidebar do %> + <%= render "settings/nav" %> +<% end %>
No accounts yet
@@ -19,8 +22,8 @@<%= t(".new") %>
+ <% end %> + <%= form_with url: summary_accounts_path, method: :get, class: "flex items-center gap-4", data: { controller: "auto-submit-form" } do %> + <%= render partial: "shared/period_select", locals: { value: @period.name } %> + <% end %> +<%= t(".new") %>
+ <% end %> + <%= form_with url: summary_accounts_path, method: :get, class: "flex items-center gap-4", data: { controller: "auto-submit-form" } do %> + <%= render partial: "shared/period_select", locals: { value: @period.name } %> + <% end %> +<%= t(".new_account") %>
+ <% end %> + <% account_groups.each do |group| %> + <%= render "accounts/account_list", group: group %> + <% end %> +<%= t(".new_account") %>
- <% end %> - <% account_groups.each do |group| %> - <%= render "accounts/account_list", group: group %> - <% end %> -Self-hosted Maybe: <%= Maybe.version.to_release_tag %>
+ <%= link_to settings_hosting_path, class: "flex gap-1 items-center hover:bg-gray-50 rounded-md p-2" do %> + <%= lucide_icon("settings", class: "w-4 h-4 text-gray-500 shrink-0") %> + <% end %> +