diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
index a42affd74..52fd7a5a5 100644
--- a/app/controllers/welcome_controller.rb
+++ b/app/controllers/welcome_controller.rb
@@ -24,6 +24,7 @@ class WelcomeController < ApplicationController
def index
@news = News.latest User.current
+ @projects = Redmine::ProjectJumpBox.new(User.current).recently_used_projects
end
def robots
diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb
index 7211818f3..9364c6688 100644
--- a/app/views/welcome/index.html.erb
+++ b/app/views/welcome/index.html.erb
@@ -9,6 +9,17 @@
+ <% if @projects.any? %>
+
+
<%= sprite_icon('projects', l(:label_project_recently_used)) %>
+
+ <% @projects.each do |project| %>
+ - <%= link_to_project project %>
+ <% end %>
+
+ <%= link_to l(:label_project_view_all), :controller => 'projects' %>
+
+ <% end %>
<% if @news.any? %>
<%= sprite_icon('news', l(:label_news_latest))%>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 948b61958..89b0664f9 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -640,6 +640,8 @@ en:
other: "%{count} projects"
label_project_all: All Projects
label_project_latest: Latest projects
+ label_project_recently_used: Recently used projects
+ label_project_view_all: View all projects
label_issue: Issue
label_issue_new: New issue
label_issue_plural: Issues
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index 76c22b70f..76a14a61f 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -1279,6 +1279,8 @@ ja:
label_import_notifications: インポート中のメール通知
text_gs_available: ImageMagickのPDFサポートが利用可能 (オプション)
field_recently_used_projects: 最近使用したプロジェクトの表示件数
+ label_project_recently_used: 最近使用したプロジェクト
+ label_project_view_all: すべてのプロジェクトを表示
label_optgroup_bookmarks: ブックマーク
label_optgroup_recents: 最近使用したもの
button_project_bookmark: ブックマークに追加
diff --git a/test/functional/welcome_controller_test.rb b/test/functional/welcome_controller_test.rb
index ba1a30235..9e5bb5727 100644
--- a/test/functional/welcome_controller_test.rb
+++ b/test/functional/welcome_controller_test.rb
@@ -31,6 +31,33 @@ class WelcomeControllerTest < Redmine::ControllerTest
assert_select 'h3', :text => 'Latest news'
end
+ def test_index_should_display_recently_used_projects
+ user = User.find(2)
+ jump_box = Redmine::ProjectJumpBox.new(user)
+ jump_box.project_used(Project.find('ecookbook'))
+ jump_box.project_used(Project.find('onlinestore'))
+ @request.session[:user_id] = user.id
+
+ get :index
+
+ assert_select 'div.projects.box' do
+ assert_select 'h3', :text => 'Recently used projects'
+ assert_select 'li', :count => 2
+ assert_select 'li:nth-child(1) a', :text => 'OnlineStore'
+ assert_select 'li:nth-child(2) a', :text => 'eCookbook'
+ assert_select 'a[href="/projects"]', :text => 'View all projects'
+ end
+ end
+
+ def test_index_should_not_display_recently_used_projects_for_anonymous
+ jump_box = Redmine::ProjectJumpBox.new(User.find(2))
+ jump_box.project_used(Project.find('ecookbook'))
+
+ get :index
+
+ assert_select 'div.projects.box', :count => 0
+ end
+
def test_browser_language
@request.env['HTTP_ACCEPT_LANGUAGE'] = 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
get :index