Sha256: 586cb22826ca1c741d6a454a2d65f017c0a4485b0372ea63428474b6f1625492

Contents?: true

Size: 1.51 KB

Versions: 6

Compression:

Stored size: 1.51 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbOwner
    class Owner < Playbook::PbKit::Base
      PROPS = %i[configured_classname
                 configured_data
                 configured_id
                 configured_first_name
                 configured_last_name].freeze

      def initialize(classname: default_configuration,
                     data: default_configuration,
                     id: default_configuration,
                     first_name: default_configuration,
                     last_name: default_configuration)
        self.configured_classname = classname
        self.configured_data = data
        self.configured_id = id
        self.configured_first_name = first_name
        self.configured_last_name = last_name
      end

      def first_name
        pb_first_name = Playbook::PbBody::Body.new(tag: "span", classname: "pb_owner_first") do
          default_value(configured_first_name, "")
        end
        ApplicationController.renderer.render(partial: pb_first_name, as: :object)
      end

      def last_name
        if is_set? configured_last_name
          pb_last_name = Playbook::PbTitle::Title.new(text: configured_last_name, size: 4)
          ApplicationController.renderer.render(partial: pb_last_name, as: :object)
        end
      end

      def to_partial_path
        "pb_owner/owner"
      end

    private

      DEFAULT = Object.new
      private_constant :DEFAULT
      def default_configuration
        DEFAULT
      end
      attr_accessor(*PROPS)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
playbook_ui-2.9.2 app/pb_kits/playbook/pb_owner/owner.rb
playbook_ui-2.9.1 app/pb_kits/playbook/pb_owner/owner.rb
playbook_ui-2.9.0 app/pb_kits/playbook/pb_owner/owner.rb
playbook_ui-2.8.9 app/pb_kits/playbook/pb_owner/owner.rb
playbook_ui-2.8.8 app/pb_kits/playbook/pb_owner/owner.rb
playbook_ui-2.8.7 app/pb_kits/playbook/pb_owner/owner.rb