Module: StudioSidebarHelper

Defined in:
app/helpers/studio_sidebar_helper.rb

Overview

The link-sidebar's view seam. Exposed to host views automatically (the engine is non-isolated), so the navbar and any host layout can gate on studio_sidebar? without wiring. Sections resolve once per render pass — the resolver may call a host lambda that walks models or routes.

Instance Method Summary collapse

Instance Method Details

#studio_sidebar?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'app/helpers/studio_sidebar_helper.rb', line 10

def studio_sidebar?
  studio_sidebar_sections.any?
end

#studio_sidebar_replaces_admin_menu?Boolean

The admin dropdown and the sidebar trigger share the cog glyph — showing both reads as a double gear. When the viewer's resolved sections carry an admin-flagged entry, the sidebar IS the admin menu (its title says so) and the engine components skip the dropdown. Declaring only public sections keeps the dropdown, so admins never lose Theme/Navbar/Error Logs.

Returns:

  • (Boolean)


19
20
21
# File 'app/helpers/studio_sidebar_helper.rb', line 19

def studio_sidebar_replaces_admin_menu?
  studio_sidebar_sections.any? { |section| section[:admin] }
end

#studio_sidebar_sectionsObject



6
7
8
# File 'app/helpers/studio_sidebar_helper.rb', line 6

def studio_sidebar_sections
  @studio_sidebar_sections ||= Studio.sidebar_sections_for(self)
end