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
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.
7
8
9
|
# File 'app/components/katalyst/navigation/editor/status_bar_component.rb', line 7
def container
@container
end
|
Instance Method Details
#action(action) ⇒ Object
33
34
35
36
37
38
39
40
41
|
# File 'app/components/katalyst/navigation/editor/status_bar_component.rb', line 33
def action(action, **)
tag.li do
button_tag(t("views.katalyst.navigation.editor.#{action}"),
name: "commit",
value: action,
form: ,
**)
end
end
|
#actions ⇒ Object
24
25
26
27
28
29
30
31
|
# File 'app/components/katalyst/navigation/editor/status_bar_component.rb', line 24
def actions
tag. do
concat action(:discard, class: "button", data: { text_button: "" })
concat action(:revert, class: "button", data: { text_button: "" }) if .state == :draft
concat action(:save, class: "button", data: { ghost_button: "" })
concat action(:publish, class: "button")
end
end
|
#call ⇒ Object
9
10
11
12
13
14
15
16
|
# File 'app/components/katalyst/navigation/editor/status_bar_component.rb', line 9
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
18
19
20
21
22
|
# File 'app/components/katalyst/navigation/editor/status_bar_component.rb', line 18
def status(state, **)
tag.span(t("views.katalyst.navigation.editor.#{state}_html", **),
class: "status-text",
data: { state => "" })
end
|