Project

General

Profile

Feature #33129 » 33129-recent-projects-box.patch

Go MAEDA, 2026-03-16 05:37

View differences:

app/controllers/welcome_controller.rb
def index
@news = News.latest User.current
@projects = Redmine::ProjectJumpBox.new(User.current).recently_used_projects
end
def robots
app/views/welcome/index.html.erb
</div>
<div class="splitcontentright">
<% if @projects.any? %>
<div class="projects box">
<h3 class="icon icon-projects"><%= sprite_icon('projects', l(:label_project_recently_used)) %></h3>
<ul>
<% @projects.each do |project| %>
<li><%= link_to_project project %></li>
<% end %>
</ul>
<%= link_to l(:label_project_view_all), :controller => 'projects' %>
</div>
<% end %>
<% if @news.any? %>
<div class="news box">
<h3 class="icon icon-news"><%= sprite_icon('news', l(:label_news_latest))%></h3>
config/locales/en.yml
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
config/locales/ja.yml
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: ブックマークに追加
test/functional/welcome_controller_test.rb
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
(3-3/3)