comma_allow.patch

Alexander Oryol, 2012-04-17 08:46

Download (2.27 KB)

View differences:

app/models/wiki.rb
24 24
  acts_as_watchable
25 25

  
26 26
  validates_presence_of :start_page
27
  validates_format_of :start_page, :with => /^[^,\.\/\?\;\|\:]*$/
27
  validates_format_of :start_page, :with => /^[^\.\/\;\|\:]*$/
28 28

  
29 29
  safe_attributes 'start_page'
30 30

  
......
89 89
  # turn a string into a valid page title
90 90
  def self.titleize(title)
91 91
    # replace spaces with _ and remove unwanted caracters
92
    title = title.gsub(/\s+/, '_').delete(',./?;|:') if title
92
    title = title.gsub(/\s+/, '_').delete('./?;|:') if title
93 93
    # upcase the first letter
94 94
    title = (title.slice(0..0).upcase + (title.slice(1..-1) || '')) if title
95 95
    title
app/models/wiki_page.rb
40 40
  attr_accessor :redirect_existing_links
41 41

  
42 42
  validates_presence_of :title
43
  validates_format_of :title, :with => /^[^,\.\/\?\;\|\s]*$/
43
  validates_format_of :title, :with => /^[^\.\/\?\;\|\s]*$/
44 44
  validates_uniqueness_of :title, :scope => :wiki_id, :case_sensitive => false
45 45
  validates_associated :content
46 46

  
app/views/projects/settings/_wiki.html.erb
5 5

  
6 6
<div class="box tabular">
7 7
<p><%= f.text_field :start_page, :size => 60, :required => true %>
8
<em class="info"><%= l(:text_unallowed_characters) %>: , . / ? ; : |</em></p>
8
<em class="info"><%= l(:text_unallowed_characters) %>: . / ? ; : |</em></p>
9 9
</div>
10 10

  
11 11
<div class="contextual">
12
-