Sha256: 8800ae027a05e150ba59f83fc6d7d78bb5e7c3badeee210cfb14da3f657f86ef
Contents?: true
Size: 772 Bytes
Versions: 17
Compression:
Stored size: 772 Bytes
Contents
module Locomotive module Steam module Middlewares class WysihtmlCss def initialize(app, opts = {}) @app = app end def call(env) status, headers, response = @app.call(env) if content?(env['steam.page'], response) url = ::ActionController::Base.helpers.stylesheet_url('locomotive/wysihtml5_editor') html = %(<link rel="stylesheet" type="text/css" href="#{url}">) response.first.gsub!('</head>', %(#{html}</head>)) end [status, headers, response] end protected def content?(page, response) page && !page.redirect && page.response_type == 'text/html' && response.first end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems