Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: radiant-0.8.1
Fetching contributors…

Cannot retrieve contributors at this time

file 30 lines (26 sloc) 1.044 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
class PollsExtension < Radiant::Extension
  version '0.3.1'
  description 'Radiant gets polls.'
  url 'http://github.com/nuex/radiant-polls-extension'

  define_routes do |map|
    map.namespace :admin, :member => { :clear_responses => :post } do |admin|
      admin.resources :polls
    end
    map.resources :poll_response, :only => [ :index, :create ], :path_prefix => '/pages/:page_id', :controller => 'poll_response'
  end

  def activate
    require_dependency 'application_controller'
    admin.tabs.add 'Polls', '/admin/polls', :after => 'Layouts', :visibility => [:all]
    if Radiant::Config.table_exists?
      Radiant::Config['paginate.url_route'] = '' unless Radiant::Config['paginate.url_route']
      PollsExtension.const_set('UrlCache', Radiant::Config['paginate.url_route'])
    end
    Page.send :include, PollTags
    Page.send :include, PollProcess
    Page.send :include, PollPageExtensions
    Page.send :include, ActionView::Helpers::TagHelper # Required for pagination
  end

  def deactivate
    # Not used
  end

end
Something went wrong with that request. Please try again.