Sha256: 677d0fc73c0717655f22fe27837e98a0ed721f602d0ca795acf08d7e2fdc9454

Contents?: true

Size: 1.48 KB

Versions: 2

Compression:

Stored size: 1.48 KB

Contents

if get(:admin_mode)
  if equals?(:authentication, :devise)
    gather_gem 'activeadmin', github: 'activeadmin'
    gather_gem 'activeadmin_addons'
    gather_gem 'active_skin'

    after(:gem_install, :wrap_in_action => :admin_install) do
      generate "active_admin:install"

      line = "ActiveAdmin.setup do |config|"
      initializer = "config/initializers/active_admin.rb"
      gsub_file initializer, /(#{Regexp.escape(line)})/mi do |match|
        <<-HERE.gsub(/^ {11}/, '')
           class CustomFooter < ActiveAdmin::Component
             def build
               super(id: "footer")
               para "Powered by Platanus"
             end
           end\n
           ActiveAdmin.setup do |config|
             config.view_factory.footer = CustomFooter
           HERE
      end

      line = "@import \"active_admin/base\";"
      style = "app/assets/stylesheets/active_admin.css.scss"

      style = if File.exist?(style)
        style
      else
        "app/assets/stylesheets/active_admin.scss"
      end

      gsub_file style, /(#{Regexp.escape(line)})/mi do |match|
        <<-HERE.gsub(/^ {11}/, '')
           #{line}
           $skinActiveColor: #001CEE;
           $skinHeaderBck: #002744;
           $panelHeaderBck: #002744;
           //$skinLogo: $skinHeaderBck image-url("logo_admin.png") no-repeat center center;

           @import "active_skin";
           HERE
      end
    end
  else
    say "ActiveAdmin can't be installed because Devise isn't enabled.", :red
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
potassium-1.3.3 lib/potassium/templates/application/recipes/admin.rb
potassium-1.3.2 lib/potassium/templates/application/recipes/admin.rb