Class: Effective::FormInputs::Delete
Constant Summary
Effective::FormInput::BLANK, Effective::FormInput::EXCLUSIVE_CLASS_PREFIXES, Effective::FormInput::EXCLUSIVE_CLASS_SUFFIXES
Instance Attribute Summary
#name, #options
Instance Method Summary
collapse
#hint_options, #initialize, #input_group_options, #input_js_options
Instance Method Details
#border? ⇒ Boolean
44
45
46
|
# File 'app/models/effective/form_inputs/delete.rb', line 44
def border?
false
end
|
9
10
11
12
13
14
15
16
17
18
|
# File 'app/models/effective/form_inputs/delete.rb', line 9
def build_input(&block)
tags = [
icon('check', style: 'display: none;'),
icon('x', style: 'display: none;'),
icon('spinner'),
(block_given? ? capture(&block) : content_tag(:a, name, options[:input]))
]
(left? ? tags.reverse.join : tags.join).html_safe
end
|
#center? ⇒ Boolean
58
59
60
61
|
# File 'app/models/effective/form_inputs/delete.rb', line 58
def center?
return @center unless @center.nil?
@center = (options.delete(:center) || false)
end
|
#feedback_options ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'app/models/effective/form_inputs/delete.rb', line 68
def feedback_options
false
end
|
#inline? ⇒ Boolean
48
49
50
51
|
# File 'app/models/effective/form_inputs/delete.rb', line 48
def inline?
return @form_actions_inline unless @form_actions_inline.nil?
@form_actions_inline = (options.delete(:inline) || false)
end
|
40
41
42
|
# File 'app/models/effective/form_inputs/delete.rb', line 40
def input_html_options
{ class: 'btn btn-warning', data: { method: :delete, remote: true, confirm: "Delete #{object}?"} }
end
|
#label_options ⇒ Object
20
21
22
|
# File 'app/models/effective/form_inputs/delete.rb', line 20
def label_options
false
end
|
#left? ⇒ Boolean
53
54
55
56
|
# File 'app/models/effective/form_inputs/delete.rb', line 53
def left?
return @left unless @left.nil?
@left = (options.delete(:left) || false)
end
|
#right? ⇒ Boolean
63
64
65
66
|
# File 'app/models/effective/form_inputs/delete.rb', line 63
def right?
return @right unless @right.nil?
@right = (options.delete(:right) || false)
end
|
#to_html(&block) ⇒ Object
5
6
7
|
# File 'app/models/effective/form_inputs/delete.rb', line 5
def to_html(&block)
return super unless (form_readonly? || form_disabled?)
end
|
#wrapper_options ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'app/models/effective/form_inputs/delete.rb', line 24
def wrapper_options
@right = true unless (left? || center? || right?)
classes = [
('row' if layout == :horizontal),
'form-group form-actions',
('form-actions-inline' if inline?),
('form-actions-bordered' if border?),
('justify-content-start' if left? && layout == :vertical),
('justify-content-center' if center? && layout == :vertical),
('justify-content-end' if right? && layout == :vertical)
].compact.join(' ')
{ class: classes, id: tag_id }
end
|