Sha256: 7421b176f4bbe129a528fc40d7ef9abb7560a66977dbb4d789b0ed34e060a335

Contents?: true

Size: 771 Bytes

Versions: 12

Compression:

Stored size: 771 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 rendering a component template.
    def policy(record)
      current_user && Pundit.policy(current_user, record)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
renalware-core-2.0.149 app/components/renalware/application_component.rb
renalware-core-2.0.148 app/components/renalware/application_component.rb
renalware-core-2.0.147 app/components/renalware/application_component.rb
renalware-core-2.0.146 app/components/renalware/application_component.rb
renalware-core-2.0.145 app/components/renalware/application_component.rb
renalware-core-2.0.144 app/components/renalware/application_component.rb
renalware-core-2.0.143 app/components/renalware/application_component.rb
renalware-core-2.0.142 app/components/renalware/application_component.rb
renalware-core-2.0.141 app/components/renalware/application_component.rb
renalware-core-2.0.140 app/components/renalware/application_component.rb
renalware-core-2.0.139 app/components/renalware/application_component.rb
renalware-core-2.0.138 app/components/renalware/application_component.rb