Sha256: e7a835ad4ad294b02f09f8abf072726d57b5ceb7219c6f62f9590462628a79a4

Contents?: true

Size: 725 Bytes

Versions: 26

Compression:

Stored size: 725 Bytes

Contents

# frozen_string_literal: true

module Plutonium
  module UI
    module Display
      module Component
        class Association < Phlexi::Display::Components::Association
          include Plutonium::UI::Component::Methods

          def render_value(value)
            p(**attributes) {
              if registered_resources.include?(value.class)
                href = resource_url_for(value, parent: (field.association_reflection.macro == :has_many) ? field.object : nil)
                a(class: themed(:link), href:) {
                  display_name_of value
                }
              else
                display_name_of value
              end
            }
          end
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
plutonium-0.15.22 lib/plutonium/ui/display/component/association.rb
plutonium-0.15.21 lib/plutonium/ui/display/component/association.rb
plutonium-0.15.20 lib/plutonium/ui/display/component/association.rb
plutonium-0.15.19 lib/plutonium/ui/display/component/association.rb
plutonium-0.15.18 lib/plutonium/ui/display/component/association.rb
plutonium-0.15.17 lib/plutonium/ui/display/component/association.rb
plutonium-0.15.16 lib/plutonium/ui/display/component/association.rb
plutonium-0.15.15 lib/plutonium/ui/display/component/association.rb
plutonium-0.15.14 lib/plutonium/ui/display/component/association.rb
plutonium-0.15.13 lib/plutonium/ui/display/component/association.rb
plutonium-0.15.12 lib/plutonium/ui/display/component/association.rb
plutonium-0.15.11 lib/plutonium/ui/display/component/association.rb
plutonium-0.15.10 lib/plutonium/ui/display/component/association.rb
plutonium-0.15.9 lib/plutonium/ui/display/component/association.rb
plutonium-0.15.8 lib/plutonium/ui/display/component/association.rb
plutonium-0.15.7 lib/plutonium/ui/display/component/association.rb
plutonium-0.15.6 lib/plutonium/ui/display/component/association.rb
plutonium-0.15.5 lib/plutonium/ui/display/component/association.rb
plutonium-0.15.4 lib/plutonium/ui/display/component/association.rb
plutonium-0.15.3 lib/plutonium/ui/display/component/association.rb