Module: Releaf::Content::Builders::ActionDialog
Instance Method Summary
collapse
Methods included from Dialog
#cancel_button
Methods included from Tree
#body_classes, #build_tree, #empty_body, #section_body, #sort_tree, #sorted_tree, #tree, #tree_level, #tree_resource, #tree_resource_blocks, #tree_resource_children, #tree_resource_collapser, #tree_resource_name
Instance Method Details
64
65
66
|
# File 'app/builders/releaf/content/builders/action_dialog.rb', line 64
def confirm_button
button(confirm_button_text, "check", confirm_button_attributes)
end
|
60
61
62
|
# File 'app/builders/releaf/content/builders/action_dialog.rb', line 60
def confirm_button_attributes
{class: "primary", type: "submit", data: { type: 'ok', disable: true}}
end
|
#confirm_button_text ⇒ Object
56
57
58
|
# File 'app/builders/releaf/content/builders/action_dialog.rb', line 56
def confirm_button_text
t(action.to_s.humanize)
end
|
52
53
54
|
# File 'app/builders/releaf/content/builders/action_dialog.rb', line 52
def
super << confirm_button
end
|
5
6
7
8
9
10
11
12
13
14
|
# File 'app/builders/releaf/content/builders/action_dialog.rb', line 5
def form_attributes
{
method: :post,
data: {
"remote" => true,
"remote-validation" => true,
"type" => :json
}
}
end
|
#root_level ⇒ Object
16
17
18
19
20
21
22
|
# File 'app/builders/releaf/content/builders/action_dialog.rb', line 16
def root_level
tag(:ul, "data-level" => 0) do
tag(:li, class: "root") do
[tree_root_resource, super]
end
end
end
|
#section_blocks ⇒ Object
39
40
41
42
43
44
45
|
# File 'app/builders/releaf/content/builders/action_dialog.rb', line 39
def section_blocks
form_tag(url_for(action: action, id: resource.id), form_attributes) do
safe_join do
super
end
end
end
|
47
48
49
50
|
# File 'app/builders/releaf/content/builders/action_dialog.rb', line 47
def
message = "#{action.capitalize} node '%{node_name}' to"
t(message, default: message, node_name: resource.name )
end
|
32
33
34
35
36
37
|
# File 'app/builders/releaf/content/builders/action_dialog.rb', line 32
def tree_resource_name_button(resource)
field_id = "new_parent_id_#{resource.id}"
[radio_button_tag(:new_parent_id, resource.id, false, id: field_id),
tag(:label, tag(:span, resource.name), class: "trigger", for: field_id)]
end
|
#tree_root_resource ⇒ Object
24
25
26
27
28
29
30
|
# File 'app/builders/releaf/content/builders/action_dialog.rb', line 24
def tree_root_resource
field_id = "new_parent_id_0"
tag(:div, class: "node-cell") do
[radio_button_tag(:new_parent_id, '', false, id: 'new_parent_id_0'),
tag(:label, t("Root node"), class: "trigger", for: field_id)]
end
end
|