Sha256: 0ae31e017750a41a7ac9b7e73636171058ef86ee2fc458b4492616d4a4e9ae0d

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

module Liquid
  module Locomotive
    module Tags
      class InlineEditor < ::Liquid::Tag

        def render(context)
          if context.registers[:current_locomotive_account] && context.registers[:inline_editor]

            controller = context.registers[:controller]

            plugins = 'common/format,common/table,common/list,common/link,common/highlighteditables,common/block,common/undo,common/contenthandler,common/paste,common/commands,common/abbr,common/align,common/horizontalruler,custom/locomotive_media'

            %{
              <meta content="true" name="inline-editor" />

              #{controller.view_context.stylesheet_link_tag    'aloha/css/aloha.css'}
              #{controller.view_context.javascript_include_tag 'locomotive/aloha', :'data-aloha-plugins' => plugins}

              <script type="text/javascript">
                Aloha.ready(function() \{
                  window.parent.application_view.set_page(#{context.registers[:page].to_presenter.as_json_for_html_view.to_json});
                \});
              </script>

            }
          else
            ''
          end
        end
      end

      ::Liquid::Template.register_tag('inline_editor', InlineEditor)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
locomotive_cms-2.0.0.rc9 lib/locomotive/liquid/tags/inline_editor.rb
locomotive_cms-2.0.0.rc8 lib/locomotive/liquid/tags/inline_editor.rb
locomotive_cms-2.0.0.rc7 lib/locomotive/liquid/tags/inline_editor.rb