motiro 0.6.5 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/app/controllers/report_controller.rb +10 -6
- data/app/controllers/wiki_controller.rb +12 -2
- data/app/core/version.rb +1 -1
- data/app/core/wiki_reporter.rb +2 -2
- data/app/helpers/application_helper.rb +7 -0
- data/app/models/feed_observer.rb +27 -0
- data/app/models/page.rb +4 -0
- data/app/models/{page_sweeper.rb → wiki_sweeper.rb} +4 -2
- data/app/reporters/darcs_reporter.rb +1 -1
- data/app/views/report/list.rhtml +2 -4
- data/app/views/wiki/page_feed.rxml +25 -0
- data/config/environment.rb +1 -1
- data/config/routes.rb +8 -14
- data/public/stylesheets/motiro.css +5 -0
- data/test/acceptance/account_test.rb +3 -3
- data/test/acceptance/events_test.rb +1 -1
- data/test/acceptance/main_page_test.rb +2 -2
- data/test/acceptance/subversion_test.rb +16 -16
- data/test/fixtures/pages.yml +6 -0
- data/test/fixtures/revisions.yml +36 -1
- data/test/functional/report_controller_test.rb +4 -4
- data/test/functional/report_features_test.rb +1 -1
- data/test/functional/report_subversion_test.rb +4 -4
- data/test/functional/root_controller_test.rb +1 -1
- data/test/functional/wiki_controller_test.rb +29 -5
- data/test/unit/darcs_reporter_test.rb +2 -2
- data/test/unit/wiki_reporter_test.rb +13 -0
- data/vendor/plugins/global_routing/init.rb +53 -0
- metadata +345 -341
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.6 - June 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.
|
@@ -30,12 +30,6 @@ class ReportController < ApplicationController
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
before_filter(:only => [:rss, :list]) do |me|
|
34
|
-
me.instance_eval do
|
35
|
-
@headlines = @chief_editor.latest_news_from @name
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
33
|
before_filter :drop_crumbs
|
40
34
|
|
41
35
|
def initialize(chief_editor=ChiefEditor.new)
|
@@ -76,4 +70,14 @@ class ReportController < ApplicationController
|
|
76
70
|
:reporter => @name, :id => @headline.rid}}
|
77
71
|
end
|
78
72
|
|
73
|
+
def list
|
74
|
+
@headlines = @chief_editor.latest_news_from(@name)
|
75
|
+
|
76
|
+
respond_to do |format|
|
77
|
+
format.html
|
78
|
+
format.xml { render :action => 'rss'
|
79
|
+
cache_page }
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
79
83
|
end
|
@@ -23,10 +23,12 @@ class WikiController < ApplicationController
|
|
23
23
|
before_filter :fetch_page, :fetch_revision
|
24
24
|
before_filter :check_edit_access, :only => [:edit, :save]
|
25
25
|
|
26
|
-
cache_sweeper :
|
26
|
+
cache_sweeper :wiki_sweeper, :only => [:edit, :save]
|
27
27
|
|
28
28
|
def choose_layout
|
29
|
-
return if params[:context] == 'partial' ||
|
29
|
+
return if params[:context] == 'partial' ||
|
30
|
+
params[:action] == 'properties_edit' ||
|
31
|
+
params[:format] == 'xml'
|
30
32
|
return 'application'
|
31
33
|
end
|
32
34
|
|
@@ -90,6 +92,14 @@ class WikiController < ApplicationController
|
|
90
92
|
end
|
91
93
|
end
|
92
94
|
|
95
|
+
def history
|
96
|
+
respond_to do |format|
|
97
|
+
format.html
|
98
|
+
format.xml { render(:action => 'page_feed')
|
99
|
+
cache_page}
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
93
103
|
def access_denied
|
94
104
|
redirect_to :controller => 'wiki', :action => 'show',
|
95
105
|
:page_name => params[:page_name]
|
data/app/core/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
MOTIRO_VERSION = '0.6.
|
1
|
+
MOTIRO_VERSION = '0.6.6'
|
data/app/core/wiki_reporter.rb
CHANGED
@@ -68,7 +68,7 @@ private
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def find_opts
|
71
|
-
{ :conditions => "kind = '#{name.
|
71
|
+
{ :conditions => "kind = '#{name.singularize}'", :order => "#{column} DESC" }
|
72
72
|
end
|
73
73
|
|
74
74
|
def to_headlines(pages)
|
@@ -76,7 +76,7 @@ private
|
|
76
76
|
Headline.new(:rid => page.name,
|
77
77
|
:author => page.last_editor ? page.last_editor.login : DEFAULT_AUTHOR,
|
78
78
|
:happened_at => extract_happened_at(page) || DEFAULT_TIME,
|
79
|
-
:description => page.title)
|
79
|
+
:description => page.title + "\n\n" + page.text)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
@@ -40,6 +40,13 @@ module ApplicationHelper
|
|
40
40
|
content = capture(&block)
|
41
41
|
b = Builder::XmlMarkup.new
|
42
42
|
xml = b.div(:class => 'pagetext') do
|
43
|
+
b.a(:href => url_for(:controller => 'wiki', :action => 'history',
|
44
|
+
:page_name => @page.name, :locale => @locale,
|
45
|
+
:format => 'xml'),
|
46
|
+
:class => 'rss') do
|
47
|
+
b << image_tag("rss.png", :border => 0, :class => 'rss',
|
48
|
+
:alt => 'Changes to %s' / @page.name)
|
49
|
+
end unless @page.nil?
|
43
50
|
b.div(:id => 'crumbs') do
|
44
51
|
b.text!('You are here: '.t)
|
45
52
|
last = @crumbs.delete_at(@crumbs.length - 1)
|
@@ -0,0 +1,27 @@
|
|
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 FeedObserver < ActiveRecord::Observer
|
19
|
+
|
20
|
+
observe Page, Headline
|
21
|
+
|
22
|
+
def after_save(record)
|
23
|
+
cache_dir = ActionController::Base.page_cache_directory
|
24
|
+
FileUtils.rm_r(Dir.glob(cache_dir+"/report/#{record.reported_by}")) rescue Errno::ENOENT
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/app/models/page.rb
CHANGED
@@ -15,12 +15,14 @@
|
|
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
|
-
class
|
18
|
+
class WikiSweeper < ActionController::Caching::Sweeper
|
19
19
|
|
20
20
|
observe Page
|
21
21
|
|
22
22
|
def after_save(page)
|
23
23
|
expire_fragment(/wiki\/show.*?#{page.name}/)
|
24
|
+
cache_dir = ActionController::Base.page_cache_directory
|
25
|
+
FileUtils.rm_r(Dir.glob(cache_dir+"/wiki/history/#{page.name}*")) rescue Errno::ENOENT
|
24
26
|
end
|
25
27
|
|
26
|
-
end
|
28
|
+
end
|
@@ -71,7 +71,7 @@ private
|
|
71
71
|
|
72
72
|
headline.description = description
|
73
73
|
headline.happened_at = time_from_darcs_date(info.attributes['date'])
|
74
|
-
headline.rid = info.attributes['hash']
|
74
|
+
headline.rid = info.attributes['hash'].chomp('.gz')
|
75
75
|
headline.reported_by = self.name
|
76
76
|
|
77
77
|
parse_changes(headline, @connection.diff(headline.rid))
|
data/app/views/report/list.rhtml
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
<div class='channel-title'>
|
2
2
|
<%= link_to( image_tag('rss.png', :border => 0, :class => 'rss'),
|
3
|
-
{ :controller => 'report',
|
4
|
-
:
|
5
|
-
:reporter => @name,
|
6
|
-
:locale => @locale },
|
3
|
+
{ :controller => 'report', :action => 'list', :reporter => @name,
|
4
|
+
:format => 'xml', :locale => @locale },
|
7
5
|
:class => 'feed' )
|
8
6
|
%>
|
9
7
|
<p><%= h(@reporter.channel_title) %></p>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
|
2
|
+
|
3
|
+
xml.rss 'version' => '2.0',
|
4
|
+
'xmlns:dc' => 'http://purl.org/dc/elements/1.1/' do
|
5
|
+
xml.channel do
|
6
|
+
xml.title "Changes to %s" / @page.name
|
7
|
+
xml.description
|
8
|
+
xml.link server_url_for(:controller => 'root', :action => 'index')
|
9
|
+
xml.language current_locale
|
10
|
+
xml.generator 'Motiro'
|
11
|
+
xml.pubDate @page.modified_at.to_s(:rfc822)
|
12
|
+
xml.ttl '60'
|
13
|
+
@page.revisions.reverse[0..10].each do |rev|
|
14
|
+
xml.item do
|
15
|
+
xml.title h(rev.title)
|
16
|
+
xml.description @renderer.render_html(rev.text)
|
17
|
+
xml.pubDate h(rev.modified_at.to_s(:rfc822))
|
18
|
+
xml.dc :creator, h(rev.last_editor.login)
|
19
|
+
xml.guid server_url_for(:action => 'show', :page_name => @page.name,
|
20
|
+
:revision => rev.position)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
data/config/environment.rb
CHANGED
@@ -31,7 +31,7 @@ Rails::Initializer.run do |config|
|
|
31
31
|
config.action_controller.fragment_cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache"
|
32
32
|
|
33
33
|
# Activate observers that should always be running
|
34
|
-
|
34
|
+
config.active_record.observers = :feed_observer
|
35
35
|
|
36
36
|
# Make Active Record use UTC-base instead of local time
|
37
37
|
# config.active_record.default_timezone = :utc
|
data/config/routes.rb
CHANGED
@@ -25,19 +25,13 @@ ActionController::Routing::Routes.draw do |map|
|
|
25
25
|
:controller => 'report',
|
26
26
|
:action => 'older'
|
27
27
|
|
28
|
-
map.
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
map.connect 'report/:reporter/:id',
|
33
|
-
:controller => 'report', :action => 'show',
|
34
|
-
:requirements => { :id => /.*/ }
|
35
|
-
|
36
|
-
map.connect 'feed/:reporter/:locale',
|
37
|
-
:controller => 'report',
|
38
|
-
:action => 'rss',
|
39
|
-
:defaults => locale_defaults
|
28
|
+
map.with_options(:controller => 'report', :action => 'list') do |report|
|
29
|
+
report.connect 'report/:reporter/:locale'
|
30
|
+
report.connect 'report/:reporter/:locale.:format'
|
31
|
+
end
|
40
32
|
|
33
|
+
map.connect 'show/:reporter/:id', :controller => 'report', :action => 'show'
|
34
|
+
|
41
35
|
map.connect 'wiki/new/:kind/:locale',
|
42
36
|
:controller => 'wiki',
|
43
37
|
:action => 'new',
|
@@ -53,8 +47,8 @@ ActionController::Routing::Routes.draw do |map|
|
|
53
47
|
:requirements => { :action => /properties_(show|edit)/ },
|
54
48
|
:defaults => locale_defaults
|
55
49
|
|
56
|
-
map.connect 'wiki/:action/:page_name
|
57
|
-
|
50
|
+
map.connect 'wiki/:action/:page_name', :controller => 'wiki'
|
51
|
+
map.connect 'wiki/:action/:page_name.:format', :controller => 'wiki'
|
58
52
|
|
59
53
|
map.connect '', locale_defaults.merge(:controller => 'root',
|
60
54
|
:action => 'index')
|
@@ -116,7 +116,7 @@ class AccountAcceptanceTest < AcceptanceTestCase
|
|
116
116
|
|
117
117
|
def test_returns_to_previous_page_after_logged_in
|
118
118
|
gita = headlines('gita')
|
119
|
-
open "/
|
119
|
+
open "/show/#{gita.reported_by}/#{gita.rid}"
|
120
120
|
|
121
121
|
assert_text_present gita.description
|
122
122
|
|
@@ -125,7 +125,7 @@ class AccountAcceptanceTest < AcceptanceTestCase
|
|
125
125
|
click 'login'
|
126
126
|
wait_for_page_to_load 1500
|
127
127
|
|
128
|
-
assert_location "exact:http://localhost:3000/
|
128
|
+
assert_location "exact:http://localhost:3000/show/#{gita.reported_by}/#{gita.rid}"
|
129
129
|
assert_text_present gita.description
|
130
130
|
end
|
131
131
|
|
@@ -162,7 +162,7 @@ class AccountAcceptanceTest < AcceptanceTestCase
|
|
162
162
|
def test_login_failure_shows_error_on_other_pages
|
163
163
|
rid = headlines('gita').rid
|
164
164
|
check_if_login_failure_shows_error_on_page(
|
165
|
-
"/
|
165
|
+
"/show/subversion/#{rid}",
|
166
166
|
"Revision #{rid}")
|
167
167
|
end
|
168
168
|
|
@@ -20,9 +20,9 @@ class MainPageAcceptanceTest < SeleniumTestCase
|
|
20
20
|
fixtures :pages
|
21
21
|
|
22
22
|
def test_report_html
|
23
|
-
open '/report/subversion
|
23
|
+
open '/report/subversion/en'
|
24
24
|
assert_text_present 'Latest news from Subversion'
|
25
|
-
assert_element_present "//a[@href = '/
|
25
|
+
assert_element_present "//a[@href = '/report/subversion/en.xml']/img[starts-with(@src, '/images/rss.png')]"
|
26
26
|
end
|
27
27
|
|
28
28
|
def test_subversion_on_main
|
@@ -26,7 +26,7 @@ class SubversionAcceptanceTest < SeleniumTestCase
|
|
26
26
|
|
27
27
|
@repo.mkdir('myproject', commit_msg)
|
28
28
|
|
29
|
-
open '/report/subversion
|
29
|
+
open '/report/subversion/en'
|
30
30
|
assert_text_present @repo.username
|
31
31
|
assert_text_present commit_msg
|
32
32
|
end
|
@@ -51,7 +51,7 @@ class SubversionAcceptanceTest < SeleniumTestCase
|
|
51
51
|
|
52
52
|
@repo.mkdir(dir_name, commit_msg)
|
53
53
|
|
54
|
-
open '/report/subversion
|
54
|
+
open '/report/subversion/en'
|
55
55
|
assert_text_present commit_title
|
56
56
|
click "//a[text() = \"#{commit_title}\"]"
|
57
57
|
wait_for_page_to_load(2000)
|
@@ -76,7 +76,7 @@ class SubversionAcceptanceTest < SeleniumTestCase
|
|
76
76
|
@repo.add_file(filename, file_contents)
|
77
77
|
@repo.commit(commit_title)
|
78
78
|
|
79
|
-
open '/report/subversion
|
79
|
+
open '/report/subversion/en'
|
80
80
|
click "//a[text() = '#{commit_title}']"
|
81
81
|
wait_for_page_to_load(2000)
|
82
82
|
|
@@ -95,7 +95,7 @@ class SubversionAcceptanceTest < SeleniumTestCase
|
|
95
95
|
@repo.put_file('a_file.txt', "These are the modified file contents\n" )
|
96
96
|
@repo.commit(commit_title)
|
97
97
|
|
98
|
-
open '/report/subversion'
|
98
|
+
open '/report/subversion/en'
|
99
99
|
click "//a[text() = '#{commit_title}']"
|
100
100
|
wait_for_page_to_load(1500)
|
101
101
|
|
@@ -108,7 +108,7 @@ class SubversionAcceptanceTest < SeleniumTestCase
|
|
108
108
|
|
109
109
|
@repo.mkdir('projectroot', commit_msg)
|
110
110
|
|
111
|
-
open '/
|
111
|
+
open '/show/subversion/r104?locale=en'
|
112
112
|
assert_equal "Motiro: Welcome", get_title
|
113
113
|
assert_text "//div[@id='notice']", 'The article r104 from the Subversion reporter could not be found'
|
114
114
|
end
|
@@ -118,7 +118,7 @@ class SubversionAcceptanceTest < SeleniumTestCase
|
|
118
118
|
|
119
119
|
@repo.mkdir('trunk', commit_title)
|
120
120
|
|
121
|
-
open '/report/subversion
|
121
|
+
open '/report/subversion/en'
|
122
122
|
click "//a[text() = '#{commit_title}']"
|
123
123
|
wait_for_page_to_load(1000)
|
124
124
|
|
@@ -139,7 +139,7 @@ class SubversionAcceptanceTest < SeleniumTestCase
|
|
139
139
|
commit_title = 'files copied'
|
140
140
|
@repo.copy('file_number_one.txt', 'file_number_two.txt', commit_title)
|
141
141
|
|
142
|
-
open '/report/subversion
|
142
|
+
open '/report/subversion/en'
|
143
143
|
click "//a[text() = '#{commit_title}']"
|
144
144
|
wait_for_page_to_load(2000)
|
145
145
|
assert_text_present "Changes to file_number_two.txt"
|
@@ -153,7 +153,7 @@ class SubversionAcceptanceTest < SeleniumTestCase
|
|
153
153
|
commit_title = 'renamed file'
|
154
154
|
@repo.move('file_number_one.txt', 'file_number_two.txt', commit_title)
|
155
155
|
|
156
|
-
open '/report/subversion
|
156
|
+
open '/report/subversion/en'
|
157
157
|
click "//a[text() = '#{commit_title}']"
|
158
158
|
wait_for_page_to_load(2000)
|
159
159
|
|
@@ -170,7 +170,7 @@ class SubversionAcceptanceTest < SeleniumTestCase
|
|
170
170
|
commit_title = 'added two files'
|
171
171
|
@repo.commit(commit_title)
|
172
172
|
|
173
|
-
open '/report/subversion'
|
173
|
+
open '/report/subversion/en'
|
174
174
|
click "//a[text() = '#{commit_title}']"
|
175
175
|
wait_for_page_to_load(1000)
|
176
176
|
|
@@ -191,7 +191,7 @@ class SubversionAcceptanceTest < SeleniumTestCase
|
|
191
191
|
commit_title = 'added alive.txt'
|
192
192
|
@repo.commit(commit_title)
|
193
193
|
|
194
|
-
open '/report/subversion'
|
194
|
+
open '/report/subversion/en'
|
195
195
|
click "//a[text() = '#{commit_title}']"
|
196
196
|
wait_for_page_to_load(1000)
|
197
197
|
|
@@ -209,7 +209,7 @@ class SubversionAcceptanceTest < SeleniumTestCase
|
|
209
209
|
commit_title = 'added daughter.txt'
|
210
210
|
@repo.commit(commit_title)
|
211
211
|
|
212
|
-
open '/
|
212
|
+
open '/show/subversion/r1?locale=en'
|
213
213
|
|
214
214
|
assert_equal "Revision details - #{commit_title} (Motiro)", get_title
|
215
215
|
assert_text_present 'Revision r1'
|
@@ -233,12 +233,12 @@ class SubversionAcceptanceTest < SeleniumTestCase
|
|
233
233
|
commit_title = 'added daughter.txt'
|
234
234
|
@repo.commit(commit_title)
|
235
235
|
|
236
|
-
open '/
|
236
|
+
open '/show/subversion/r30?locale=en'
|
237
237
|
|
238
238
|
assert_equal "Motiro: Welcome", get_title
|
239
239
|
assert_text "//div[@id='notice']", 'The article r30 from the Subversion reporter could not be found'
|
240
240
|
|
241
|
-
open '/
|
241
|
+
open '/show/subversion/r30?locale=pt-BR'
|
242
242
|
|
243
243
|
assert_text "//div[@id='notice']", /o foi poss/
|
244
244
|
assert_text "//div[@id='notice']", /vel encontrar o artigo r30 do rep/
|
@@ -259,7 +259,7 @@ class SubversionAcceptanceTest < SeleniumTestCase
|
|
259
259
|
|
260
260
|
@repo.commit(commit_comment)
|
261
261
|
|
262
|
-
open '/report/subversion
|
262
|
+
open '/report/subversion/pt-BR'
|
263
263
|
|
264
264
|
assert_text_not_present('lyrics')
|
265
265
|
|
@@ -271,7 +271,7 @@ class SubversionAcceptanceTest < SeleniumTestCase
|
|
271
271
|
assert_text_not_present('this')
|
272
272
|
assert_text_not_present('originally released')
|
273
273
|
|
274
|
-
open '/report/subversion
|
274
|
+
open '/report/subversion/en'
|
275
275
|
|
276
276
|
assert_text_not_present('letras')
|
277
277
|
assert_text_not_present('musica')
|
@@ -293,7 +293,7 @@ class SubversionAcceptanceTest < SeleniumTestCase
|
|
293
293
|
|
294
294
|
@repo.mkdir('wikitest', commit_msg)
|
295
295
|
|
296
|
-
open '/report/subversion'
|
296
|
+
open '/report/subversion/en'
|
297
297
|
click "//a[text() = 'This is the comment title']"
|
298
298
|
wait_for_page_to_load(2000)
|
299
299
|
|
data/test/fixtures/pages.yml
CHANGED
data/test/fixtures/revisions.yml
CHANGED
@@ -133,4 +133,39 @@ release_event_creation:
|
|
133
133
|
text: The 0.6.1 release will be a bug fixing one and will introduce editable
|
134
134
|
event pages. This is included as part of the everything is a wiki page
|
135
135
|
motto.
|
136
|
-
|
136
|
+
|
137
|
+
first_multilanguage_revision:
|
138
|
+
id: 15
|
139
|
+
page_id: 12
|
140
|
+
kind: common
|
141
|
+
modified_at: 2007-06-14 12:03:24
|
142
|
+
last_editor_id: 1000004 #john
|
143
|
+
editors: ""
|
144
|
+
title: Multi-language page
|
145
|
+
text: This is the first English version
|
146
|
+
|
147
|
+
Here is some '''bold''' text.
|
148
|
+
|
149
|
+
--- pt-br ------------
|
150
|
+
|
151
|
+
Esta é a primeira versão em português
|
152
|
+
|
153
|
+
Aqui está um pouco de texto em '''negrito'''.
|
154
|
+
|
155
|
+
second_multilanguage_revision:
|
156
|
+
id: 16
|
157
|
+
page_id: 12
|
158
|
+
kind: common
|
159
|
+
modified_at: 2007-06-14 12:06:38
|
160
|
+
last_editor_id: 1000004 #john
|
161
|
+
editors: ""
|
162
|
+
title: Multi-language page
|
163
|
+
text: This is the second English version
|
164
|
+
|
165
|
+
Here is some '''bold''' text.
|
166
|
+
|
167
|
+
--- pt-br ------------
|
168
|
+
|
169
|
+
Esta é a segunda versão em português
|
170
|
+
|
171
|
+
Aqui está um pouco de texto em '''negrito'''.
|
@@ -43,8 +43,8 @@ class ReportControllerTest < Test::Unit::TestCase
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def test_routes_localized_feeds
|
46
|
-
assert_routing('/
|
47
|
-
:controller => 'report', :action => '
|
46
|
+
assert_routing('/report/subversion/en-gb.xml',
|
47
|
+
:controller => 'report', :action => 'list', :format => 'xml',
|
48
48
|
:reporter => 'subversion', :locale => 'en-gb' )
|
49
49
|
end
|
50
50
|
|
@@ -79,7 +79,7 @@ class ReportControllerTest < Test::Unit::TestCase
|
|
79
79
|
def test_include_headline_date_on_guid
|
80
80
|
gita = headlines('gita')
|
81
81
|
|
82
|
-
get :
|
82
|
+
get :list, :reporter => gita.reported_by, :locale => 'en', :format => 'xml'
|
83
83
|
|
84
84
|
assert_xml_element "//guid[contains(text(), '#{gita.happened_at.strftime('%Y%m%d%H%M%S')}')]"
|
85
85
|
end
|
@@ -93,7 +93,7 @@ class ReportControllerTest < Test::Unit::TestCase
|
|
93
93
|
|
94
94
|
assert_xml_element "//div[@id = 'crumbs' and contains(text(), 'You are here')]/a[@href = '/' and text() = 'Home']"
|
95
95
|
assert_xml_element "//div[@id = 'crumbs']/a[@href = '/report/older/subversion' and text() = 'Latest news from Subversion']"
|
96
|
-
assert_xml_element "//div[@id = 'crumbs']/a[@href = '
|
96
|
+
assert_xml_element "//div[@id = 'crumbs']/a[@href = '#{@controller.url_for(:controller => 'report', :action => 'show', :reporter => 'subversion', :id => svn_demo.rid, :only_path => true)}' and text() = '#{svn_demo.title}']"
|
97
97
|
end
|
98
98
|
|
99
99
|
def test_shows_breadcrumbs_trail_for_older_news_page
|
@@ -31,7 +31,7 @@ class ReportFeaturesTest < Test::Unit::TestCase
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_links_to_feature_pages_from_rss_feed
|
34
|
-
get :
|
34
|
+
get :list, :reporter => 'features', :locale => 'en', :format => 'xml'
|
35
35
|
assert_xml_element "//link[text() = 'http://test.host/wiki/show/ListLastModifiedFeatures']"
|
36
36
|
end
|
37
37
|
|
@@ -39,7 +39,7 @@ class ReportSubversionTest < Test::Unit::TestCase
|
|
39
39
|
|
40
40
|
@repo.mkdir('myproject', commit_msg)
|
41
41
|
|
42
|
-
get :
|
42
|
+
get :list, :reporter => 'subversion', :locale => 'en', :format => 'xml'
|
43
43
|
assert_xml_element("//rss/channel/title[text() = 'Motiro - Subversion']")
|
44
44
|
assert_xml_element("//rss/channel/generator[text() = 'Motiro']")
|
45
45
|
assert_xml_element("//rss/channel/item/title[text() = '#{commit_title}']")
|
@@ -56,7 +56,7 @@ class ReportSubversionTest < Test::Unit::TestCase
|
|
56
56
|
|
57
57
|
@repo.mkdir('myproject', commit_msg)
|
58
58
|
|
59
|
-
get :
|
59
|
+
get :list, :reporter => 'subversion', :locale => 'en', :format => 'xml'
|
60
60
|
assert_no_xml_element("//description[contains(text(), 'pagetext')]")
|
61
61
|
end
|
62
62
|
|
@@ -67,11 +67,11 @@ class ReportSubversionTest < Test::Unit::TestCase
|
|
67
67
|
|
68
68
|
@repo.mkdir('myproject', commit_msg)
|
69
69
|
|
70
|
-
get :
|
70
|
+
get :list, :reporter => 'subversion', :locale => 'en', :format => 'xml'
|
71
71
|
assert_xml_element("//rss/channel/item/title[text() = '#{english_msg}']")
|
72
72
|
assert_no_xml_element("//rss/channel/item/title[text() = '#{portuguese_msg}']")
|
73
73
|
|
74
|
-
get :
|
74
|
+
get :list, :reporter => 'subversion', :locale => 'pt-br', :format => 'xml'
|
75
75
|
assert_xml_element("//rss/channel/item/title[text() = '#{portuguese_msg}']")
|
76
76
|
assert_no_xml_element("//rss/channel/item/title[text() = '#{english_msg}']")
|
77
77
|
end
|
@@ -40,11 +40,14 @@ class WikiControllerTest < Test::Unit::TestCase
|
|
40
40
|
:page_name => 'MainPage')
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
44
|
-
assert_routing('/wiki/show/
|
45
|
-
|
46
|
-
|
47
|
-
|
43
|
+
def test_routes_to_locale_extracted_from_page_name
|
44
|
+
assert_routing('/wiki/show/MyGoodPage-en-gb',
|
45
|
+
{:controller => 'wiki', :action => 'show',
|
46
|
+
:page_name => 'MyGoodPage', :locale => 'en-gb'})
|
47
|
+
assert_routing('/wiki/history/MyGoodPage-pt-br.xml',
|
48
|
+
{:controller => 'wiki', :action => 'history',
|
49
|
+
:page_name => 'MyGoodPage', :locale => 'pt-br',
|
50
|
+
:format => 'xml'})
|
48
51
|
end
|
49
52
|
|
50
53
|
def test_blocks_edition
|
@@ -339,6 +342,27 @@ class WikiControllerTest < Test::Unit::TestCase
|
|
339
342
|
assert_no_tag :content => 'Page history (1 revisions)'
|
340
343
|
assert_no_tag :content => /Page has no history yet/
|
341
344
|
end
|
345
|
+
|
346
|
+
def test_page_history_translates_and_renders_page_contents
|
347
|
+
page_name = pages('multilanguage_page').name
|
348
|
+
get :history, :page_name => page_name, :locale => 'en', :format => 'xml'
|
349
|
+
|
350
|
+
assert_xml_element "//item/description[contains(text(), 'This is the first English version')]"
|
351
|
+
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')]"
|
353
|
+
|
354
|
+
get :history, :page_name => page_name, :locale => 'pt-br', :format => 'xml'
|
355
|
+
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')]"
|
357
|
+
end
|
358
|
+
|
359
|
+
def test_history_links_to_page_revision
|
360
|
+
page_name = pages('changed_page').name
|
361
|
+
get :history, :page_name => page_name, :format => 'xml'
|
362
|
+
|
363
|
+
assert_xml_element "//item/guid[text() = '#{@controller.url_for(:action => 'show', :page_name => page_name, :revision => '2')}'']"
|
364
|
+
assert_xml_element "//item/guid[text() = '#{@controller.url_for(:action => 'show', :page_name => page_name, :revision => '1')}'']"
|
365
|
+
end
|
342
366
|
|
343
367
|
private
|
344
368
|
|