Project

General

Profile

Feature #23212 » 0002-Enable-to-display-subprojects-child-count.patch

Takenori TAKAKI, 2024-02-29 00:31

View differences:

app/views/projects/show.html.erb
137 137
      <%=l(:label_subproject_plural)%>
138 138
      <span class="badge badge-count count"><%= @subprojects.count %></span>
139 139
    </h3>
140
	<ul class="subprojects">
141
	  <% @subprojects.each do |project| %>
142
	  <li><%= link_to(project.name, project_path(project), :class => project.css_classes).html_safe %></li>
143
	  <% end %> 
140
    <ul class="subprojects">
141
      <% @subprojects.each do |project| %>
142
        <li>
143
          <%= link_to(project.name, project_path(project), :class => project.css_classes).html_safe %>
144
          <% if ((child_count = project.children.visible.count) && (child_count > 0)) %>
145
            <span class="badge badge-count count"><%= child_count %></span>
146
          <% end %>
147
        </li>
148
      <% end %>
144 149
    </ul>
145 150
  </div>
146 151
  <% end %>
test/functional/projects_controller_test.rb
847 847
    assert_response :success
848 848
    assert_select 'div.projects>h3.icon>span.badge', :text => '3'
849 849
    assert_select 'div.projects>ul.subprojects>li>a', :text => /Private child of eCookbook/, :count => 1
850
    assert_select 'div.projects>ul.subprojects>li>span.badge', :text => '1'
850 851
    assert_select 'div.projects>ul.subprojects>li>a', :text => /eCookbook Subproject/, :count => 2
851 852
  end
852 853

  
(3-3/3)