Reorganize Settings sections + add LLM model/prompt configs (#116)

* Reshuffle/organize settings UI
* Settings: AI prompt display/minor touch-ups
* API key settings tests
* Moved import/export together
* Collapsible LLM prompt DIVs
* Add export tests
This commit is contained in:
Juan José Mata
2025-08-22 11:43:24 -07:00
committed by GitHub
parent fb6e094f78
commit d054cd0bb2
38 changed files with 1036 additions and 420 deletions

View File

@@ -2,7 +2,7 @@ class FamilyExportsController < ApplicationController
include StreamExtensions
before_action :require_admin
before_action :set_export, only: [ :download ]
before_action :set_export, only: [ :download, :destroy ]
def new
# Modal view for initiating export
@@ -13,9 +13,9 @@ class FamilyExportsController < ApplicationController
FamilyDataExportJob.perform_later(@export)
respond_to do |format|
format.html { redirect_to settings_profile_path, notice: "Export started. You'll be able to download it shortly." }
format.html { redirect_to imports_path, notice: "Export started. You'll be able to download it shortly." }
format.turbo_stream {
stream_redirect_to settings_profile_path, notice: "Export started. You'll be able to download it shortly."
stream_redirect_to imports_path, notice: "Export started. You'll be able to download it shortly."
}
end
end
@@ -29,10 +29,15 @@ class FamilyExportsController < ApplicationController
if @export.downloadable?
redirect_to @export.export_file, allow_other_host: true
else
redirect_to settings_profile_path, alert: "Export not ready for download"
redirect_to imports_path, alert: "Export not ready for download"
end
end
def destroy
@export.destroy
redirect_to imports_path, notice: "Export deleted successfully"
end
private
def set_export

View File

@@ -1,4 +1,6 @@
class ImportsController < ApplicationController
include SettingsHelper
before_action :set_import, only: %i[show publish destroy revert apply_template]
def publish
@@ -11,7 +13,11 @@ class ImportsController < ApplicationController
def index
@imports = Current.family.imports
@exports = Current.user.admin? ? Current.family.family_exports.ordered.limit(10) : nil
@breadcrumbs = [
[ "Home", root_path ],
[ "Import/Export", imports_path ]
]
render layout: "settings"
end

View File

@@ -0,0 +1,12 @@
class Settings::AiPromptsController < ApplicationController
layout "settings"
def show
@breadcrumbs = [
[ "Home", root_path ],
[ "AI Prompts", nil ]
]
@family = Current.family
@assistant_config = Assistant.config_for(OpenStruct.new(user: Current.user))
end
end

View File

@@ -8,7 +8,7 @@ class Settings::ApiKeysController < ApplicationController
def show
@breadcrumbs = [
[ "Home", root_path ],
[ "API Keys", nil ]
[ "API Key", nil ]
]
@current_api_key = @api_key
end

View File

@@ -0,0 +1,18 @@
class Settings::GuidesController < ApplicationController
layout "settings"
def show
@breadcrumbs = [
[ "Home", root_path ],
[ "Guides", nil ]
]
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,
autolink: true,
tables: true,
fenced_code_blocks: true,
strikethrough: true,
superscript: true
)
@guide_content = markdown.render(File.read(Rails.root.join("docs/onboarding/guide.md")))
end
end

View File

@@ -5,6 +5,10 @@ class Settings::ProfilesController < ApplicationController
@user = Current.user
@users = Current.family.users.order(:created_at)
@pending_invitations = Current.family.invitations.pending
@breadcrumbs = [
[ "Home", root_path ],
[ "Profile Info", nil ]
]
end
def destroy