add-public-project-badge.patch

Mizuki ISHIKAWA, 2021-05-10 02:40

Download (2.14 KB)

View differences:

app/views/projects/show.html.erb
21 21
  <% end %>
22 22
</div>
23 23

  
24
<h2><%=l(:label_overview)%></h2>
24
<h2><%=l(:label_overview)%> <% if @project.is_public %><span class="badge badge-project-public"><%= l(:field_is_public) %></span><% end %></h2>
25 25

  
26 26
<% unless @project.active? %>
27 27
  <p class="warning"><span class="icon icon-lock"><%= l(:text_project_closed) %></span></p>
public/stylesheets/application.css
1462 1462
  color: #fff;
1463 1463
  border: 1px solid #d22;
1464 1464
}
1465
.badge-project-public {
1466
  color: #205D86;
1467
  border: 1px solid #205D86;
1468
}
1465 1469
.badge-count {
1466 1470
  color: #fff;
1467 1471
  background:#9DB9D5;
test/functional/projects_controller_test.rb
673 673
    assert_select '#main.nosidebar'
674 674
  end
675 675

  
676
  def test_show_should_display_project_public_badge_if_project_is_public
677
    p = Project.find('ecookbook')
678
    assert p.is_public?
679

  
680
    get(:show, params: {id: p.identifier})
681
    assert_response :success
682
    assert_select '.badge.badge-project-public', text: l(:field_is_public)
683
  end
684

  
685
  def test_show_should_not_display_project_public_badge_if_project_is_private
686
    @request.session[:user_id] = 1
687
    p = Project.find('private-child')
688
    assert_not p.is_public?
689

  
690
    get(:show, params: {id: p.identifier})
691
    assert_response :success
692
    assert_select '.badge.badge-project-public', count: 0
693
  end
694

  
676 695
  def test_show_should_display_visible_custom_fields
677 696
    ProjectCustomField.find_by_name('Development status').update_attribute :visible, true
678 697
    get(:show, :params => {:id => 'ecookbook'})