Project

General

Profile

Defect #10673 » comma_allow.patch

Alexander Oryol, 2012-04-17 08:46

View differences:

app/models/wiki.rb
acts_as_watchable
validates_presence_of :start_page
validates_format_of :start_page, :with => /^[^,\.\/\?\;\|\:]*$/
validates_format_of :start_page, :with => /^[^\.\/\;\|\:]*$/
safe_attributes 'start_page'
......
# 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
app/views/projects/settings/_wiki.html.erb
<div class="box tabular">
<p><%= f.text_field :start_page, :size => 60, :required => true %>
<em class="info"><%= l(:text_unallowed_characters) %>: , . / ? ; : |</em></p>
<em class="info"><%= l(:text_unallowed_characters) %>: . / ? ; : |</em></p>
</div>
<div class="contextual">
(3-3/4)