Defect #10673 » dot-comma.patch
| app/models/wiki.rb | ||
|---|---|---|
|
# turn a string into a valid page title
|
||
|
def self.titleize(title)
|
||
|
# replace spaces with _ and remove unwanted caracters
|
||
|
title = title.gsub(/\s+/, '_').delete(',./?;|:') if title
|
||
|
title = title.gsub(/\s+/, '_').delete('/?;|:') if title
|
||
|
# upcase the first letter
|
||
|
title = (title.slice(0..0).upcase + (title.slice(1..-1) || '')) if title
|
||
|
title
|
||
| app/models/wiki_page.rb | ||
|---|---|---|
|
attr_accessor :redirect_existing_links
|
||
|
validates_presence_of :title
|
||
|
validates_format_of :title, :with => /^[^,\.\/\?\;\|\s]*$/
|
||
|
validates_format_of :title, :with => /^[^\/\?\;\|\s]*$/
|
||
|
validates_uniqueness_of :title, :scope => :wiki_id, :case_sensitive => false
|
||
|
validates_associated :content
|
||
| config/routes.rb | ||
|---|---|---|
|
:conditions => {:method => :get}
|
||
|
map.connect 'projects/:id/wiki', :controller => 'wikis',
|
||
|
:action => 'edit', :conditions => {:method => :post}
|
||
|
:action => 'edit', :conditions => {:method => :post}, :requirements => { :id => /.*/ }
|
||
|
map.connect 'projects/:id/wiki/destroy', :controller => 'wikis',
|
||
|
:action => 'destroy', :conditions => {:method => [:get, :post]}
|
||
|
:action => 'destroy', :conditions => {:method => [:get, :post]}, :requirements => { :id => /.*/ }
|
||
|
map.with_options :controller => 'messages' do |messages_routes|
|
||
|
messages_routes.with_options :conditions => {:method => :get} do |messages_views|
|
||
| ... | ... | |
|
project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get}
|
||
|
project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get}
|
||
|
project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil
|
||
|
project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff'
|
||
|
project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate'
|
||
|
project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil, :requirements => { :id => /.*/ }
|
||
|
project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff', :requirements => { :id => /.*/ }
|
||
|
project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate', :requirements => { :id => /.*/ }
|
||
|
project.resources :wiki, :except => [:new, :create], :member => {
|
||
|
:rename => [:get, :post],
|
||
|
:history => :get,
|
||
| ... | ... | |
|
}, :collection => {
|
||
|
:export => :get,
|
||
|
:date_index => :get
|
||
|
}
|
||
|
}, :requirements => { :id => /.*/ }
|
||
|
end
|
||
|
map.connect 'news', :controller => 'news', :action => 'index'
|
||