Sha256: 2a60156e233f9b54a360b8a4d3da5361166d12f9efc63944189311dcb099a9a1

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

# encoding: utf-8
require 'rails_email_preview/engine'
require 'rails_email_preview/main_app_route_delegator'
require 'rails_email_preview/version'

require 'slim'
require 'slim-rails'

module RailsEmailPreview

  mattr_accessor :parent_controller
  self.parent_controller = '::ApplicationController'

  # auto-loading configured in initializer
  mattr_accessor :preview_classes

  class << self
    def run_before_render(mail)
      (defined?(@hooks) && @hooks[:before_render] || []).each do |block|
        block.call(mail)
      end
    end

    def before_render(&block)
      ((@hooks ||= {})[:before_render] ||= []) << block
    end

    def inline_main_app_routes!
      ::RailsEmailPreview::ApplicationController.helper ::RailsEmailPreview::MainAppRouteDelegator
    end

    def setup
      yield self
    end
  end

  # = Editing settings
  # edit link is rendered inside an iframe, so these options are provided for simple styling
  mattr_accessor :edit_link_text
  self.edit_link_text = '✎ Edit Text'
  mattr_accessor :edit_link_style
  self.edit_link_style = <<-CSS.strip.gsub(/\n+/m, ' ')
  display: block;
  font-family: Monaco, Helvetica, sans-serif;
  color: #7a4b8a;
  border: 2px dashed #7a4b8a;
  font-size: 20px;
  padding: 8px 12px;
  margin-top: 0.6em;
  margin-bottom: 0.6em;
  CSS
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_email_preview-0.2.2 lib/rails_email_preview.rb