window.open
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user