public
Description: client portfolio extension for radiant cms
Homepage: http://www.saturnflyer.com
Clone URL: git://github.com/saturnflyer/radiant-portfolio.git
radiant-portfolio / portfolio_extension.rb
100644 34 lines (29 sloc) 1.166 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
31
32
33
34
# Uncomment this if you reference any of your controllers in activate
# require_dependency 'application'
 
class PortfolioExtension < Radiant::Extension
  version "1.0"
  description "Allows you to track clients and the results of completed projects"
  url "http://saturnflyer.com/"
  
  define_routes do |map|
    map.namespace(:admin) do |admin|
      admin.portfolio "/portfolio", :controller => 'clients', :conditions => {:method => :get}
      admin.resources :clients, :member => {:add_text => :post} do |clients|
        clients.resources :client_texts
        clients.resources :projects do |projects|
          projects.resources :project_texts
        end
      end
    end
  end
  
  def activate
    Page.send :include, PortfolioTags
    UserActionObserver.instance.send :add_observer!, Client
    UserActionObserver.instance.send :add_observer!, ClientText
    UserActionObserver.instance.send :add_observer!, Project
    UserActionObserver.instance.send :add_observer!, ProjectText
    admin.tabs.add "Portfolio", "/admin/portfolio", :after => "Layouts", :visibility => [:all]
  end
  
  def deactivate
    admin.tabs.remove "Portfolio"
  end
  
end