Sha256: 30bcb4c259b15e874a3367723e885db7c517f85828c311cd51520690967ec2b2

Contents?: true

Size: 677 Bytes

Versions: 1

Compression:

Stored size: 677 Bytes

Contents

module Kiqr
  module Frontend
    module Controllers
      module RendersSubmenu
        extend ActiveSupport::Concern

        included do
          helper_method :submenu_partial, :has_submenu?
        end

        def submenu_partial
          @_submenu_partial
        end

        def has_submenu?
          !@_submenu_partial.nil?
        end

        module ClassMethods
          def renders_submenu(partial:, **options)
            before_action -> { set_submenu_partial(partial: partial) }, **options
          end
        end

        protected

        def set_submenu_partial(partial:)
          @_submenu_partial = partial
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kiqr-0.1.0.alpha1 lib/kiqr/frontend/controllers/renders_submenu.rb