Sha256: 478a3d79ef7db54f4eab2b68d33aa7748ee8111baf5619b7d70476df278246db

Contents?: true

Size: 1019 Bytes

Versions: 6

Compression:

Stored size: 1019 Bytes

Contents

module Locomotive
  module Middlewares
    class InlineEditor

      def initialize(app, opts = {})
        @app = app
      end

      def call(env)
        response = @app.call(env)

        unless response[1]['Editable'].blank?
           html = response.last.body.to_s.gsub '</body>', %(
            <a  href="_admin"
                onmouseout="this.style.backgroundPosition='0px 0px'"
                onmouseover="this.style.backgroundPosition='0px -45px'"
                onmousedown="this.style.backgroundPosition='0px -90px'"
                onmouseup="this.style.backgroundPosition='0px 0px'"
                style="display: block;z-index: 1031;position: fixed;top: 10px; right: 10px;width: 48px; height: 45px;text-indent:-9999px;text-decoration:none;background: transparent url\('/assets/locomotive/icons/start.png'\) no-repeat 0 0;">
            Admin</a>
            </body>
           )
           [response[0], response[1], [html]]
        else
          response
        end
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
locomotive_cms-2.0.0.rc9 lib/locomotive/middlewares/inline_editor.rb
locomotive_cms-2.0.0.rc8 lib/locomotive/middlewares/inline_editor.rb
locomotive_cms-2.0.0.rc7 lib/locomotive/middlewares/inline_editor.rb
locomotive_cms-2.0.0.rc6 lib/locomotive/middlewares/inline_editor.rb
locomotive_cms-2.0.0.rc5 lib/locomotive/middlewares/inline_editor.rb
locomotive_cms-2.0.0.rc4 lib/locomotive/middlewares/inline_editor.rb