app/helpers/katalyst/content/editor/status_bar.rb in katalyst-content-0.1.2 vs app/helpers/katalyst/content/editor/status_bar.rb in katalyst-content-0.2.0
- old
+ new
@@ -9,19 +9,28 @@
ACTIONS
def build(**options)
tag.div **default_options(**options) do
concat status(:published, last_update: l(container.updated_at, format: :short))
+ concat status(:unpublished)
concat status(:draft)
concat status(:dirty)
concat actions
end
end
def status(state, **options)
- tag.span(t("views.katalyst.content.editor.#{state}_html", **options),
- class: "status-text",
- data: { state => "" })
+ status_text = t("views.katalyst.content.editor.#{state}_html", **options)
+ html_options = { class: "status-text", data: { state => "", turbo: false } }
+
+ case state
+ when :published
+ link_to status_text, url_for(container), **html_options
+ when :unpublished, :draft
+ link_to status_text, "#{url_for(container)}/preview", **html_options
+ else
+ tag.span status_text, **html_options
+ end
end
def actions
tag.menu do
concat action(:discard, class: "button button--text")