Class: Playbook::PbLabelValue::LabelValue

Inherits:
Playbook::PbKit::Base show all
Defined in:
app/pb_kits/playbook/pb_label_value/label_value.rb

Constant Summary collapse

PROPS =
%i[configured_classname
configured_data
configured_id
configured_label
configured_value].freeze

Instance Method Summary collapse

Methods inherited from Playbook::PbKit::Base

#adjusted_value, #aria, #classname, #concat_value, #data, #default_value, #false_value, #id, #is_boolean?, #is_integer?, #is_set?, #is_string?, #is_true?, #merge_value, #one_of?, #one_of_value, #true_value

Constructor Details

#initialize(classname: default_configuration, data: default_configuration, id: default_configuration, label: default_configuration, value: default_configuration) ⇒ LabelValue

Returns a new instance of LabelValue.



12
13
14
15
16
17
18
19
20
21
22
# File 'app/pb_kits/playbook/pb_label_value/label_value.rb', line 12

def initialize(classname: default_configuration,
               data: default_configuration,
               id: default_configuration,
               label: default_configuration,
               value: default_configuration)
  self.configured_classname = classname
  self.configured_data = data
  self.configured_id = id
  self.configured_label = label
  self.configured_value = value
end

Instance Method Details

#kit_classObject



38
39
40
# File 'app/pb_kits/playbook/pb_label_value/label_value.rb', line 38

def kit_class
  "pb_label_value_kit"
end

#labelObject



24
25
26
27
28
29
# File 'app/pb_kits/playbook/pb_label_value/label_value.rb', line 24

def label
  if is_set? configured_label
    pb_label = Playbook::PbCaption::Caption.new(text: configured_label)
    ApplicationController.renderer.render(partial: pb_label, as: :object)
  end
end

#to_partial_pathObject



42
43
44
# File 'app/pb_kits/playbook/pb_label_value/label_value.rb', line 42

def to_partial_path
  "pb_label_value/label_value"
end

#valueObject



31
32
33
34
35
36
# File 'app/pb_kits/playbook/pb_label_value/label_value.rb', line 31

def value
  pb_body = Playbook::PbBody::Body.new do
    default_value(configured_value, "")
  end
  ApplicationController.renderer.render(partial: pb_body, as: :object)
end