redmine_project_visibility_class-v2.patch

Go MAEDA, 2018-07-16 04:50

Download (1.5 KB)

View differences:

app/models/project.rb
628 628
    s << ' root' if root?
629 629
    s << ' child' if child?
630 630
    s << (leaf? ? ' leaf' : ' parent')
631
    s << ' public' if is_public?
631 632
    unless active?
632 633
      if archived?
633 634
        s << ' archived'
test/unit/project_test.rb
1006 1006
    assert_kind_of String, p.css_classes
1007 1007
    assert_not_include 'archived', p.css_classes.split
1008 1008
    assert_not_include 'closed', p.css_classes.split
1009
    assert_include 'public', p.css_classes.split
1009 1010
  end
1010 1011

  
1011 1012
  def test_css_classes_for_archived_project
1012 1013
    p = Project.new
1013 1014
    p.status = Project::STATUS_ARCHIVED
1014 1015
    assert_include 'archived', p.css_classes.split
1016
    assert_include 'public', p.css_classes.split
1015 1017
  end
1016 1018

  
1017 1019
  def test_css_classes_for_closed_project
1018 1020
    p = Project.new
1019 1021
    p.status = Project::STATUS_CLOSED
1020 1022
    assert_include 'closed', p.css_classes.split
1023
    assert_include 'public', p.css_classes.split
1024
  end
1025

  
1026
  def test_css_classes_for_private_project
1027
    p = Project.new
1028
    p.is_public = false
1029
    assert_not_include 'public', p.css_classes.split
1021 1030
  end
1022 1031

  
1023 1032
  def test_combination_of_visible_and_distinct_scopes_in_case_anonymous_group_has_memberships_should_not_error