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\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.
11
12
13
|
# File 'app/components/katalyst/navigation/editor/status_bar_component.rb', line 11
def container
@container
end
|
Instance Method Details
#action(action) ⇒ Object
37
38
39
40
41
42
43
44
45
|
# File 'app/components/katalyst/navigation/editor/status_bar_component.rb', line 37
def action(action, **)
tag.li do
button_tag(t("views.katalyst.navigation.editor.#{action}"),
name: "commit",
value: action,
form: ,
**)
end
end
|
#actions ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'app/components/katalyst/navigation/editor/status_bar_component.rb', line 28
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
13
14
15
16
17
18
19
20
|
# File 'app/components/katalyst/navigation/editor/status_bar_component.rb', line 13
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
22
23
24
25
26
|
# File 'app/components/katalyst/navigation/editor/status_bar_component.rb', line 22
def status(state, **)
tag.span(t("views.katalyst.navigation.editor.#{state}_html", **),
class: "status-text",
data: { state => "" })
end
|