motiro 0.6.7 → 0.6.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/app/controllers/wiki_controller.rb +15 -14
- data/app/core/version.rb +1 -1
- data/app/models/revision.rb +26 -24
- data/app/views/report/show.rhtml +1 -1
- data/app/views/wiki/_diffbar.rhtml +12 -0
- data/app/views/wiki/_editbar.rhtml +2 -7
- data/app/views/wiki/_editor.rhtml +6 -0
- data/app/views/wiki/diff.rhtml +2 -2
- data/app/views/wiki/page_feed.rxml +6 -1
- data/app/views/wiki/show.rhtml +1 -1
- data/app/views/wiki/sourcediff.rhtml +4 -0
- data/config/routes.rb +3 -2
- data/db/translation/pt-BR.rb +5 -0
- data/lib/array_extensions.rb +30 -0
- data/lib/differ.rb +46 -0
- data/lib/string_extensions.rb +29 -2
- data/lib/wiki_renderer.rb +73 -2
- data/public/stylesheets/motiro.css +2 -2
- data/test/fixtures/revisions.yml +2 -0
- data/test/functional/root_controller_test.rb +1 -1
- data/test/functional/wiki_controller_test.rb +31 -5
- data/test/unit/array_extensions_test.rb +40 -0
- data/test/unit/revision_test.rb +1 -1
- data/test/unit/string_extensions_test.rb +39 -0
- data/test/unit/wiki_renderer_test.rb +151 -12
- metadata +8 -9
- data/app/helpers/report_helper.rb.rej +0 -46
- data/app/views/wiki/history.rhtml.rej +0 -63
- data/db/translation/pt-BR.rb.rej +0 -26
- data/public/stylesheets/motiro.css.rej +0 -37
- data/public/wiki/history/OtherPage-en-us.xml +0 -40
data/README
CHANGED
@@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License
|
|
15
15
|
along with this program; if not, write to the Free Software
|
16
16
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
--------------------------------------------------------------------------------
|
18
|
-
Motiro version 0.6.
|
18
|
+
Motiro version 0.6.8 - July 2007
|
19
19
|
|
20
20
|
Please refer to your preferred language README. Every text file below this
|
21
21
|
directory is UTF-8 encoded. Please make sure to set up your reader accordingly.
|
@@ -19,8 +19,9 @@ class WikiController < ApplicationController
|
|
19
19
|
|
20
20
|
layout :choose_layout
|
21
21
|
|
22
|
-
before_filter :login_required, :
|
22
|
+
before_filter :login_required, :only => [:new, :edit, :save]
|
23
23
|
before_filter :fetch_page, :fetch_revision
|
24
|
+
before_filter :fetch_diff, :only => [:diff, :sourcediff]
|
24
25
|
before_filter :check_edit_access, :only => [:edit, :save]
|
25
26
|
|
26
27
|
cache_sweeper :wiki_sweeper, :only => [:edit, :save]
|
@@ -65,6 +66,19 @@ class WikiController < ApplicationController
|
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
69
|
+
def fetch_diff
|
70
|
+
redirect_to params.delete_if {|k,v| :btnCompare == k.to_sym} if params[:btnCompare]
|
71
|
+
@old_revision_num = params[:old_revision]
|
72
|
+
@new_revision_num = params[:new_revision]
|
73
|
+
@old_revision = @page.revisions[@old_revision_num.to_i - 1]
|
74
|
+
@new_revision = @page.revisions[@new_revision_num.to_i - 1]
|
75
|
+
unless @old_revision && @new_revision
|
76
|
+
flash[:notice] = '%s has no revision %s' / @page.name /
|
77
|
+
(@old_revision.nil? ? @old_revision_num : @new_revision_num)
|
78
|
+
redirect_to :action => 'show', :page_name => params[:page_name]
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
68
82
|
def check_edit_access
|
69
83
|
unless current_user.can_edit?(@page)
|
70
84
|
flash[:not_authorized] = true
|
@@ -100,19 +114,6 @@ class WikiController < ApplicationController
|
|
100
114
|
end
|
101
115
|
end
|
102
116
|
|
103
|
-
def diff
|
104
|
-
redirect_to params.delete_if {|k,v| :btnCompare == k.to_sym} if params[:btnCompare]
|
105
|
-
@old_revision_num = params[:old_revision]
|
106
|
-
@new_revision_num = params[:new_revision]
|
107
|
-
@old_revision = @page.revisions[@old_revision_num.to_i - 1]
|
108
|
-
new_revision = @page.revisions[@new_revision_num.to_i - 1]
|
109
|
-
unless @old_revision && new_revision
|
110
|
-
flash[:notice] = '%s has no revision %s' / @page.name /
|
111
|
-
(@old_revision.nil? ? @old_revision_num : @new_revision_num)
|
112
|
-
redirect_to :action => 'show', :page_name => params[:page_name]
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
117
|
def access_denied
|
117
118
|
redirect_to :controller => 'wiki', :action => 'show',
|
118
119
|
:page_name => params[:page_name]
|
data/app/core/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
MOTIRO_VERSION = '0.6.
|
1
|
+
MOTIRO_VERSION = '0.6.8'
|
data/app/models/revision.rb
CHANGED
@@ -15,9 +15,6 @@
|
|
15
15
|
# along with this program; if not, write to the Free Software
|
16
16
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
|
18
|
-
require 'diff/lcs'
|
19
|
-
require 'diff/lcs/array'
|
20
|
-
|
21
18
|
class Revision < ActiveRecord::Base
|
22
19
|
belongs_to :page
|
23
20
|
belongs_to :last_editor, :class_name => 'User', :foreign_key => 'last_editor_id'
|
@@ -27,32 +24,37 @@ class Revision < ActiveRecord::Base
|
|
27
24
|
define_method(method) { page.send(method) }
|
28
25
|
end
|
29
26
|
|
27
|
+
def diff(rev_num)
|
28
|
+
ChunkDiffer.new.diff(text.split($/),
|
29
|
+
#position numbers are 1-based, but we want 0-based when indexing revisions
|
30
|
+
page.revisions[rev_num - 1].text.split($/))
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
class ChunkDiffer
|
36
|
+
|
37
|
+
def diff(old_lines, new_lines)
|
38
|
+
@chunks = []
|
39
|
+
Differ.new(self).diff(old_lines, new_lines)
|
40
|
+
end
|
41
|
+
|
30
42
|
LCS_ACTION_TO_SYMBOL = {'=' => :unchanged, '!' => :modification,
|
31
|
-
'-' => :
|
43
|
+
'-' => :deletion, '+' => :addition}
|
32
44
|
|
33
|
-
def
|
34
|
-
|
35
|
-
|
36
|
-
chunks = []
|
37
|
-
last_action = chunk = nil
|
38
|
-
sdiffs.each do |sdiff|
|
39
|
-
if chunk_break_needed(last_action, sdiff.action)
|
40
|
-
chunk = Chunk.new(LCS_ACTION_TO_SYMBOL[sdiff.action])
|
41
|
-
chunks << chunk
|
42
|
-
end
|
43
|
-
last_action = sdiff.action
|
44
|
-
#lcs's position are 0-based, but we want 1-based when rendering
|
45
|
-
chunk << Line.new(sdiff.old_element, sdiff.old_position + 1,
|
46
|
-
sdiff.new_element, sdiff.new_position + 1)
|
47
|
-
end
|
48
|
-
|
49
|
-
chunks
|
45
|
+
def start_new_chunk(action)
|
46
|
+
@chunk = Chunk.new(LCS_ACTION_TO_SYMBOL[action])
|
47
|
+
@chunks << @chunk
|
50
48
|
end
|
51
49
|
|
52
|
-
|
50
|
+
def store_diff(sdiff)
|
51
|
+
#lcs's position are 0-based, but we want 1-based when rendering
|
52
|
+
@chunk << Line.new(sdiff.old_element, sdiff.old_position + 1,
|
53
|
+
sdiff.new_element, sdiff.new_position + 1)
|
54
|
+
end
|
53
55
|
|
54
|
-
def
|
55
|
-
|
56
|
+
def get_result
|
57
|
+
@chunks
|
56
58
|
end
|
57
59
|
|
58
60
|
end
|
data/app/views/report/show.rhtml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<% @title = "#{'Revision details'.t} - #{@headline.title(Translator.for(@locale))} (Motiro)" %>
|
2
2
|
<% cache(:action => 'show', :suffix => 'summary', :locale => @locale) do %>
|
3
3
|
<% pagetext('Revision %s' / truncate(@revision_id)) do %>
|
4
|
-
<%= @renderer.
|
4
|
+
<%= @renderer.render_wiki_text(@headline.description(Translator.for(@locale))) %>
|
5
5
|
<div id="summary">
|
6
6
|
<% @headline.changes.each do |change| %>
|
7
7
|
<%= render_summary(change) -%>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<div class='toolbar bottombar'>
|
2
|
+
<%= render :partial => 'editor' %>
|
3
|
+
<%= if 'diff' == params[:action]
|
4
|
+
link_to 'View source diff'.t, params.merge(:action => 'sourcediff')
|
5
|
+
else
|
6
|
+
link_to 'View rendered diff'.t, params.merge(:action => 'diff')
|
7
|
+
end -%> |
|
8
|
+
<%= link_to 'View revision %s' / @new_revision_num,
|
9
|
+
:action => 'show', :page_name => @page.name,
|
10
|
+
:revision => @new_revision_num -%>
|
11
|
+
<%= page_history_link(@page) -%>
|
12
|
+
</div>
|
@@ -1,10 +1,5 @@
|
|
1
|
-
<div class='toolbar
|
2
|
-
|
3
|
-
<p>
|
4
|
-
<i><%= 'Last update by %s at %s' / @page.last_editor.login /
|
5
|
-
@page.modified_at.to_s(:rfc822) -%></i>
|
6
|
-
</p>
|
7
|
-
<% end %>
|
1
|
+
<div class='toolbar bottombar'>
|
2
|
+
<%= render :partial => 'editor' %>
|
8
3
|
<% if current_user.nil? then %>
|
9
4
|
<span class='disabled'>
|
10
5
|
<%= 'Edit'.t -%> <%= '(requires authentication)'.t -%>
|
data/app/views/wiki/diff.rhtml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
<% pagetext(@page.title, '(Comparing revisions %s and %s)' / @old_revision_num / @new_revision_num) do %>
|
2
|
-
<%=
|
3
|
-
<%= render :partial => '
|
2
|
+
<%= @renderer.render_wiki_diff(@old_revision.text, @new_revision.text) %>
|
3
|
+
<%= render :partial => 'diffbar' %>
|
4
4
|
<% end %>
|
@@ -13,7 +13,12 @@ xml.rss 'version' => '2.0',
|
|
13
13
|
@page.revisions.reverse[0..10].each do |rev|
|
14
14
|
xml.item do
|
15
15
|
xml.title h(rev.title)
|
16
|
-
|
16
|
+
if rev.position > 1
|
17
|
+
xml.description @renderer.render_wiki_diff(
|
18
|
+
@page.revisions[rev.position - 2].text, rev.text)
|
19
|
+
else
|
20
|
+
xml.description @renderer.render_wiki_text(rev.text)
|
21
|
+
end
|
17
22
|
xml.pubDate h(rev.modified_at.to_s(:rfc822))
|
18
23
|
xml.dc :creator, h(rev.last_editor.login)
|
19
24
|
xml.guid server_url_for(:action => 'show', :page_name => @page.name,
|
data/app/views/wiki/show.rhtml
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
:page => @page.name, :locale_suffix => @locale,
|
4
4
|
:revision => @page_revision_id) do %>
|
5
5
|
<%= render :partial => 'properties_show' %>
|
6
|
-
<%= @renderer.
|
6
|
+
<%= @renderer.render_wiki_text(@page.text) %>
|
7
7
|
<% end %>
|
8
8
|
<%= render :partial => 'editbar' %>
|
9
9
|
<% end %>
|
data/config/routes.rb
CHANGED
@@ -42,8 +42,9 @@ ActionController::Routing::Routes.draw do |map|
|
|
42
42
|
:action => 'last',
|
43
43
|
:defaults => locale_defaults.merge(:kind => 'common')
|
44
44
|
|
45
|
-
map.connect 'wiki
|
46
|
-
:controller => 'wiki',
|
45
|
+
map.connect 'wiki/:action/:page_name/:old_revision/:new_revision',
|
46
|
+
:controller => 'wiki',
|
47
|
+
:requirements => { :action => /(source)?diff/}
|
47
48
|
|
48
49
|
map.connect 'wiki/:action/:locale',
|
49
50
|
:controller => 'wiki',
|
data/db/translation/pt-BR.rb
CHANGED
@@ -71,7 +71,12 @@
|
|
71
71
|
'event description' => 'descrição de evento',
|
72
72
|
'Who should be able to edit this page?' => 'Quem pode editar esta página?',
|
73
73
|
'(Usernames separated by spaces. Blank for everyone)' => '(Nomes de usuário separados por espaços. Em branco para todos.)',
|
74
|
+
|
75
|
+
# Wiki diff
|
74
76
|
'(Comparing revisions %s and %s)' => '(Diferenças entre as revisões %s e %s)',
|
77
|
+
'View rendered diff' => 'Ver comparativo renderizado',
|
78
|
+
'View source diff' => 'Ver comparativo de código',
|
79
|
+
'View revision %s' => 'Ver a revisão %s',
|
75
80
|
|
76
81
|
# Older headlines and history pages
|
77
82
|
'Author' => 'Autor',
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Motiro - A project tracking tool
|
2
|
+
# Copyright (C) 2006-2007 Thiago Arrais
|
3
|
+
#
|
4
|
+
# This program is free software; you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation; either version 2 of the License, or
|
7
|
+
# any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
+
|
18
|
+
class Array
|
19
|
+
|
20
|
+
def xml_join
|
21
|
+
str = ''
|
22
|
+
each do |s|
|
23
|
+
str << ' ' unless str.empty? || s.empty? ||
|
24
|
+
str.match(/<[^\/][^>]*>\Z/) || s.match(/\A<\//)
|
25
|
+
str << s
|
26
|
+
end
|
27
|
+
str
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/lib/differ.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Motiro - A project tracking tool
|
2
|
+
# Copyright (C) 2006-2007 Thiago Arrais
|
3
|
+
#
|
4
|
+
# This program is free software; you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation; either version 2 of the License, or
|
7
|
+
# any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
+
|
18
|
+
require 'diff/lcs'
|
19
|
+
require 'diff/lcs/array'
|
20
|
+
|
21
|
+
Differ = Struct.new(:target)
|
22
|
+
class Differ
|
23
|
+
|
24
|
+
def diff(old_elems, new_elems)
|
25
|
+
sdiffs = old_elems.sdiff(new_elems)
|
26
|
+
|
27
|
+
last_action = nil
|
28
|
+
sdiffs.each do |sdiff|
|
29
|
+
if chunk_break_needed(last_action, sdiff.action)
|
30
|
+
target.start_new_chunk(sdiff.action)
|
31
|
+
end
|
32
|
+
last_action = sdiff.action
|
33
|
+
|
34
|
+
target.store_diff(sdiff)
|
35
|
+
end
|
36
|
+
|
37
|
+
target.get_result
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def chunk_break_needed(prev, curr)
|
43
|
+
prev.nil? || curr != prev && [prev, curr].include?('=')
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
data/lib/string_extensions.rb
CHANGED
@@ -1,10 +1,37 @@
|
|
1
|
+
# Motiro - A project tracking tool
|
2
|
+
# Copyright (C) 2006-2007 Thiago Arrais
|
3
|
+
#
|
4
|
+
# This program is free software; you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation; either version 2 of the License, or
|
7
|
+
# any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
+
|
1
18
|
require 'rubygems'
|
2
19
|
require 'mediacloth'
|
3
20
|
|
4
21
|
class String
|
5
|
-
|
22
|
+
|
6
23
|
def medialize
|
7
24
|
MediaCloth::wiki_to_html self
|
8
25
|
end
|
9
|
-
|
26
|
+
|
27
|
+
def xml_split
|
28
|
+
str = self
|
29
|
+
words = []
|
30
|
+
while(md = str.match(/<([^>]+)(\s+[^>]+)?>.*?<\/\1>|[^\s<]+/m))
|
31
|
+
words << md[0]
|
32
|
+
str = md.post_match
|
33
|
+
end
|
34
|
+
words
|
35
|
+
end
|
36
|
+
|
10
37
|
end
|
data/lib/wiki_renderer.rb
CHANGED
@@ -18,6 +18,9 @@
|
|
18
18
|
require 'rubygems'
|
19
19
|
require 'mediacloth'
|
20
20
|
|
21
|
+
require 'string_extensions'
|
22
|
+
require 'array_extensions'
|
23
|
+
|
21
24
|
class WikiRenderer
|
22
25
|
|
23
26
|
include MediaCloth
|
@@ -27,16 +30,84 @@ class WikiRenderer
|
|
27
30
|
@translator = Translator.for(locale_code)
|
28
31
|
end
|
29
32
|
|
30
|
-
def
|
33
|
+
def render_wiki_text(text)
|
31
34
|
localized_text = @translator.localize(text).delete("\r")
|
32
35
|
expanded_text = expand_internal_links(localized_text)
|
33
36
|
wiki_to_html(expanded_text)
|
34
37
|
end
|
35
38
|
|
39
|
+
def render_wiki_diff(old_text, new_text)
|
40
|
+
old_result = render_wiki_text(old_text)
|
41
|
+
new_result = render_wiki_text(new_text)
|
42
|
+
|
43
|
+
HtmlDiffRenderer.new.render_html_diff(old_result, new_result)
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
36
48
|
def expand_internal_links(text)
|
37
49
|
text.gsub(/\[(\w+)([ \t]+([^\]]+))?\]/) do |substr|
|
38
50
|
"[#{@url_generator.generate_url_for($1)} #{$2 ? $2: $1}]"
|
39
51
|
end
|
40
52
|
end
|
41
53
|
|
42
|
-
end
|
54
|
+
end
|
55
|
+
|
56
|
+
class HtmlDiffRenderer
|
57
|
+
|
58
|
+
def render_html_diff(old_html, new_html)
|
59
|
+
@diff_words = @removed_text = @inserted_text = []
|
60
|
+
Differ.new(self).diff(old_html.xml_split, new_html.xml_split)
|
61
|
+
end
|
62
|
+
|
63
|
+
def start_new_chunk(action)
|
64
|
+
inject(@diff_words, @removed_text.xml_join, @inserted_text.xml_join)
|
65
|
+
@removed_text = []
|
66
|
+
@inserted_text = []
|
67
|
+
end
|
68
|
+
|
69
|
+
def store_diff(sdiff)
|
70
|
+
if '=' == sdiff.action
|
71
|
+
@diff_words << sdiff.old_element
|
72
|
+
else
|
73
|
+
@removed_text << sdiff.old_element unless sdiff.old_element.nil?
|
74
|
+
@inserted_text << sdiff.new_element unless sdiff.new_element.nil?
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def get_result
|
79
|
+
inject(@diff_words, @removed_text.xml_join, @inserted_text.xml_join)
|
80
|
+
|
81
|
+
@diff_words.xml_join
|
82
|
+
end
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
HTML_ELEMENT = /<([^>]+)(\s+[^>]+)?>(.*?)<\/\1>/m
|
87
|
+
|
88
|
+
def inject(words, old_text, new_text)
|
89
|
+
match_old = old_text.match(HTML_ELEMENT)
|
90
|
+
match_new = new_text.match(HTML_ELEMENT)
|
91
|
+
if match_old && match_new && match_old[1..2] == match_new[1..2]
|
92
|
+
words << [HtmlDiffRenderer.new.render_html_diff(match_old.pre_match, match_new.pre_match),
|
93
|
+
"<#{match_old[1..2].join}>",
|
94
|
+
HtmlDiffRenderer.new.render_html_diff(match_old[3], match_new[3]),
|
95
|
+
"</#{match_old[1]}>",
|
96
|
+
HtmlDiffRenderer.new.render_html_diff(match_old.post_match, match_new.post_match)].xml_join
|
97
|
+
else
|
98
|
+
injection = ''
|
99
|
+
injection += enclose('#ffb8b8', old_text) unless old_text.empty?
|
100
|
+
injection += enclose('#b8ffb8', new_text) unless new_text.empty?
|
101
|
+
words << injection
|
102
|
+
end
|
103
|
+
words
|
104
|
+
end
|
105
|
+
|
106
|
+
def enclose(color, text)
|
107
|
+
return "<span style=\"background: #{color}\">#{text}</span>" unless ?< == text[0]
|
108
|
+
match = text.match(HTML_ELEMENT)
|
109
|
+
[match.pre_match,
|
110
|
+
"<#{match[1..2].join}><span style=\"background: #{color}\">#{match[3]}</span></#{match[1]}>",
|
111
|
+
match.post_match].xml_join
|
112
|
+
end
|
113
|
+
end
|
@@ -122,11 +122,11 @@ div.toolbar {
|
|
122
122
|
font-size: 0.8em;
|
123
123
|
}
|
124
124
|
|
125
|
-
div.
|
125
|
+
div.bottombar {
|
126
126
|
border-top: 1px dotted #9C9C9C;
|
127
127
|
}
|
128
128
|
|
129
|
-
div.
|
129
|
+
div.bottombar p { margin-top: 0 }
|
130
130
|
|
131
131
|
div.channel_toolbar {
|
132
132
|
border-bottom: 1px dotted #9C9C9C;
|
data/test/fixtures/revisions.yml
CHANGED
@@ -138,6 +138,7 @@ first_multilanguage_revision:
|
|
138
138
|
id: 15
|
139
139
|
page_id: 12
|
140
140
|
kind: feature
|
141
|
+
position: 1
|
141
142
|
modified_at: 2007-06-14 12:03:24
|
142
143
|
last_editor_id: 1000004 #john
|
143
144
|
editors: ""
|
@@ -156,6 +157,7 @@ second_multilanguage_revision:
|
|
156
157
|
id: 16
|
157
158
|
page_id: 12
|
158
159
|
kind: feature
|
160
|
+
position: 2
|
159
161
|
modified_at: 2007-06-14 12:06:38
|
160
162
|
last_editor_id: 1000004 #john
|
161
163
|
editors: ""
|
@@ -155,11 +155,14 @@ class WikiControllerTest < Test::Unit::TestCase
|
|
155
155
|
end
|
156
156
|
|
157
157
|
def test_considers_last_chosen_language_when_displaying_not_found_page
|
158
|
-
get '
|
159
|
-
|
158
|
+
get :show, :page_name => 'MultiLanguagePage', :locale => 'en'
|
160
159
|
get :show, :page_name => 'NotYetCreatedPage'
|
161
160
|
assert_tag :content => /nothing to be read here/
|
162
|
-
|
161
|
+
|
162
|
+
get :show, :page_name => 'MultiLanguagePage', :locale => 'pt'
|
163
|
+
get :show, :page_name => 'NotYetCreatedPage'
|
164
|
+
assert_tag :content => /agora mesmo, basta clicar/
|
165
|
+
end
|
163
166
|
|
164
167
|
def test_auto_selects_page_kind
|
165
168
|
log_as 'bob'
|
@@ -349,11 +352,11 @@ class WikiControllerTest < Test::Unit::TestCase
|
|
349
352
|
|
350
353
|
assert_xml_element "//item/description[contains(text(), 'This is the first English version')]"
|
351
354
|
assert_xml_element "//item/description[contains(text(), 'Here is some <b>bold</b> text')]"
|
352
|
-
assert_xml_element "//item/description[contains(text(), 'This is the second English version')]"
|
355
|
+
assert_xml_element "//item/description[contains(text(), 'This is the <span style=\"background: #ffb8b8\">first</span><span style=\"background: #b8ffb8\">second</span> English version')]"
|
353
356
|
|
354
357
|
get :history, :page_name => page_name, :locale => 'pt-br', :format => 'xml'
|
355
358
|
assert_xml_element "//item/description[contains(text(), 'Esta é a primeira versão em português')]"
|
356
|
-
assert_xml_element "//item/description[contains(text(), 'Esta é a segunda versão em português')]"
|
359
|
+
assert_xml_element "//item/description[contains(text(), 'Esta é a <span style=\"background: #ffb8b8\">primeira</span><span style=\"background: #b8ffb8\">segunda</span> versão em português')]"
|
357
360
|
end
|
358
361
|
|
359
362
|
def test_history_links_to_page_revision
|
@@ -403,6 +406,29 @@ class WikiControllerTest < Test::Unit::TestCase
|
|
403
406
|
assert_no_xml_element "//input[@name='old_revision' and @value!='#{n - 1}' and @checked='checked']"
|
404
407
|
assert_no_xml_element "//input[@name='new_revision' and @value!='#{n}' and @checked='checked']"
|
405
408
|
end
|
409
|
+
|
410
|
+
def test_shows_rendered_diff
|
411
|
+
page = pages('changed_page')
|
412
|
+
get :diff, :page_name => page.name, :old_revision => 1, :new_revision => 2
|
413
|
+
|
414
|
+
assert_tag :span, :attributes => {:style => 'background: #b8ffb8'},
|
415
|
+
:content => 'Eric changed the text that'
|
416
|
+
assert_tag :span, :attributes => {:style => 'background: #ffb8b8'},
|
417
|
+
:content => 'some text here'
|
418
|
+
assert_tag :a, :content => 'View source diff'
|
419
|
+
assert_tag :a, :content => 'View revision 2'
|
420
|
+
end
|
421
|
+
|
422
|
+
def test_shows_source_diff
|
423
|
+
page = pages('changed_page')
|
424
|
+
get :sourcediff, :page_name => page.name,
|
425
|
+
:old_revision => 1, :new_revision => 2
|
426
|
+
|
427
|
+
assert_tag :td, :content => /John entered some text here/
|
428
|
+
assert_tag :td, :content => /Eric changed the text that John entered/
|
429
|
+
assert_tag :a, :content => 'View rendered diff'
|
430
|
+
assert_tag :a, :content => 'View revision 2'
|
431
|
+
end
|
406
432
|
|
407
433
|
private
|
408
434
|
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Motiro - A project tracking tool
|
2
|
+
# Copyright (C) 2006-2007 Thiago Arrais
|
3
|
+
#
|
4
|
+
# This program is free software; you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation; either version 2 of the License, or
|
7
|
+
# any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
+
|
18
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
19
|
+
require 'array_extensions'
|
20
|
+
|
21
|
+
class ArrayExtensionsTest < Test::Unit::TestCase
|
22
|
+
|
23
|
+
def test_xml_joins_enclosing_elements
|
24
|
+
words = ['<p>', 'This', 'is', 'a', 'paragraph', '</p>']
|
25
|
+
assert_equal '<p>This is a paragraph</p>', words.xml_join
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_xml_joins_inline_elements_with_spaces
|
29
|
+
words = ['<p>', 'A', '<a href="http://www.motiro.org">', 'link', '</a>',
|
30
|
+
'here', '</p>']
|
31
|
+
assert_equal '<p>A <a href="http://www.motiro.org">link</a> here</p>',
|
32
|
+
words.xml_join
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_xml_joins_empty_strings
|
36
|
+
words = ['<p>A paragraph</p>', '']
|
37
|
+
assert_equal '<p>A paragraph</p>', words.xml_join
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
data/test/unit/revision_test.rb
CHANGED
@@ -185,7 +185,7 @@ class RevisionTest < Test::Unit::TestCase
|
|
185
185
|
assert !chunks[1].unchanged?
|
186
186
|
assert chunks[2].unchanged?
|
187
187
|
chunk = chunks[1]
|
188
|
-
assert_equal :
|
188
|
+
assert_equal :deletion, chunk.action
|
189
189
|
assert_equal 1, chunk.lines.size
|
190
190
|
assert_equal 2, chunk.lines.first.original_position
|
191
191
|
assert_equal 'This is the second line', chunk.lines.first.original_text
|
@@ -1,3 +1,20 @@
|
|
1
|
+
# Motiro - A project tracking tool
|
2
|
+
# Copyright (C) 2006-2007 Thiago Arrais
|
3
|
+
#
|
4
|
+
# This program is free software; you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation; either version 2 of the License, or
|
7
|
+
# any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
+
|
1
18
|
require File.dirname(__FILE__) + '/../test_helper'
|
2
19
|
|
3
20
|
class StringExtensionsTest < Test::Unit::TestCase
|
@@ -7,4 +24,26 @@ class StringExtensionsTest < Test::Unit::TestCase
|
|
7
24
|
assert_equal '<h1>Motiro</h1><p>Another paragraph</p>', str.medialize
|
8
25
|
end
|
9
26
|
|
27
|
+
def test_xml_splits_simple_elements
|
28
|
+
str = "<p>This is a paragraph</p><p>And another one</p>"
|
29
|
+
assert_equal ['<p>This is a paragraph</p>', '<p>And another one</p>'],
|
30
|
+
str.xml_split
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_xml_splits_elements_with_attributes
|
34
|
+
str = 'This is a paragraph with a <a href="http://www.motiro.org/">link</a> inside'
|
35
|
+
assert_equal ['This', 'is', 'a', 'paragraph', 'with', 'a',
|
36
|
+
'<a href="http://www.motiro.org/">link</a>', 'inside'], str.xml_split
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_xml_splits_tag_with_line_break
|
40
|
+
str = "<p>This is a\nmultiline change</p>"
|
41
|
+
assert_equal ["<p>This is a\nmultiline change</p>"], str.xml_split
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_xml_splits_multiletter_tags
|
45
|
+
str = '<h2>Level 2 title</h2><p>Paragraph</p>'
|
46
|
+
assert_equal ['<h2>Level 2 title</h2>', '<p>Paragraph</p>'], str.xml_split
|
47
|
+
end
|
48
|
+
|
10
49
|
end
|
@@ -28,7 +28,7 @@ class WikiRendererTest < Test::Unit::TestCase
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_renders_title
|
31
|
-
assert_equal "<h1>Motiro</h1>", renderer.
|
31
|
+
assert_equal "<h1>Motiro</h1>", renderer.render_wiki_text('= Motiro =')
|
32
32
|
end
|
33
33
|
|
34
34
|
def test_breaks_paragraphs_on_linebreak_and_return_feed
|
@@ -36,48 +36,187 @@ class WikiRendererTest < Test::Unit::TestCase
|
|
36
36
|
feed_return_text = "= Motiro =\r\n\r\nThis is project Motiro"
|
37
37
|
expected_text = '<h1>Motiro</h1><p>This is project Motiro</p>'
|
38
38
|
|
39
|
-
assert_equal expected_text, renderer.
|
40
|
-
assert_equal expected_text, renderer.
|
39
|
+
assert_equal expected_text, renderer.render_wiki_text(line_break_only_text)
|
40
|
+
assert_equal expected_text, renderer.render_wiki_text(feed_return_text)
|
41
41
|
end
|
42
42
|
|
43
43
|
def test_render_external_links
|
44
44
|
expected = "<p><a href=\"http://nowhere.com\" rel=\"nofollow\">Nowhere</a></p>"
|
45
|
-
assert_equal expected, renderer.
|
45
|
+
assert_equal expected, renderer.render_wiki_text('[http://nowhere.com Nowhere]')
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_renders_multiple_languages
|
49
49
|
wiki_text = "Bem-vindo ao Motiro\n\n" +
|
50
50
|
"--- en ---\n" +
|
51
51
|
"Welcome to Motiro"
|
52
|
-
assert_equal "<p>Bem-vindo ao Motiro</p>", renderer.
|
52
|
+
assert_equal "<p>Bem-vindo ao Motiro</p>", renderer.render_wiki_text(wiki_text)
|
53
53
|
assert_equal "<p>Welcome to Motiro</p>",
|
54
|
-
WikiRenderer.new(url_generator, 'en').
|
54
|
+
WikiRenderer.new(url_generator, 'en').render_wiki_text(wiki_text)
|
55
55
|
end
|
56
56
|
|
57
57
|
def test_renders_internal_link
|
58
58
|
expected = "<p><a href=\"http://test.host/wiki/show/AnotherPage\" rel=\"nofollow\">go somewhere else</a></p>"
|
59
|
-
assert_equal expected, renderer.
|
59
|
+
assert_equal expected, renderer.render_wiki_text('[AnotherPage go somewhere else]')
|
60
60
|
end
|
61
61
|
|
62
62
|
def test_renders_multiple_internal_links
|
63
63
|
expected = "<p><a href=\"http://test.host/wiki/show/InternalPage\" rel=\"nofollow\">go there</a> <a href=\"http://test.host/wiki/show/OtherInternalPage\" rel=\"nofollow\">and there</a></p>"
|
64
|
-
assert_equal expected, renderer.
|
65
|
-
|
64
|
+
assert_equal expected, renderer.render_wiki_text("[InternalPage go there] " +
|
65
|
+
"[OtherInternalPage and there]")
|
66
66
|
end
|
67
67
|
|
68
68
|
def test_do_not_expand_links_when_there_is_a_break_inside_the_brackets
|
69
69
|
expected = "<p>[ThisIsNotALink\nto anywhere]</p>"
|
70
|
-
assert_equal expected, renderer.
|
70
|
+
assert_equal expected, renderer.render_wiki_text("[ThisIsNotALink\nto anywhere]")
|
71
71
|
end
|
72
72
|
|
73
73
|
def test_expands_internal_links_with_address_only
|
74
74
|
expected = "<p><a href=\"http://test.host/wiki/show/AnotherPage\" rel=\"nofollow\">AnotherPage</a></p>"
|
75
|
-
assert_equal expected, renderer.
|
75
|
+
assert_equal expected, renderer.render_wiki_text("[AnotherPage]")
|
76
76
|
end
|
77
77
|
|
78
78
|
def test_recover_from_unmatched_opening_bracket_inside_link_text
|
79
79
|
assert_equal "<p><a href=\"http://test.host/wiki/show/SomeoneMistankenly\" rel=\"nofollow\">placed an opening bracket [ inside the link text, but Motiro managed to recover correctly</a></p>",
|
80
|
-
renderer.
|
80
|
+
renderer.render_wiki_text("[SomeoneMistankenly placed an opening bracket [ inside the link text, but Motiro managed to recover correctly]")
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_emphasizes_diffs_inside_pure_text_change
|
84
|
+
previous = "There is going to be some change inside this text"
|
85
|
+
current = "There has been some change inside this text"
|
86
|
+
|
87
|
+
assert_equal '<p>There <span style="background: #ffb8b8">is going to be</span>' +
|
88
|
+
'<span style="background: #b8ffb8">has been</span> some change inside ' +
|
89
|
+
'this text</p>',
|
90
|
+
renderer.render_wiki_diff(previous, current)
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_emphasizes_diffs_in_multiple_changes
|
94
|
+
previous = "There is going to be more than one change inside this text"
|
95
|
+
current = "There has been more than one change outside this text"
|
96
|
+
|
97
|
+
assert_equal '<p>There <span style="background: #ffb8b8">is going to be</span>' +
|
98
|
+
'<span style="background: #b8ffb8">has been</span> more than one ' +
|
99
|
+
'change <span style="background: #ffb8b8">inside</span>' +
|
100
|
+
'<span style="background: #b8ffb8">outside</span> ' +
|
101
|
+
'this text</p>',
|
102
|
+
renderer.render_wiki_diff(previous, current)
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_emphasizes_changes_next_to_html_tags
|
106
|
+
previous = "First version was good"
|
107
|
+
current = "Second version was bad"
|
108
|
+
|
109
|
+
assert_equal '<p><span style="background: #ffb8b8">First</span>' +
|
110
|
+
'<span style="background: #b8ffb8">Second</span> version was ' +
|
111
|
+
'<span style="background: #ffb8b8">good</span>' +
|
112
|
+
'<span style="background: #b8ffb8">bad</span></p>',
|
113
|
+
renderer.render_wiki_diff(previous, current)
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_emphasizes_changes_inside_html_tags
|
117
|
+
previous = "Some ''long emphasized'' text"
|
118
|
+
current = "Some ''short emphasized'' text"
|
119
|
+
|
120
|
+
assert_equal '<p>Some <i><span style="background: #ffb8b8">long</span>' +
|
121
|
+
'<span style="background: #b8ffb8">short</span> emphasized</i> text</p>',
|
122
|
+
renderer.render_wiki_diff(previous, current)
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_emphasizes_changes_to_html_tags
|
126
|
+
previous = "Some ''emphasized'' text"
|
127
|
+
current = "Some '''emphasized''' text"
|
128
|
+
|
129
|
+
assert_equal '<p>Some <i><span style="background: #ffb8b8">emphasized</span></i>' +
|
130
|
+
'<b><span style="background: #b8ffb8">emphasized</span></b> text</p>',
|
131
|
+
renderer.render_wiki_diff(previous, current)
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_emphasizes_changes_inside_partially_changed_html_tags
|
135
|
+
previous = "Here is a [http://www.motiro.org link]"
|
136
|
+
current = "Here is a [http://www.motiro.com link]"
|
137
|
+
|
138
|
+
assert_equal '<p>Here is a <a href="http://www.motiro.org" rel="nofollow"><span style="background: #ffb8b8">link</span></a>' +
|
139
|
+
'<a href="http://www.motiro.com" rel="nofollow"><span style="background: #b8ffb8">link</span></a></p>',
|
140
|
+
renderer.render_wiki_diff(previous, current)
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_emphasizes_changed_html_tags_after_changed_text
|
144
|
+
previous = "Here is my ''long text''"
|
145
|
+
current = "Here is your ''long article''"
|
146
|
+
|
147
|
+
assert_equal '<p>Here is <span style="background: #ffb8b8">my</span>' +
|
148
|
+
'<span style="background: #b8ffb8">your</span> ' +
|
149
|
+
'<i>long <span style="background: #ffb8b8">text</span>' +
|
150
|
+
'<span style="background: #b8ffb8">article</span></i>' +
|
151
|
+
'</p>',
|
152
|
+
renderer.render_wiki_diff(previous, current)
|
153
|
+
end
|
154
|
+
|
155
|
+
def test_emphasizes_changed_html_tags_before_changed_text
|
156
|
+
previous = "Here is some ''long text'' that is yours"
|
157
|
+
current = "Here is some ''long article'' that is mine"
|
158
|
+
|
159
|
+
assert_equal '<p>Here is some ' +
|
160
|
+
'<i>long <span style="background: #ffb8b8">text</span>' +
|
161
|
+
'<span style="background: #b8ffb8">article</span></i> ' +
|
162
|
+
'that is <span style="background: #ffb8b8">yours</span>' +
|
163
|
+
'<span style="background: #b8ffb8">mine</span>' +
|
164
|
+
'</p>',
|
165
|
+
renderer.render_wiki_diff(previous, current)
|
166
|
+
end
|
167
|
+
|
168
|
+
def test_emphasizes_line_breaked_changes_as_one
|
169
|
+
previous = "This is a\nmultiline change"
|
170
|
+
current = "This is an\nenvious change"
|
171
|
+
|
172
|
+
assert_equal '<p>This is <span style="background: #ffb8b8">a multiline</span>' +
|
173
|
+
'<span style="background: #b8ffb8">an envious</span> change</p>',
|
174
|
+
renderer.render_wiki_diff(previous, current)
|
175
|
+
end
|
176
|
+
|
177
|
+
def test_emphasizes_text_deletions
|
178
|
+
previous = "Here is something deleted"
|
179
|
+
current = "Here is something"
|
180
|
+
|
181
|
+
assert_equal '<p>Here is something <span style="background: #ffb8b8">deleted</span></p>',
|
182
|
+
renderer.render_wiki_diff(previous, current)
|
183
|
+
end
|
184
|
+
|
185
|
+
def test_emphasizes_text_additions
|
186
|
+
previous = "Here is something"
|
187
|
+
current = "Here is the place I added something"
|
188
|
+
|
189
|
+
assert_equal '<p>Here is <span style="background: #b8ffb8">the place I added</span> something</p>',
|
190
|
+
renderer.render_wiki_diff(previous, current)
|
191
|
+
end
|
192
|
+
|
193
|
+
def test_emphasizes_addition_and_deletions_inside_tags
|
194
|
+
previous = "Here is some ''text in italics''"
|
195
|
+
current = "Here is some ''very good text''"
|
196
|
+
|
197
|
+
assert_equal '<p>Here is some <i><span style="background: #b8ffb8">very good</span> ' +
|
198
|
+
'text <span style="background: #ffb8b8">in italics</span></i></p>',
|
199
|
+
renderer.render_wiki_diff(previous, current)
|
200
|
+
end
|
201
|
+
|
202
|
+
def test_emphasizes_paragraph_addition_and_deletion
|
203
|
+
previous = "First paragraph\n\nSecond paragraph"
|
204
|
+
current = "Second paragraph\n\nThird paragraph"
|
205
|
+
|
206
|
+
assert_equal '<p><span style="background: #ffb8b8">First paragraph</span></p> ' +
|
207
|
+
'<p>Second paragraph</p> ' +
|
208
|
+
'<p><span style="background: #b8ffb8">Third paragraph</span></p>',
|
209
|
+
renderer.render_wiki_diff(previous, current)
|
210
|
+
end
|
211
|
+
|
212
|
+
def test_emphasize_change_inside_title_tag
|
213
|
+
previous = "== Sub title ==\n\nParagraph"
|
214
|
+
current = "== Super title ==\n\nParagraph"
|
215
|
+
|
216
|
+
assert_equal '<h2><span style="background: #ffb8b8">Sub</span>' +
|
217
|
+
'<span style="background: #b8ffb8">Super</span> title</h2> ' +
|
218
|
+
'<p>Paragraph</p>',
|
219
|
+
renderer.render_wiki_diff(previous, current)
|
81
220
|
end
|
82
221
|
|
83
222
|
private
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: motiro
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.6.
|
7
|
-
date: 2007-07-
|
6
|
+
version: 0.6.8
|
7
|
+
date: 2007-07-25 00:00:00 -03:00
|
8
8
|
summary: Simple project tracking tool
|
9
9
|
require_paths:
|
10
10
|
- .
|
@@ -68,7 +68,6 @@ files:
|
|
68
68
|
- db/translation
|
69
69
|
- db/migrate
|
70
70
|
- db/translation/pt-BR.rb
|
71
|
-
- db/translation/pt-BR.rb.rej
|
72
71
|
- db/migrate/018_drop_redundant_page_columns.rb
|
73
72
|
- db/migrate/013_nullify_initial_page_attributes.rb
|
74
73
|
- db/migrate/017_revision_mimics_page.rb
|
@@ -117,14 +116,16 @@ files:
|
|
117
116
|
- app/views/report
|
118
117
|
- app/views/wiki/diff.rhtml
|
119
118
|
- app/views/wiki/_editbar.rhtml
|
119
|
+
- app/views/wiki/sourcediff.rhtml
|
120
120
|
- app/views/wiki/history.rhtml
|
121
121
|
- app/views/wiki/page_feed.rxml
|
122
|
+
- app/views/wiki/_diffbar.rhtml
|
122
123
|
- app/views/wiki/_properties_show.rhtml
|
123
124
|
- app/views/wiki/properties_edit.rhtml
|
124
125
|
- app/views/wiki/edit.rhtml
|
125
126
|
- app/views/wiki/show.rhtml
|
126
|
-
- app/views/wiki/history.rhtml.rej
|
127
127
|
- app/views/wiki/_properties_edit.rhtml
|
128
|
+
- app/views/wiki/_editor.rhtml
|
128
129
|
- app/views/account/_availability.rhtml
|
129
130
|
- app/views/account/logout.rhtml
|
130
131
|
- app/views/account/availability.rhtml
|
@@ -170,7 +171,6 @@ files:
|
|
170
171
|
- app/helpers/root_helper.rb
|
171
172
|
- app/helpers/account_helper.rb
|
172
173
|
- app/helpers/default_page_provider.rb
|
173
|
-
- app/helpers/report_helper.rb.rej
|
174
174
|
- app/reporters/svn_connection.rb
|
175
175
|
- app/reporters/svn_settings.rb
|
176
176
|
- app/reporters/darcs_settings.rb
|
@@ -188,6 +188,7 @@ files:
|
|
188
188
|
- app/controllers/application.rb
|
189
189
|
- lib/diff_chunk_builder.rb
|
190
190
|
- lib/tick_daemon.rb
|
191
|
+
- lib/array_extensions.rb
|
191
192
|
- lib/import_translations.rb
|
192
193
|
- lib/translator.rb
|
193
194
|
- lib/stub_hash.rb
|
@@ -195,12 +196,12 @@ files:
|
|
195
196
|
- lib/login_system.rb
|
196
197
|
- lib/tasks
|
197
198
|
- lib/wiki_url_generator.rb
|
199
|
+
- lib/differ.rb
|
198
200
|
- lib/wiki_renderer.rb
|
199
201
|
- lib/string_extensions.rb
|
200
202
|
- lib/tasks/packaging.rake
|
201
203
|
- lib/tasks/testing.rake
|
202
204
|
- doc/README_FOR_APP
|
203
|
-
- public/wiki
|
204
205
|
- public/dispatch.fcgi
|
205
206
|
- public/dispatch.rb
|
206
207
|
- public/favicon.ico
|
@@ -211,12 +212,9 @@ files:
|
|
211
212
|
- public/500.html
|
212
213
|
- public/dispatch.cgi
|
213
214
|
- public/404.html
|
214
|
-
- public/wiki/history
|
215
|
-
- public/wiki/history/OtherPage-en-us.xml
|
216
215
|
- public/images/rss.png
|
217
216
|
- public/images/calendar.png
|
218
217
|
- public/stylesheets/niftyCorners.css
|
219
|
-
- public/stylesheets/motiro.css.rej
|
220
218
|
- public/stylesheets/scaffold.css
|
221
219
|
- public/stylesheets/motiro.css
|
222
220
|
- public/javascripts/dragdrop.js
|
@@ -283,6 +281,7 @@ files:
|
|
283
281
|
- test/unit/caching_test.rb
|
284
282
|
- test/unit/settings_test.rb
|
285
283
|
- test/unit/default_page_provider_test.rb
|
284
|
+
- test/unit/array_extensions_test.rb
|
286
285
|
- test/stubs/svn_settings.rb
|
287
286
|
- test/stubs/url_generator.rb
|
288
287
|
- test/fixtures/revisions.yml
|
@@ -1,46 +0,0 @@
|
|
1
|
-
***************
|
2
|
-
*** 22,57 ****
|
3
|
-
Builder::XmlMarkup.new.div(:id => ref(change),
|
4
|
-
:class => "diff-window") do |b|
|
5
|
-
b.h2 'Changes to %s' / change.resource_name
|
6
|
-
- b.table :class => 'diff', :cellspacing => '0' do
|
7
|
-
- b.colgroup do
|
8
|
-
- b.col :class => 'line_number'
|
9
|
-
- b.col :class => 'left'
|
10
|
-
- b.col :class => 'right'
|
11
|
-
- b.col :class => 'line_number'
|
12
|
-
- end
|
13
|
-
- change.chunked_diff.each do |chunk|
|
14
|
-
- if chunk.separator?
|
15
|
-
- b.tbody :class => 'separator' do
|
16
|
-
- b.tr do
|
17
|
-
- b.td
|
18
|
-
- b.td('%s more lines' / chunk.num_lines.to_s, :colspan => '2')
|
19
|
-
- b.td
|
20
|
-
- end
|
21
|
-
- end
|
22
|
-
- else
|
23
|
-
- b.tbody :class => chunk.action.to_s do
|
24
|
-
- chunk.lines.each do |line|
|
25
|
-
- b.tr do
|
26
|
-
- b.td {b << (line.original_position || ' ').to_s}
|
27
|
-
- b.td {b.pre{b << (h(line.original_text) || ' ')}}
|
28
|
-
- b.td {b.pre{b << (h(line.modified_text) || ' ')}}
|
29
|
-
- b.td {b << (line.modified_position || ' ').to_s}
|
30
|
-
- end
|
31
|
-
- end
|
32
|
-
- end
|
33
|
-
- end
|
34
|
-
- end
|
35
|
-
- end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
--- 22,28 ----
|
40
|
-
Builder::XmlMarkup.new.div(:id => ref(change),
|
41
|
-
:class => "diff-window") do |b|
|
42
|
-
b.h2 'Changes to %s' / change.resource_name
|
43
|
-
+ b << render_diff_table(change.chunked_diff)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
@@ -1,63 +0,0 @@
|
|
1
|
-
***************
|
2
|
-
*** 1,26 ****
|
3
|
-
<% pagetext('Page history for %s' / @page.title) do %>
|
4
|
-
- <table class="oldernews">
|
5
|
-
- <thead>
|
6
|
-
- <tr>
|
7
|
-
- <th class="date"><%= 'Date'.t -%></th>
|
8
|
-
- <th class="relative"/>
|
9
|
-
- <th><%= 'Author'.t -%></th>
|
10
|
-
- <th><%= 'Title'.t -%></th>
|
11
|
-
- </tr>
|
12
|
-
- </thead>
|
13
|
-
- <tbody>
|
14
|
-
- <% @page.revisions.reverse.each do |rev| %>
|
15
|
-
- <tr class="<%= rev.position % 2 == 0 ? 'odd' : 'even' -%>">
|
16
|
-
- <td class="date"><%= rev.modified_at-%></td>
|
17
|
-
- <td class="relative"><%= rev.modified_at.relative_to_now %></td>
|
18
|
-
- <td><%= rev.last_editor.login %></td>
|
19
|
-
- <td><%= content_tag :a, rev.title,
|
20
|
-
:href => server_url_for(:controller => 'wiki',
|
21
|
-
:action => 'show',
|
22
|
-
:page_name => @page.name,
|
23
|
-
- :revision => rev.position) -%></td>
|
24
|
-
- </tr>
|
25
|
-
- <% end %>
|
26
|
-
- </tbody>
|
27
|
-
- </table>
|
28
|
-
<% end %>
|
29
|
-
--- 1,34 ----
|
30
|
-
<% pagetext('Page history for %s' / @page.title) do %>
|
31
|
-
+ <% form_tag "/wiki/diff/#{params[:page_name]}", :method => 'get' do %>
|
32
|
-
+ <%= submit_tag 'Compare revisions'.t, :class => 'button',
|
33
|
-
+ :name => 'btnCompare' %>
|
34
|
-
+ <table class="oldernews">
|
35
|
-
+ <thead>
|
36
|
-
+ <tr>
|
37
|
-
+ <th/>
|
38
|
-
+ <th class="date"><%= 'Date'.t -%></th>
|
39
|
-
+ <th><%= 'Author'.t -%></th>
|
40
|
-
+ </tr>
|
41
|
-
+ </thead>
|
42
|
-
+ <tbody>
|
43
|
-
+ <% @page.revisions.reverse.each do |rev| %>
|
44
|
-
+ <tr class="<%= rev.position % 2 == 0 ? 'odd' : 'even' -%>">
|
45
|
-
+ <td>
|
46
|
-
+ <input type="radio" name="old_revision" value="<%= rev.position-%>" />
|
47
|
-
+ <input type="radio" name="new_revision" value="<%= rev.position-%>" />
|
48
|
-
+ </td>
|
49
|
-
+ <td class="date">
|
50
|
-
+ <%= content_tag :a, rev.modified_at,
|
51
|
-
:href => server_url_for(:controller => 'wiki',
|
52
|
-
:action => 'show',
|
53
|
-
:page_name => @page.name,
|
54
|
-
+ :revision => rev.position) %>
|
55
|
-
+ (<%= rev.modified_at.relative_to_now -%>)
|
56
|
-
+ </td>
|
57
|
-
+ <td><%= rev.last_editor.login %></td>
|
58
|
-
+ </tr>
|
59
|
-
+ <% end %>
|
60
|
-
+ </tbody>
|
61
|
-
+ </table>
|
62
|
-
+ <% end %>
|
63
|
-
<% end %>
|
data/db/translation/pt-BR.rb.rej
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
***************
|
2
|
-
*** 71,80 ****
|
3
|
-
'event description' => 'descrição de evento',
|
4
|
-
'Who should be able to edit this page?' => 'Quem pode editar esta página?',
|
5
|
-
'(Usernames separated by spaces. Blank for everyone)' => '(Nomes de usuário separados por espaços. Em branco para todos.)',
|
6
|
-
|
7
|
-
# Older headlines and history pages
|
8
|
-
'Author' => 'Autor',
|
9
|
-
'Page history for %s' => 'Histórico da página %s',
|
10
|
-
'Page history' => 'Histórico da página',
|
11
|
-
'(Revision %s)' => '(Revisão %s)'
|
12
|
-
}
|
13
|
-
--- 71,83 ----
|
14
|
-
'event description' => 'descrição de evento',
|
15
|
-
'Who should be able to edit this page?' => 'Quem pode editar esta página?',
|
16
|
-
'(Usernames separated by spaces. Blank for everyone)' => '(Nomes de usuário separados por espaços. Em branco para todos.)',
|
17
|
-
+ '(Comparing revisions %s and %s)' => '(Diferenças entre as revisões %s e %s)',
|
18
|
-
|
19
|
-
# Older headlines and history pages
|
20
|
-
'Author' => 'Autor',
|
21
|
-
+ 'Page has no history yet' => 'Página ainda sem histórico',
|
22
|
-
'Page history for %s' => 'Histórico da página %s',
|
23
|
-
+ 'Page history (%s revisions)' => 'Histórico da página (%s revisões)',
|
24
|
-
'Page history' => 'Histórico da página',
|
25
|
-
'(Revision %s)' => '(Revisão %s)'
|
26
|
-
}
|
@@ -1,37 +0,0 @@
|
|
1
|
-
***************
|
2
|
-
*** 182,187 ****
|
3
|
-
}
|
4
|
-
|
5
|
-
table.oldernews {
|
6
|
-
border-spacing: 0;
|
7
|
-
text-align: left;
|
8
|
-
font-size: .85em;
|
9
|
-
--- 183,189 ----
|
10
|
-
}
|
11
|
-
|
12
|
-
table.oldernews {
|
13
|
-
+ margin: .8em 0;
|
14
|
-
border-spacing: 0;
|
15
|
-
text-align: left;
|
16
|
-
font-size: .85em;
|
17
|
-
***************
|
18
|
-
*** 190,198 ****
|
19
|
-
|
20
|
-
table.oldernews tr.even { background-color: #fff; }
|
21
|
-
|
22
|
-
- table.oldernews tr.odd { background-color: #eee; }
|
23
|
-
|
24
|
-
- table.oldernews thead { background-color: #d0d0d0; }
|
25
|
-
|
26
|
-
table.oldernews tbody th { border: 1px #c9c9c9 solid; }
|
27
|
-
|
28
|
-
--- 192,200 ----
|
29
|
-
|
30
|
-
table.oldernews tr.even { background-color: #fff; }
|
31
|
-
|
32
|
-
+ table.oldernews tr.odd { background-color: #e0eeff; }
|
33
|
-
|
34
|
-
+ table.oldernews thead { background-color: #66a0e0; }
|
35
|
-
|
36
|
-
table.oldernews tbody th { border: 1px #c9c9c9 solid; }
|
37
|
-
|
@@ -1,40 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
3
|
-
<channel>
|
4
|
-
<title>Changes to OtherPage</title>
|
5
|
-
<description/>
|
6
|
-
<link>http://localhost:3000/en-us</link>
|
7
|
-
<language>en-us</language>
|
8
|
-
<generator>Motiro</generator>
|
9
|
-
<pubDate>Wed, 04 Jul 2007 00:14:13 -0300</pubDate>
|
10
|
-
<ttl>60</ttl>
|
11
|
-
<item>
|
12
|
-
<title>Another page</title>
|
13
|
-
<description><p>This is the modified English version.</p><p>And I have modified it once more, but that version was not recorded.</p></description>
|
14
|
-
<pubDate>Wed, 04 Jul 2007 00:14:13 -0300</pubDate>
|
15
|
-
<dc:creator>thiagoarrais</dc:creator>
|
16
|
-
<guid>http://localhost:3000/wiki/show/OtherPage?revision=4</guid>
|
17
|
-
</item>
|
18
|
-
<item>
|
19
|
-
<title>Another page</title>
|
20
|
-
<description><p>This is the modified English version.</p><p>And I have modified it once more</p></description>
|
21
|
-
<pubDate>Thu, 14 Jun 2007 00:48:09 -0300</pubDate>
|
22
|
-
<dc:creator>thiagoarrais</dc:creator>
|
23
|
-
<guid>http://localhost:3000/wiki/show/OtherPage?revision=3</guid>
|
24
|
-
</item>
|
25
|
-
<item>
|
26
|
-
<title>Another page</title>
|
27
|
-
<description><p>This is the modified English version</p></description>
|
28
|
-
<pubDate>Thu, 14 Jun 2007 00:47:45 -0300</pubDate>
|
29
|
-
<dc:creator>thiagoarrais</dc:creator>
|
30
|
-
<guid>http://localhost:3000/wiki/show/OtherPage?revision=2</guid>
|
31
|
-
</item>
|
32
|
-
<item>
|
33
|
-
<title>Another page</title>
|
34
|
-
<description><p>This is the English version</p></description>
|
35
|
-
<pubDate>Wed, 13 Jun 2007 21:37:54 -0300</pubDate>
|
36
|
-
<dc:creator>thiagoarrais</dc:creator>
|
37
|
-
<guid>http://localhost:3000/wiki/show/OtherPage?revision=1</guid>
|
38
|
-
</item>
|
39
|
-
</channel>
|
40
|
-
</rss>
|