Extract pages into lib/page/ modules; thin down bbs.rb
Each page is now a self-contained module with a configure(tui) class method. Shared helpers live in TUIHelpers. bbs.rb is reduced to constants, chrome, and wiring. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
22
lib/page/wiki_list_page.rb
Normal file
22
lib/page/wiki_list_page.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module WikiListPage
|
||||
def self.configure(tui, name, category:, title:)
|
||||
tui.page name do
|
||||
enter do
|
||||
@page_title = title
|
||||
@items = WIKI.list(category)
|
||||
@item_sel = 0
|
||||
@scroll = 0
|
||||
end
|
||||
|
||||
render { wiki_list_render }
|
||||
|
||||
nav :list, window: -> { cont_h - 3 }
|
||||
key(:enter) { open_wiki_page(back: name) }
|
||||
key('r') { reload }
|
||||
key('q') { go :idle }
|
||||
key(:escape) { go :idle }
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user