Sha256: 9199f8dd2c4e8e99456799f3f9d19dbc93f131c4b4c6527cb74e8009c6114474

Contents?: true

Size: 1.53 KB

Versions: 5

Compression:

Stored size: 1.53 KB

Contents

module Irwi::Support::RouteMapper
  
  # Defining wiki root mount point
  def wiki_root( root, config = {} )
    opts = {
      :controller => 'wiki_pages',
      :root => root
    }.merge(config)
    
    Irwi.config.system_pages.each do |page_action, page_path| # Adding routes for system pages
      connect( "#{root}/#{page_path}", opts.merge({ :action => page_action }) )
    end
        
    connect( "#{root}/compare/*path", opts.merge({ :action => 'compare' }) ) # Comparing two versions of page
    connect( "#{root}/new/*path", opts.merge({ :action => 'new' }) ) # Wiki new route
    connect( "#{root}/edit/*path", opts.merge({ :action => 'edit' }) ) # Wiki edit route
    connect( "#{root}/history/*path", opts.merge({ :action => 'history' }) ) # Wiki history route
    
    # Attachments
    connect("#{root}/attach/*path", opts.merge({:action => 'add_attachment', :conditions => {:method => :post}}))
    connect("#{root}/attach/:attachment_id", opts.merge({:action => 'remove_attachment', :conditions => {:method => :delete}}))
    
    
    connect( "#{root}/*path", opts.merge({ :action => 'destroy', :conditions => { :method => :delete } }) ) # Wiki destroy route
    connect( "#{root}/*path", opts.merge({ :action => 'update', :conditions => { :method => :post } }) ) # Save wiki pages route
    connect( "#{root}/*path", opts.merge({ :action => 'show', :conditions => { :method => :get } }) ) # Wiki pages route
    #connect( "#{root}/*path", opts.merge({ :action => 'show', :conditions => { :method => :get } }) ) # Wiki pages route
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
irwi-0.2.4 lib/irwi/support/route_mapper.rb
irwi-0.2.3 lib/irwi/support/route_mapper.rb
irwi-0.2.2 lib/irwi/support/route_mapper.rb
irwi-0.2.1 lib/irwi/support/route_mapper.rb
irwi-0.2.0 lib/irwi/support/route_mapper.rb