Skip to content

Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.

690 B
Raw Blame
# frozen_string_literal: true

module Admin
  # Renders whatever is registered for a named slot of the instance admin, and
  # nothing when nobody registered. The slots and the reason they exist:
  # Lalabase::AdminExtensions.
  module ExtensionsHelper
    # For layout that depends on whether a slot brings anything, e.g. a grid
    # that would otherwise keep an empty column.
    def admin_extension_slot?(slot)
      Lalabase::AdminExtensions.partials_for(slot).any?
    end

    def admin_extension_slot(slot, **locals)
      partials = Lalabase::AdminExtensions.partials_for(slot)
      safe_join(partials.map { |partial| render(partial: partial, locals: locals) })
    end
  end
end