mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
12
app/controllers/settings/ai_prompts_controller.rb
Normal file
12
app/controllers/settings/ai_prompts_controller.rb
Normal 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
|
||||
@@ -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
|
||||
|
||||
18
app/controllers/settings/guides_controller.rb
Normal file
18
app/controllers/settings/guides_controller.rb
Normal 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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user