Class: Katalyst::Content::Editor::Errors

Inherits:
Base
  • Object
show all
Defined in:
app/helpers/katalyst/content/editor/errors.rb

Constant Summary

Constants inherited from Base

Base::CONTAINER_CONTROLLER, Base::ITEM_CONTROLLER, Base::LIST_CONTROLLER, Base::NEW_ITEM_CONTROLLER, Base::STATUS_BAR_CONTROLLER, Base::TURBO_FRAME

Instance Attribute Summary

Attributes inherited from Base

#container, #template

Instance Method Summary collapse

Methods inherited from Base

#attributes_scope, #container_form_id, #initialize

Constructor Details

This class inherits a constructor from Katalyst::Content::Editor::Base

Instance Method Details

#build(**options) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/katalyst/content/editor/errors.rb', line 7

def build(**options)
  turbo_frame_tag dom_id(container, :errors) do
    next unless container.errors.any?

    tag.div(class: "content-errors", **options) do
      tag.h2("Errors in content") +
        tag.ul(class: "errors") do
          container.errors.each do |error|
            concat(tag.li(error.message))
          end
        end
    end
  end
end