Sha256: 28160e5787597ece3eec56d16bd3c874e197191b154bcd39feb3018bb266b57b

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 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
  end
  
  def deactivate
    
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
radiant-vapor-extension-2.1.0 vapor_extension.rb