Class: Tiqbi::View::DetailView
- Includes:
- Utils
- Defined in:
- lib/tiqbi/view/detail_view.rb
Constant Summary
Constants included from Utils
Instance Attribute Summary
Attributes inherited from Base
#c_window, #collection, #cursor, #top_statement
Instance Method Summary collapse
-
#initialize(*args) ⇒ DetailView
constructor
A new instance of DetailView.
- #item_loaded(item) ⇒ Object
Methods included from Utils
#format_str, #split_str_with_width, #unescape_entity
Methods inherited from Base
#box!, #br, #change_focus_line, #clear_collection, #cursor_down, #cursor_on_end_of_collection?, #cursor_up, #draw_at, #enhansive_line, #hr, #in_color, #in_pos, #normalize_line, #print, #resize!, #restore_initial_size!, #scroll_down, #scroll_up, #virtual_close
Constructor Details
#initialize(*args) ⇒ DetailView
Returns a new instance of DetailView.
10 11 12 13 |
# File 'lib/tiqbi/view/detail_view.rb', line 10 def initialize(*args) super(*args) @c_window.scrollok true end |
Instance Method Details
#item_loaded(item) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/tiqbi/view/detail_view.rb', line 15 def item_loaded(item) restore_initial_size! col = [] # Add title [hr, 'Title', hr].each { |e| col << e } format_str(item.title, maxx - 1) { |s| col << s } # Add body [hr, 'Body', hr].each { |e| col << e } format_str(item.body, maxx - 1) { |s| col << s } # add Comment [hr, 'Comment', hr].each { |e| col << e } item.comments.each do |c| format_str(c.body, maxx - 1) { |s| col << s } col << hr end self.collection = col print end |