Sha256: 8be4e74a368f1bd7edde94bb745e57b278d350b25a21116b038b41379ab9e212

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

require 'ostruct'
class PeopleExtension < Radiant::Extension
  version "#{File.read(File.expand_path(File.dirname(__FILE__)) + '/VERSION')}"
  description "Manage people."
  url "http://saturnflyer.com/"
  
  extension_config do |config|
    config.gem 'will_paginate'
    config.gem 'searchlogic'
    config.gem 'merger'
  end
  
  define_routes do |map|
    map.merge_admin_people '/admin/people/merge.:format', :controller => 'admin/people', :action => 'merge', :conditions => {:method => :post}
    map.namespace :admin do |admin|
      admin.resources :people, :member => { :remove => :get }
    end
  end
  
  def activate
    Radiant::AdminUI.class_eval do
      attr_accessor :people
    end
    admin.people = load_default_people_regions
    tab "People" do
      add_item 'All People', "/admin/people"
    end
  end
  
  def deactivate
  end
  
  def load_default_people_regions
    returning OpenStruct.new do |people|
      people.index = Radiant::AdminUI::RegionSet.new do |index|
        index.top.concat %w{search}
        index.people_head.concat %w{name_column_head gender_column_head}
        index.person.concat %w{name_column gender_column}
      end
      people.new = Radiant::AdminUI::RegionSet.new do |new|
        new.person_info.concat %w{}
        new.buttons.concat %w{}
      end
      people.edit = people.new.clone
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
radiant-people-extension-1.0.0 people_extension.rb