motiro 0.6.6 → 0.6.7
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 +14 -1
- data/app/core/version.rb +1 -1
- data/app/core/wiki_reporter.rb +4 -17
- data/app/helpers/application_helper.rb +33 -0
- data/app/helpers/report_helper.rb +39 -0
- data/app/helpers/report_helper.rb.rej +46 -0
- data/app/helpers/wiki_helper.rb +1 -1
- data/app/models/change.rb +12 -41
- data/app/models/chunk.rb +56 -0
- data/app/models/page.rb +17 -0
- data/app/models/revision.rb +31 -0
- data/app/reporters/events_reporter.rb +0 -2
- data/app/views/report/show.rhtml +2 -2
- data/app/views/wiki/diff.rhtml +4 -0
- data/app/views/wiki/history.rhtml +32 -21
- data/app/views/wiki/history.rhtml.rej +63 -0
- data/config/motiro.yml +1 -1
- data/config/routes.rb +3 -0
- data/db/motirodb.sqlite.initial +0 -0
- data/db/translation/pt-BR.rb +6 -1
- data/db/translation/pt-BR.rb.rej +26 -0
- data/lib/diff_chunk_builder.rb +98 -0
- data/lib/tasks/packaging.rake +2 -1
- data/public/stylesheets/motiro.css +49 -18
- data/public/stylesheets/motiro.css.rej +37 -0
- data/public/wiki/history/OtherPage-en-us.xml +40 -0
- data/test/fixtures/pages.yml +1 -1
- data/test/fixtures/revisions.yml +15 -4
- data/test/functional/report_features_test.rb +7 -1
- data/test/functional/root_controller_test.rb +1 -1
- data/test/functional/wiki_controller_test.rb +44 -4
- data/test/unit/change_test.rb +29 -56
- data/test/unit/diff_chunk_builder_test.rb +269 -0
- data/test/unit/page_test.rb +46 -0
- data/test/unit/revision_test.rb +160 -0
- data/test/unit/wiki_reporter_test.rb +2 -1
- metadata +301 -283
- data/app/models/diff_table_builder.rb +0 -285
- data/test/unit/diff_table_builder_test.rb +0 -602
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.7 - 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,7 +19,7 @@ class WikiController < ApplicationController
|
|
19
19
|
|
20
20
|
layout :choose_layout
|
21
21
|
|
22
|
-
before_filter :login_required, :except => [:show, :last, :history]
|
22
|
+
before_filter :login_required, :except => [:show, :last, :history, :diff]
|
23
23
|
before_filter :fetch_page, :fetch_revision
|
24
24
|
before_filter :check_edit_access, :only => [:edit, :save]
|
25
25
|
|
@@ -100,6 +100,19 @@ class WikiController < ApplicationController
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
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
|
+
|
103
116
|
def access_denied
|
104
117
|
redirect_to :controller => 'wiki', :action => 'show',
|
105
118
|
:page_name => params[:page_name]
|
data/app/core/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
MOTIRO_VERSION = '0.6.
|
1
|
+
MOTIRO_VERSION = '0.6.7'
|
data/app/core/wiki_reporter.rb
CHANGED
@@ -18,9 +18,6 @@
|
|
18
18
|
require 'core/reporter'
|
19
19
|
require 'core/settings'
|
20
20
|
|
21
|
-
DEFAULT_AUTHOR = 'someone'
|
22
|
-
DEFAULT_TIME = Time.local(2007, 1, 3, 15, 10)
|
23
|
-
|
24
21
|
class WikiReporter < MotiroReporter
|
25
22
|
|
26
23
|
caching :off
|
@@ -40,12 +37,13 @@ class WikiReporter < MotiroReporter
|
|
40
37
|
end
|
41
38
|
|
42
39
|
def latest_headlines(rid='')
|
43
|
-
|
44
|
-
|
40
|
+
@page_provider.find(:all, find_opts.merge(
|
41
|
+
:limit => @settings.package_size)).
|
42
|
+
map {|p| p.to_headline}
|
45
43
|
end
|
46
44
|
|
47
45
|
def headlines
|
48
|
-
|
46
|
+
@page_provider.find(:all, find_opts).map {|p| p.to_headline}
|
49
47
|
end
|
50
48
|
|
51
49
|
def params_for(page_name)
|
@@ -54,8 +52,6 @@ class WikiReporter < MotiroReporter
|
|
54
52
|
|
55
53
|
def column; 'modified_at'; end
|
56
54
|
|
57
|
-
def extract_happened_at(page); page.modified_at; end
|
58
|
-
|
59
55
|
private
|
60
56
|
|
61
57
|
def self.button_for_creating(kind)
|
@@ -71,13 +67,4 @@ private
|
|
71
67
|
{ :conditions => "kind = '#{name.singularize}'", :order => "#{column} DESC" }
|
72
68
|
end
|
73
69
|
|
74
|
-
def to_headlines(pages)
|
75
|
-
pages.map do |page|
|
76
|
-
Headline.new(:rid => page.name,
|
77
|
-
:author => page.last_editor ? page.last_editor.login : DEFAULT_AUTHOR,
|
78
|
-
:happened_at => extract_happened_at(page) || DEFAULT_TIME,
|
79
|
-
:description => page.title + "\n\n" + page.text)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
70
|
end
|
@@ -67,6 +67,39 @@ module ApplicationHelper
|
|
67
67
|
end
|
68
68
|
concat(xml, block.binding)
|
69
69
|
end
|
70
|
+
|
71
|
+
def render_diff_table(chunks)
|
72
|
+
Builder::XmlMarkup.new.table :class => 'diff', :cellspacing => '0' do |b|
|
73
|
+
b.colgroup do
|
74
|
+
b.col :class => 'line_number'
|
75
|
+
b.col :class => 'left'
|
76
|
+
b.col :class => 'right'
|
77
|
+
b.col :class => 'line_number'
|
78
|
+
end
|
79
|
+
chunks.each do |chunk|
|
80
|
+
if chunk.separator?
|
81
|
+
b.tbody :class => 'separator' do
|
82
|
+
b.tr do
|
83
|
+
b.td
|
84
|
+
b.td('%s more lines' / chunk.num_lines.to_s, :colspan => '2')
|
85
|
+
b.td
|
86
|
+
end
|
87
|
+
end
|
88
|
+
else
|
89
|
+
b.tbody :class => chunk.action.to_s do
|
90
|
+
chunk.lines.each do |line|
|
91
|
+
b.tr do
|
92
|
+
b.td {b << (line.original_position || ' ').to_s}
|
93
|
+
b.td {b.pre{b << (h(line.original_text) || ' ')}}
|
94
|
+
b.td {b.pre{b << (h(line.modified_text) || ' ')}}
|
95
|
+
b.td {b << (line.modified_position || ' ').to_s}
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
70
103
|
|
71
104
|
end
|
72
105
|
|
@@ -1,2 +1,41 @@
|
|
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
|
module ReportHelper
|
19
|
+
|
20
|
+
def render_diff(change)
|
21
|
+
return '' unless change.chunked_diff
|
22
|
+
Builder::XmlMarkup.new.div(:id => ref(change),
|
23
|
+
:class => "diff-window") do |b|
|
24
|
+
b.h2 'Changes to %s' / change.resource_name
|
25
|
+
b << render_diff_table(change.chunked_diff)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def render_summary(change)
|
30
|
+
summary = html_escape(change.summary)
|
31
|
+
if (change.has_diff?)
|
32
|
+
"<a href='\#' onClick=\"showOnly('#{ref(change)}')\">#{summary}</a>"
|
33
|
+
else
|
34
|
+
summary
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def ref(change)
|
39
|
+
"change" + change.summary.hash.to_s
|
40
|
+
end
|
2
41
|
end
|
@@ -0,0 +1,46 @@
|
|
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
|
+
|
data/app/helpers/wiki_helper.rb
CHANGED
@@ -4,7 +4,7 @@ module WikiHelper
|
|
4
4
|
case page.revisions.size
|
5
5
|
when 0 then ''
|
6
6
|
when 1 then '| ' + 'Page has no history yet'.t
|
7
|
-
else '| ' + link_to('Page history (%
|
7
|
+
else '| ' + link_to('Page history (%s revisions)'/page.revisions.size.to_s,
|
8
8
|
:controller => 'wiki', :action => 'history',
|
9
9
|
:page_name => page.name)
|
10
10
|
end
|
data/app/models/change.rb
CHANGED
@@ -15,39 +15,12 @@
|
|
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 'erb'
|
19
|
-
|
20
18
|
class Change < ActiveRecord::Base
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
def render_summary
|
29
|
-
if (has_diff?)
|
30
|
-
return "<a href='\#' onClick=\"showOnly('#{ref}')\">#{html_escape(summary)}</a>"
|
31
|
-
else
|
32
|
-
return summary
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def render_diff
|
37
|
-
if (has_diff?)
|
38
|
-
return "<div id='#{ref}' class='diff-window'>" +
|
39
|
-
"<center>" +
|
40
|
-
"<h2>#{'Changes to %s' / resource_name}</h2>\n" +
|
41
|
-
render_diff_table +
|
42
|
-
"</center>" +
|
43
|
-
"</div>"
|
44
|
-
else
|
45
|
-
return ''
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def render_diff_table
|
50
|
-
@differ ||= DiffTableBuilder.new
|
20
|
+
def chunked_diff
|
21
|
+
return nil unless has_diff?
|
22
|
+
return @chunked_diff if @chunked_diff
|
23
|
+
@differ ||= DiffChunkBuilder.new
|
51
24
|
diff.split("\n").each do |line|
|
52
25
|
c = line[0,1]
|
53
26
|
line_text = line[1, line.length - 1]
|
@@ -64,7 +37,11 @@ class Change < ActiveRecord::Base
|
|
64
37
|
end
|
65
38
|
end
|
66
39
|
|
67
|
-
|
40
|
+
@chunked_diff = @differ.get_chunks
|
41
|
+
end
|
42
|
+
|
43
|
+
def to_s
|
44
|
+
return summary
|
68
45
|
end
|
69
46
|
|
70
47
|
def qualified_resource_name
|
@@ -76,21 +53,15 @@ class Change < ActiveRecord::Base
|
|
76
53
|
end
|
77
54
|
|
78
55
|
def filled?
|
79
|
-
|
56
|
+
self.resource_kind && ('dir' == self.resource_kind || has_diff?)
|
80
57
|
end
|
81
58
|
|
82
|
-
def use_differ(differ)
|
83
|
-
@differ = differ
|
84
|
-
end
|
85
|
-
|
86
|
-
private
|
87
|
-
|
88
59
|
def has_diff?
|
89
60
|
return ! (diff.nil? or diff.empty?)
|
90
61
|
end
|
91
62
|
|
92
|
-
def
|
93
|
-
|
63
|
+
def use_differ(differ)
|
64
|
+
@differ = differ
|
94
65
|
end
|
95
66
|
|
96
67
|
end
|
data/app/models/chunk.rb
ADDED
@@ -0,0 +1,56 @@
|
|
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 Chunk
|
19
|
+
attr_reader :lines, :action
|
20
|
+
|
21
|
+
def initialize(action)
|
22
|
+
@action = action
|
23
|
+
end
|
24
|
+
|
25
|
+
def unchanged?
|
26
|
+
:unchanged == action
|
27
|
+
end
|
28
|
+
|
29
|
+
def separator?; false; end
|
30
|
+
|
31
|
+
def <<(line)
|
32
|
+
@lines ||= []
|
33
|
+
@lines << line
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class Line
|
38
|
+
attr_reader :original_text, :original_position,
|
39
|
+
:modified_text, :modified_position
|
40
|
+
|
41
|
+
def initialize(old_text, old_pos, new_text, new_pos)
|
42
|
+
@original_text, @modified_text = old_text, new_text
|
43
|
+
@original_position = old_text && old_pos
|
44
|
+
@modified_position = new_text && new_pos
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class Separator
|
49
|
+
attr_reader :num_lines
|
50
|
+
|
51
|
+
def initialize(num_lines)
|
52
|
+
@num_lines = num_lines
|
53
|
+
end
|
54
|
+
|
55
|
+
def separator?; true; end
|
56
|
+
end
|
data/app/models/page.rb
CHANGED
@@ -16,6 +16,8 @@
|
|
16
16
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
|
18
18
|
PLACE_HOLDER_TITLE = 'Insert page title here'
|
19
|
+
DEFAULT_AUTHOR = 'someone'
|
20
|
+
DEFAULT_TIME = Time.local(2007, 1, 3, 15, 10)
|
19
21
|
|
20
22
|
class Page < ActiveRecord::Base
|
21
23
|
|
@@ -110,8 +112,23 @@ class Page < ActiveRecord::Base
|
|
110
112
|
self
|
111
113
|
end
|
112
114
|
|
115
|
+
def to_headline
|
116
|
+
#TODO (for 0.7): headlines and pages should _really_ be the same thing
|
117
|
+
# reporters should write ordinary wiki pages
|
118
|
+
Headline.new(:rid => name,
|
119
|
+
:author => last_editor ? last_editor.login : DEFAULT_AUTHOR,
|
120
|
+
:happened_at => (kind == 'event' ? happens_at.to_t : modified_at) || DEFAULT_TIME,
|
121
|
+
:description => inject_title_into_text)
|
122
|
+
end
|
123
|
+
|
113
124
|
private
|
114
125
|
|
126
|
+
def inject_title_into_text
|
127
|
+
title + "\n\n" +
|
128
|
+
text.gsub(/^--- (\S+) ----*[ \t\f]*\r?\n/,
|
129
|
+
"--- \\1 ---\n\n#{title}\n")
|
130
|
+
end
|
131
|
+
|
115
132
|
def name_from_title
|
116
133
|
sequence(Page, drop_non_alpha(clean(title)).downcase.gsub(/ /, '_').camelize, 'name')
|
117
134
|
end
|
data/app/models/revision.rb
CHANGED
@@ -15,6 +15,9 @@
|
|
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
|
+
|
18
21
|
class Revision < ActiveRecord::Base
|
19
22
|
belongs_to :page
|
20
23
|
belongs_to :last_editor, :class_name => 'User', :foreign_key => 'last_editor_id'
|
@@ -23,5 +26,33 @@ class Revision < ActiveRecord::Base
|
|
23
26
|
%w{name original_author revisions}.each do |method|
|
24
27
|
define_method(method) { page.send(method) }
|
25
28
|
end
|
29
|
+
|
30
|
+
LCS_ACTION_TO_SYMBOL = {'=' => :unchanged, '!' => :modification,
|
31
|
+
'-' => :removal, '+' => :addition}
|
32
|
+
|
33
|
+
def diff(rev_num)
|
34
|
+
#position numbers are 1-based, but we want 0-based when indexing revisions
|
35
|
+
sdiffs = text.split($/).sdiff(page.revisions[rev_num - 1].text.split($/))
|
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
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def chunk_break_needed(prev, curr)
|
55
|
+
prev.nil? || curr != prev && [prev, curr].include?('=')
|
56
|
+
end
|
26
57
|
|
27
58
|
end
|
data/app/views/report/show.rhtml
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<%= @renderer.render_html(@headline.description(Translator.for(@locale))) %>
|
5
5
|
<div id="summary">
|
6
6
|
<% @headline.changes.each do |change| %>
|
7
|
-
<%= change
|
7
|
+
<%= render_summary(change) -%>
|
8
8
|
<br/>
|
9
9
|
<% end %>
|
10
10
|
</div>
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<% cache(:action => 'show', :suffix => 'changes', :locale => @locale) do %>
|
14
14
|
<div id="changes">
|
15
15
|
<% @headline.changes.each do |change| %>
|
16
|
-
<%= change
|
16
|
+
<%= render_diff(change) %>
|
17
17
|
<% end %>
|
18
18
|
</div>
|
19
19
|
<% end %>
|
@@ -1,26 +1,37 @@
|
|
1
1
|
<% pagetext('Page history for %s' / @page.title) do %>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
<
|
14
|
-
|
15
|
-
|
16
|
-
<
|
17
|
-
|
2
|
+
<% form_tag "/wiki/diff/#{params[:page_name]}", :method => 'get' do %>
|
3
|
+
<%= submit_tag 'Compare revisions'.t, :class => 'button',
|
4
|
+
:name => 'btnCompare' %>
|
5
|
+
<table class="oldernews">
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th/>
|
9
|
+
<th class="date"><%= 'Date'.t -%></th>
|
10
|
+
<th><%= 'Author'.t -%></th>
|
11
|
+
</tr>
|
12
|
+
</thead>
|
13
|
+
<tbody>
|
14
|
+
<% last_position = @page.revisions.last.position %>
|
15
|
+
<% @page.revisions.reverse.each do |rev| %>
|
16
|
+
<tr class="<%= rev.position % 2 == 0 ? 'odd' : 'even' -%>">
|
17
|
+
<td>
|
18
|
+
<input type="radio" name="old_revision" value="<%= rev.position-%>"
|
19
|
+
<%= 'checked="checked"' if last_position -1 == rev.position -%> />
|
20
|
+
<input type="radio" name="new_revision" value="<%= rev.position-%>"
|
21
|
+
<%= 'checked="checked"' if last_position == rev.position -%> />
|
22
|
+
</td>
|
23
|
+
<td class="date">
|
24
|
+
<%= content_tag :a, rev.modified_at,
|
18
25
|
:href => server_url_for(:controller => 'wiki',
|
19
26
|
:action => 'show',
|
20
27
|
:page_name => @page.name,
|
21
|
-
:revision => rev.position)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
28
|
+
:revision => rev.position) %>
|
29
|
+
(<%= rev.modified_at.relative_to_now -%>)
|
30
|
+
</td>
|
31
|
+
<td><%= rev.last_editor.login %></td>
|
32
|
+
</tr>
|
33
|
+
<% end %>
|
34
|
+
</tbody>
|
35
|
+
</table>
|
36
|
+
<% end %>
|
26
37
|
<% end %>
|
@@ -0,0 +1,63 @@
|
|
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/config/motiro.yml
CHANGED
@@ -29,7 +29,7 @@ subversion:
|
|
29
29
|
#
|
30
30
|
# Tells the reporter where to find your project's repository
|
31
31
|
# Default: https://svn.sourceforge.net/svnroot/motiro
|
32
|
-
repo: https://svn.sourceforge.net/svnroot/motiro
|
32
|
+
repo: https://motiro.svn.sourceforge.net/svnroot/motiro
|
33
33
|
|
34
34
|
# subversion/{user,password}
|
35
35
|
#
|
data/config/routes.rb
CHANGED
@@ -42,6 +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/diff/:page_name/:old_revision/:new_revision',
|
46
|
+
:controller => 'wiki', :action => 'diff'
|
47
|
+
|
45
48
|
map.connect 'wiki/:action/:locale',
|
46
49
|
:controller => 'wiki',
|
47
50
|
:requirements => { :action => /properties_(show|edit)/ },
|
data/db/motirodb.sqlite.initial
CHANGED
Binary file
|
data/db/translation/pt-BR.rb
CHANGED
@@ -44,6 +44,7 @@
|
|
44
44
|
'Revision %s' => 'Revisão %s',
|
45
45
|
'Changes to %s' => 'Alterações em %s',
|
46
46
|
'The article %s from the %s reporter could not be found' => 'Não foi possível encontrar o artigo %s do repórter %s',
|
47
|
+
'%s more lines' => '%s linhas a mais',
|
47
48
|
|
48
49
|
# Event details and new event pages
|
49
50
|
'Events' => 'Eventos',
|
@@ -70,10 +71,14 @@
|
|
70
71
|
'event description' => 'descrição de evento',
|
71
72
|
'Who should be able to edit this page?' => 'Quem pode editar esta página?',
|
72
73
|
'(Usernames separated by spaces. Blank for everyone)' => '(Nomes de usuário separados por espaços. Em branco para todos.)',
|
74
|
+
'(Comparing revisions %s and %s)' => '(Diferenças entre as revisões %s e %s)',
|
73
75
|
|
74
76
|
# Older headlines and history pages
|
75
77
|
'Author' => 'Autor',
|
78
|
+
'Page has no history yet' => 'Página ainda sem histórico',
|
76
79
|
'Page history for %s' => 'Histórico da página %s',
|
80
|
+
'Page history (%s revisions)' => 'Histórico da página (%s revisões)',
|
77
81
|
'Page history' => 'Histórico da página',
|
78
|
-
'(Revision %s)' => '(Revisão %s)'
|
82
|
+
'(Revision %s)' => '(Revisão %s)',
|
83
|
+
'Compare revisions' => 'Comparar revisões'
|
79
84
|
}
|