diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-04-22 09:50:16 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-04-22 09:50:16 +0000 |
commit | 8d7de50ca8f7b440cb67c8161122d20909a3a93f (patch) | |
tree | a92d1509c3730c0ea73065833954e8db4e394dcf /app | |
parent | 3d685f7bec6d4646a8ef87b01c93c8ecc4216be9 (diff) | |
download | redmine-8d7de50ca8f7b440cb67c8161122d20909a3a93f.tar.gz redmine-8d7de50ca8f7b440cb67c8161122d20909a3a93f.zip |
Fixed 10211 Wiki names can't have periods in them.
Same validations as WikiPage model now applied to wiki start page.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@463 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/models/wiki.rb | 3 | ||||
-rw-r--r-- | app/models/wiki_page.rb | 2 | ||||
-rw-r--r-- | app/views/projects/_form.rhtml | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/app/models/wiki.rb b/app/models/wiki.rb index e362273ae..8233c3d48 100644 --- a/app/models/wiki.rb +++ b/app/models/wiki.rb @@ -20,6 +20,7 @@ class Wiki < ActiveRecord::Base has_many :pages, :class_name => 'WikiPage', :dependent => :destroy validates_presence_of :start_page + validates_format_of :start_page, :with => /^[^,\.\/\?\;\|]*$/ # find the page with the given title # if page doesn't exist, return a new page @@ -36,7 +37,7 @@ class Wiki < ActiveRecord::Base # 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[0..0].upcase + title[1..-1] if title title diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index f2ea8fd59..b7964a119 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -20,7 +20,7 @@ class WikiPage < ActiveRecord::Base has_one :content, :class_name => 'WikiContent', :foreign_key => 'page_id', :dependent => :destroy 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 diff --git a/app/views/projects/_form.rhtml b/app/views/projects/_form.rhtml index 03a757d70..5f253d401 100644 --- a/app/views/projects/_form.rhtml +++ b/app/views/projects/_form.rhtml @@ -44,7 +44,7 @@ <%= hidden_field_tag "wiki_enabled", 0 %> <div id="wiki"> <% fields_for :wiki, @project.wiki, { :builder => TabularFormBuilder, :lang => current_language} do |wiki| %> -<p><%= wiki.text_field :start_page, :size => 60, :required => true %></p> +<p><%= wiki.text_field :start_page, :size => 60, :required => true %><br /><em><%= l(:text_unallowed_characters) %>: , . / ? ; |</em></p> <% # content_tag("div", "", :id => "wiki_start_page_auto_complete", :class => "auto_complete") + # auto_complete_field("wiki_start_page", { :url => { :controller => 'wiki', :action => 'auto_complete_for_wiki_page', :id => @project } }) %> |