Revision 16803
Added by Jean-Philippe Lang almost 8 years ago
sandbox/rails-5.1/app/views/welcome/robots.html.erb | ||
---|---|---|
1 |
User-agent: * |
|
2 |
<% @projects.each do |p| -%> |
|
3 |
Disallow: /projects/<%= p.to_param %>/repository |
|
4 |
Disallow: /projects/<%= p.to_param %>/issues |
|
5 |
Disallow: /projects/<%= p.to_param %>/activity |
|
6 |
<% end -%> |
|
7 |
Disallow: /issues/gantt |
|
8 |
Disallow: /issues/calendar |
|
9 |
Disallow: /activity |
|
10 |
Disallow: /search |
|
11 | 0 |
sandbox/rails-5.1/app/views/welcome/robots.text.erb | ||
---|---|---|
1 |
User-agent: * |
|
2 |
<% @projects.each do |p| -%> |
|
3 |
Disallow: /projects/<%= p.to_param %>/repository |
|
4 |
Disallow: /projects/<%= p.to_param %>/issues |
|
5 |
Disallow: /projects/<%= p.to_param %>/activity |
|
6 |
<% end -%> |
|
7 |
Disallow: /issues/gantt |
|
8 |
Disallow: /issues/calendar |
|
9 |
Disallow: /activity |
|
10 |
Disallow: /search |
|
0 | 11 |
sandbox/rails-5.1/config/routes.rb | ||
---|---|---|
376 | 376 |
|
377 | 377 |
match 'uploads', :to => 'attachments#upload', :via => :post |
378 | 378 |
|
379 |
get 'robots.txt', :to => 'welcome#robots'
|
|
379 |
get 'robots', :to => 'welcome#robots', :format => 'txt'
|
|
380 | 380 |
|
381 | 381 |
Dir.glob File.expand_path("#{Redmine::Plugin.directory}/*") do |plugin_dir| |
382 | 382 |
file = File.join(plugin_dir, "config/routes.rb") |
sandbox/rails-5.1/test/functional/welcome_controller_test.rb | ||
---|---|---|
77 | 77 |
end |
78 | 78 |
end |
79 | 79 |
|
80 |
def test_robots |
|
81 |
get :robots |
|
82 |
assert_response :success |
|
83 |
assert_equal 'text/plain', @response.content_type |
|
84 |
assert @response.body.match(%r{^Disallow: /projects/ecookbook/issues\r?$}) |
|
85 |
end |
|
86 |
|
|
87 | 80 |
def test_warn_on_leaving_unsaved_turn_on |
88 | 81 |
user = User.find(2) |
89 | 82 |
user.pref.warn_on_leaving_unsaved = '1' |
sandbox/rails-5.1/test/integration/welcome_test.rb | ||
---|---|---|
1 |
# Redmine - project management software |
|
2 |
# Copyright (C) 2006-2017 Jean-Philippe Lang |
|
3 |
# |
|
4 |
# This program is free software; you can redistribute it and/or |
|
5 |
# modify it under the terms of the GNU General Public License |
|
6 |
# as published by the Free Software Foundation; either version 2 |
|
7 |
# of the License, or (at your option) 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 Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 |
|
|
18 |
require File.expand_path('../../test_helper', __FILE__) |
|
19 |
|
|
20 |
class WelcomeTest < Redmine::IntegrationTest |
|
21 |
|
|
22 |
def test_robots |
|
23 |
get '/robots.txt' |
|
24 |
assert_response :success |
|
25 |
assert_equal 'text/plain', @response.content_type |
|
26 |
assert @response.body.match(%r{^Disallow: /projects/ecookbook/issues\r?$}) |
|
27 |
end |
|
28 |
end |
|
0 | 29 |
Also available in: Unified diff
Fixes robots.txt route.