Sha256: c98111cd2e4a386cef775c7a3977f32ff49adaa4c4e02e3cd3c576db4458e594

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbDashboardValue
    class StatLabel < Playbook::PbKit::Base
      PROPS = %i[configured_classname
                 configured_data
                 configured_id
                 configured_label].freeze

      def initialize(classname: default_configuration,
                     data: default_configuration,
                     id: default_configuration,
                     label: default_configuration)

        self.configured_classname = classname
        self.configured_data = data
        self.configured_id = id
        self.configured_label = label
      end

      def label
        default_value(configured_label, nil)
      end

      def display_label
        unless label.nil?
          pb_label = Playbook::PbBody::Body.new(color: "light") do
            label
          end
          ApplicationController.renderer.render(partial: pb_label, as: :object)
        end
      end

      def kit_class
        "pb_stat_label_kit"
      end

      def to_partial_path
        "pb_dashboard_value/child_kits/stat_label"
      end

    private

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
playbook_ui-2.8.6 app/pb_kits/playbook/pb_dashboard_value/stat_label.rb
playbook_ui-2.8.5 app/pb_kits/playbook/pb_dashboard_value/stat_label.rb