Sha256: 79775af1d1de448c5cc8392ccdb30bc4b63c1dfa79c4b2e3b9f6c80b669b058f

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

require_dependency 'application_controller'

class VaporExtension < Radiant::Extension
  version "#{File.read(File.expand_path(File.dirname(__FILE__)) + '/VERSION')}"
  description "Manage redirects without creating useless pages"
  url "http://saturnflyer.com/"
  
  define_routes do |map|
    map.namespace :admin do |admin|
      admin.resources 'flow_meters', :only => [:index, :create, :destroy]
    end
  end
  
  def activate
    unless respond_to?(:tab)
      admin.tabs.add "Redirects", "/admin/flow_meters", :after => "Layouts", :visibility => [:admin]
    else
      tab 'Content' do
        add_item 'Redirects', '/admin/flow_meters'
      end
    end
    FlowMeter.initialize_all if ActiveRecord::Base.connection.tables.include?('flow_meters')
    
    Page.class_eval { include PageVapor }
    
    admin.pages.edit.add :form, 'vapor_details', :before => 'edit_title'
    
    if admin.respond_to? :help
      admin.help.index.add :page_details, 'slug_redirect', :after => 'slug'
    end
    
    Admin::PagesController.class_eval {
      helper Admin::PageNodeAlterationsHelper
    }
  end
  
  def deactivate
    
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
radiant-vapor-extension-2.1.2 vapor_extension.rb
radiant-vapor-extension-2.1.1 vapor_extension.rb