locomotivecms/steam

View on GitHub
lib/locomotive/steam/liquid/tags/editable/control.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Locomotive
  module Steam
    module Liquid
      module Tags
        module Editable
          class Control < Base

            protected

            def default_element_attributes
              super.merge({
                content_from_default: self.render_default_content,
                options: attributes[:options]
              })
            end

            def render_element(context, element)
              element.content.to_s
            end

            def render_default_content
              super.try(:strip)
            end

          end

          ::Liquid::Template.register_tag('editable_control'.freeze, Control)
        end
      end
    end
  end
end