comparison app/models/.svn/text-base/wiki_page.rb.svn-base @ 246:eeebe205a056 cannam

* Merge from default branch, bringing us up to SVN trunk rev 4993
author Chris Cannam
date Thu, 03 Mar 2011 12:02:03 +0000
parents 051f544170fe
children cbce1fd3b1b7
comparison
equal deleted inserted replaced
138:fca2657f4aa5 246:eeebe205a056
1 # Redmine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2009 Jean-Philippe Lang 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
147 errors.add(:parent_title, :circular_dependency) if parent && (parent == self || parent.ancestors.include?(self)) 147 errors.add(:parent_title, :circular_dependency) if parent && (parent == self || parent.ancestors.include?(self))
148 errors.add(:parent_title, :not_same_project) if parent && (parent.wiki_id != wiki_id) 148 errors.add(:parent_title, :not_same_project) if parent && (parent.wiki_id != wiki_id)
149 end 149 end
150 end 150 end
151 151
152 class WikiDiff 152 class WikiDiff < Redmine::Helpers::Diff
153 attr_reader :diff, :words, :content_to, :content_from 153 attr_reader :content_to, :content_from
154 154
155 def initialize(content_to, content_from) 155 def initialize(content_to, content_from)
156 @content_to = content_to 156 @content_to = content_to
157 @content_from = content_from 157 @content_from = content_from
158 @words = content_to.text.split(/(\s+)/) 158 super(content_to.text, content_from.text)
159 @words = @words.select {|word| word != ' '}
160 words_from = content_from.text.split(/(\s+)/)
161 words_from = words_from.select {|word| word != ' '}
162 @diff = words_from.diff @words
163 end 159 end
164 end 160 end
165 161
166 class WikiAnnotate 162 class WikiAnnotate
167 attr_reader :lines, :content 163 attr_reader :lines, :content