Sha256: 1495558e9641b9d14d244af4c015b37e4b263fda404fff8ade1d954ebe02003b

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

require 'activeadmin/redactor/version'
require 'activeadmin/redactor_opts'
require 'activeadmin/viewport_opts'
require 'activeadmin'
require 'rails/engine'

module Activeadmin
  module Redactor
    module ControllerActions
      def redactorable(options={})
        member_action :redactor do
          @viewport_opts = ViewportOpts.new(options)
          @redactor_opts = RedactorOpts.new(options[:redactor])
          render @viewport_opts.template, layout: @viewport_opts.layout
        end
      end
    end

    module TableMethods
      def redactorable_edit_icon
        column 'Redactor', class: 'activeadmin-redactorable' do |resource|
          resource_redactor_path = resource_path(resource)
          resource_redactor_path << '/redactor'
          link_to 'Redactor', resource_redactor_path, class: 'edit'
        end
      end
    end

    ::ActiveAdmin::ResourceDSL.send(:include, ControllerActions)
    ::ActiveAdmin::Views::TableFor.send(:include, TableMethods)

    class Engine < ::Rails::Engine
      if Rails.version > "3.1"
        initializer "ActiveAdmin Redactor precompile hook", :group => :all do |app|
          app.config.assets.precompile += %w(jquery.js jquery_ujs.js activeadmin-redactor.js activeadmin-redactor.css)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activeadmin-redactor-0.2.1 lib/activeadmin/redactor.rb