Show projects using a table instead of an unordered list in the user profile page (#31066).

Patch by Takenori TAKAKI.


git-svn-id: http://svn.redmine.org/redmine/trunk@18012 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2019-03-28 23:44:28 +00:00
parent 72e1451159
commit 32dce42b71
2 changed files with 33 additions and 7 deletions

View File

@@ -77,12 +77,26 @@
<% unless @memberships.empty? %>
<h3><%=l(:label_project_plural)%></h3>
<ul>
<% for membership in @memberships %>
<li><%= link_to_project(membership.project) %>
(<%= membership.roles.sort.collect(&:to_s).join(', ') %>, <%= format_date(membership.created_on) %>)</li>
<table class="list projects">
<thead>
<tr>
<th><%=l(:label_project)%></th>
<th><%=l(:label_role_plural)%></th>
<th><%=l(:label_registered_on)%></th>
</tr>
</thead>
<tbody>
<% memberships_by_project = @memberships.group_by(&:project) %>
<% project_tree(memberships_by_project.keys, :init_level => true) do |project, level| %>
<% membership = memberships_by_project[project].first %>
<tr class="<%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
<td class="name"><span><%= link_to_project(project) %></span></td>
<td class="roles"><%= membership.roles.sort.collect(&:to_s).join(', ') %></td>
<td><%= format_date(membership.created_on) %></td>
</tr>
<% end %>
</ul>
</tbody>
</table>
<% end %>
<% if (User.current == @user || User.current.admin?) && @user.groups.any? %>

View File

@@ -173,8 +173,20 @@ class UsersControllerTest < Redmine::ControllerTest
get :show, :params => {:id => 2}
assert_response :success
# membership of private project admin can see
assert_select 'li a', :text => "OnlineStore"
assert_select 'table.list.projects>tbody' do
assert_select 'tr:nth-of-type(1)' do
assert_select 'td:nth-of-type(1)>span>a', :text => 'eCookbook'
assert_select 'td:nth-of-type(2)', :text => 'Manager'
end
assert_select 'tr:nth-of-type(2)' do
assert_select 'td:nth-of-type(1)>span>a', :text => 'Private child of eCookbook'
assert_select 'td:nth-of-type(2)', :text => 'Manager'
end
assert_select 'tr:nth-of-type(3)' do
assert_select 'td:nth-of-type(1)>span>a', :text => 'OnlineStore'
assert_select 'td:nth-of-type(2)', :text => 'Developer'
end
end
end
def test_show_current_should_require_authentication