Sha256: f42287d14b2de1322555b3aff9a80cef368b89a48ee32f29fb71311d71325551

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 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"
      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

3 entries across 3 versions & 1 rubygems

Version Path
playbook_ui-2.8.4 app/pb_kits/playbook/pb_dashboard_value/stat_label.rb
playbook_ui-2.8.3 app/pb_kits/playbook/pb_dashboard_value/stat_label.rb
playbook_ui-2.8.1 app/pb_kits/playbook/pb_dashboard_value/stat_label.rb