Sha256: b270bf7d4e3df643fa163373279833d5e87dbb222da068c76ef06b2d29e29696

Contents?: true

Size: 775 Bytes

Versions: 4

Compression:

Stored size: 775 Bytes

Contents

# frozen_string_literal: true

module Renalware
  class ApplicationComponent < ActionView::Component::Base
    include Renalware::Engine.routes.url_helpers
    include Pundit::Helper

    # Not sure why include Renalware::Engine.routes.url_helpers does not make the 
    # engine urls visible in the views (seems to resolve alwatys to /assets?..) 
    # so we expose routes here so inside a component html file we can use 
    # e.g. renalware.bookmarks_path 
    def renalware
      Renalware::Engine.routes.url_helpers
    end

    # Added this helper as I can't seem to get the Pundit #policy helper to be included
    # in the context when renderingt a component template.
    def policy(record)
      current_user && Pundit.policy(current_user, record)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
renalware-core-2.0.136 app/components/renalware/application_component.rb
renalware-core-2.0.135 app/components/renalware/application_component.rb
renalware-core-2.0.134 app/components/renalware/application_component.rb
renalware-core-2.0.133 app/components/renalware/application_component.rb