Class: RubyUIAdmin::Views::Show
- Includes:
- ActionsMenu, ShowFields, StructureRenderer
- Defined in:
- app/components/ruby_ui_admin/views/show.rb
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(resource:, record:) ⇒ Show
constructor
A new instance of Show.
-
#lazy_tabs? ⇒ Boolean
Lazy tabs (config): non-active show tabs fetch their content when first opened.
- #page_title ⇒ Object
-
#tab_fragment_url(flat_index) ⇒ Object
URL a lazy tab fetches โ the show path with the tab's flat index and
fragment=1, so only that tab's structure is rendered (and its queries run) on demand.
Methods included from ActionsMenu
Methods included from ShowFields
#render_association_row, #render_field, #render_field_row
Methods included from StructureRenderer
Methods inherited from Base
#authorized_to?, #view_template
Methods included from Translation
Methods included from PathHelpers
#attachment_url, #resource_edit_path, #resource_index_path, #resource_new_path, #resource_show_path
Constructor Details
#initialize(resource:, record:) ⇒ Show
Returns a new instance of Show.
10 11 12 13 |
# File 'app/components/ruby_ui_admin/views/show.rb', line 10 def initialize(resource:, record:) @resource = resource @record = record end |
Instance Method Details
#content ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'app/components/ruby_ui_admin/views/show.rb', line 19 def content render_header # `space-y-6` separates the structure's top-level sections (the fields card, panels # and tab groups) so they aren't glued together โ mirrors the form's `space-y-6`. div(class: "space-y-6") do render_structure(@resource.field_structure(view: :show)) end end |
#lazy_tabs? ⇒ Boolean
Lazy tabs (config): non-active show tabs fetch their content when first opened.
29 30 31 |
# File 'app/components/ruby_ui_admin/views/show.rb', line 29 def lazy_tabs? RubyUIAdmin.configuration.lazy_tabs end |
#page_title ⇒ Object
15 16 17 |
# File 'app/components/ruby_ui_admin/views/show.rb', line 15 def page_title "#{@resource.record_title(@record)} ยท #{RubyUIAdmin.configuration.app_name}" end |
#tab_fragment_url(flat_index) ⇒ Object
URL a lazy tab fetches โ the show path with the tab's flat index and fragment=1,
so only that tab's structure is rendered (and its queries run) on demand.
35 36 37 |
# File 'app/components/ruby_ui_admin/views/show.rb', line 35 def tab_fragment_url(flat_index) "#{resource_show_path(@resource.class, @record)}?tab=#{flat_index}&fragment=1" end |