Project

General

Profile

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

Takenori TAKAKI, 2024-02-29 00:31

View differences:

app/views/projects/show.html.erb
133 133

  
134 134
  <% if @subprojects.any? %>
135 135
  <div class="projects box">
136
    <h3 class="icon icon-projects"><%=l(:label_subproject_plural)%></h3>
136
    <h3 class="icon icon-projects">
137
      <%=l(:label_subproject_plural)%>
138
      <span class="badge badge-count count"><%= @subprojects.count %></span>
139
    </h3>
137 140
	<ul class="subprojects">
138 141
	  <% @subprojects.each do |project| %>
139 142
	  <li><%= link_to(project.name, project_path(project), :class => project.css_classes).html_safe %></li>
test/functional/projects_controller_test.rb
841 841
    assert_select 'a', :text => "Unarchive"
842 842
  end
843 843

  
844
  def test_show_should_display_subprojects_with_count
845
    @request.session[:user_id] = 1
846
    get(:show, :params => {:id => 'ecookbook'})
847
    assert_response :success
848
    assert_select 'div.projects>h3.icon>span.badge', :text => '3'
849
    assert_select 'div.projects>ul.subprojects>li>a', :text => /Private child of eCookbook/, :count => 1
850
    assert_select 'div.projects>ul.subprojects>li>a', :text => /eCookbook Subproject/, :count => 2
851
  end
852

  
844 853
  def test_show_should_not_show_private_subprojects_that_are_not_visible
845 854
    get(:show, :params => {:id => 'ecookbook'})
846 855
    assert_response :success
(2-2/3)