Class: Slack::BlockKit::Element::DatePicker
- Inherits:
-
Object
- Object
- Slack::BlockKit::Element::DatePicker
- Defined in:
- lib/slack/block_kit/element/date_picker.rb
Overview
An element which lets users easily select a date from a calendar style UI.
Date picker elements can be used inside of section and actions blocks.
Constant Summary collapse
- TYPE =
'datepicker'
Instance Method Summary collapse
- #as_json ⇒ Object
- #confirmation_dialog {|@confirm| ... } ⇒ Object
-
#initialize(action_id:, placeholder: nil, initial: nil, emoji: nil) {|_self| ... } ⇒ DatePicker
constructor
A new instance of DatePicker.
Constructor Details
#initialize(action_id:, placeholder: nil, initial: nil, emoji: nil) {|_self| ... } ⇒ DatePicker
Returns a new instance of DatePicker.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/slack/block_kit/element/date_picker.rb', line 15 def initialize(action_id:, placeholder: nil, initial: nil, emoji: nil) @action_id = action_id @initial_date = initial if placeholder @placeholder = Composition::PlainText.new( text: placeholder, emoji: emoji ) end yield(self) if block_given? end |
Instance Method Details
#as_json ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/slack/block_kit/element/date_picker.rb', line 36 def as_json(*) { type: TYPE, action_id: @action_id, placeholder: @placeholder&.as_json, initial_date: @initial_date, confirm: @confirm&.as_json }.compact end |
#confirmation_dialog {|@confirm| ... } ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/slack/block_kit/element/date_picker.rb', line 28 def confirmation_dialog @confirm = Composition::ConfirmationDialog.new yield(@confirm) if block_given? self end |