Class: Katalyst::Navigation::Editor::StatusBarComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Katalyst::Navigation::Editor::StatusBarComponent
show all
- Defined in:
- app/components/katalyst/navigation/editor/status_bar_component.rb
Constant Summary
collapse
- ACTIONS =
"navigation:change@document->\#{STATUS_BAR_CONTROLLER}#change\nturbo:morph-element->\#{STATUS_BAR_CONTROLLER}#morph\n".gsub(/\s+/, " ").freeze
BaseComponent::ITEM_CONTROLLER, BaseComponent::LIST_CONTROLLER, BaseComponent::MENU_CONTROLLER, BaseComponent::NEW_ITEM_CONTROLLER, BaseComponent::STATUS_BAR_CONTROLLER
Instance Attribute Summary collapse
#item, #menu
Instance Method Summary
collapse
#initialize, #menu_form_id
Instance Attribute Details
#container ⇒ Object
Returns the value of attribute container.
12
13
14
|
# File 'app/components/katalyst/navigation/editor/status_bar_component.rb', line 12
def container
@container
end
|
Instance Method Details
#action(action) ⇒ Object
38
39
40
41
42
43
44
45
46
|
# File 'app/components/katalyst/navigation/editor/status_bar_component.rb', line 38
def action(action, **)
tag.li do
button_tag(t("views.katalyst.navigation.editor.#{action}"),
name: "commit",
value: action,
form: ,
**)
end
end
|
#actions ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'app/components/katalyst/navigation/editor/status_bar_component.rb', line 29
def actions
tag. do
concat action(:discard, class: "button button--text")
concat action(:revert, class: "button button--text") if .state == :draft
concat action(:save, class: "button button--secondary")
concat action(:publish, class: "button button--primary")
end
end
|
#call ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'app/components/katalyst/navigation/editor/status_bar_component.rb', line 14
def call
tag.div(**html_attributes) do
concat status(:published, last_update: l(.updated_at, format: :short))
concat status(:draft)
concat status(:dirty)
concat actions
end
end
|
#status(state) ⇒ Object
23
24
25
26
27
|
# File 'app/components/katalyst/navigation/editor/status_bar_component.rb', line 23
def status(state, **)
tag.span(t("views.katalyst.navigation.editor.#{state}_html", **),
class: "status-text",
data: { state => "" })
end
|