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,27 +2,27 @@
module UI
module Windows
module_function
# Split-view wiki browser. Left=titles, right=selected page content
# (rendered with markdown-aware formatting).
def wiki(app, services:, category:, title:)
items = services[:wiki].list(category)
BBS::Windows::MasterDetail.open(app,
title: " #{title} ",
items: items,
item_label: ->(p) { p.title },
list_width: [32, app.cols / 3].max,
empty_message: ' (no pages found)',
close_button: false,
render_detail: ->(page, width) {
text = services[:wiki].content(page.id)
BBS::Markdown.to_lines(text, width: width - 1, theme: app.theme)
},
bottom_meta: ->(page) {
"#{page.created_at.to_s[0, 10]} #{services[:wiki].page_url(page.locale, page.path)}"
}
)
class Wiki
def self.open(app, services:, category:, title:)
items = services[:wiki].list(category)
BBS::Windows::MasterDetail.open(app,
title: " #{title} ",
items: items,
item_label: ->(p) { p.title },
list_width: [32, app.cols / 3].max,
empty_message: ' (no pages found)',
close_button: false,
render_detail: ->(page, width) {
text = services[:wiki].content(page.id)
BBS::Markdown.to_lines(text, width: width - 1, theme: app.theme)
},
bottom_meta: ->(page) {
"#{page.created_at.to_s[0, 10]} #{services[:wiki].page_url(page.locale, page.path)}"
}
)
end
end
end
end