window.open

This commit is contained in:
2026-05-13 21:12:39 +02:00
parent 757d999b9a
commit f79a98229a
10 changed files with 277 additions and 269 deletions

View File

@@ -2,30 +2,30 @@
module UI
module Windows
module_function
def profile(app, services:)
username = app.context[:username] || 'Anonymous'
existing = services[:profile].find(username) || {}
BBS::Windows::Form.open(app,
title: " Profile — #{username} ",
width: 64, height: 14,
fields: [
{ key: :signature, label: 'Signature', value: existing['signature'].to_s },
{ key: :location, label: 'Location', value: existing['location'].to_s },
{ key: :homepage, label: 'Homepage', value: existing['homepage'].to_s },
{ key: :notes, label: 'Notes', value: existing['notes'].to_s }
],
on_submit: ->(values, _form) {
services[:profile].update(username,
signature: values[:signature],
location: values[:location],
homepage: values[:homepage],
notes: values[:notes]
)
BBS::Dialogs.message(app, 'Profile saved.', title: ' Saved ')
}
)
class Profile
def self.open(app, services:)
username = app.context[:username] || 'Anonymous'
existing = services[:profile].find(username) || {}
BBS::Windows::Form.open(app,
title: " Profile — #{username} ",
width: 64, height: 14,
fields: [
{ key: :signature, label: 'Signature', value: existing['signature'].to_s },
{ key: :location, label: 'Location', value: existing['location'].to_s },
{ key: :homepage, label: 'Homepage', value: existing['homepage'].to_s },
{ key: :notes, label: 'Notes', value: existing['notes'].to_s }
],
on_submit: ->(values, _form) {
services[:profile].update(username,
signature: values[:signature],
location: values[:location],
homepage: values[:homepage],
notes: values[:notes]
)
BBS::Dialogs.message(app, 'Profile saved.', title: ' Saved ')
}
)
end
end
end
end