Sha256: d26d504f44f1ddfe8dcc0be79c988dc57e18678e2bef987a26c7257660fb7655

Contents?: true

Size: 640 Bytes

Versions: 3

Compression:

Stored size: 640 Bytes

Contents

module PandaCms
  module EditorJs
    module Blocks
      class Quote < Base
        def render
          text = sanitize(data["text"])
          caption = sanitize(data["caption"])
          alignment = data["alignment"] || "left"

          html_safe(
            "<figure class=\"text-#{alignment}\">" \
              "<blockquote><p>#{text}</p></blockquote>" \
              "#{caption_element(caption)}" \
            "</figure>"
          )
        end

        private

        def caption_element(caption)
          return "" if caption.blank?
          "<figcaption>#{caption}</figcaption>"
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
panda_cms-0.6.3 app/lib/panda_cms/editor_js/blocks/quote.rb
panda_cms-0.6.2 app/lib/panda_cms/editor_js/blocks/quote.rb
panda_cms-0.6.1 app/lib/panda_cms/editor_js/blocks/quote.rb