Project

General

Profile

Feature #20289 ยป 0001-Add-category_id-to-issues-CSS-classes-when-it-s-pres.patch

Mischa The Evil, 2015-07-11 10:45

View differences:

app/models/issue.rb
1202 1202
  # Returns a string of css classes that apply to the issue
1203 1203
  def css_classes(user=User.current)
1204 1204
    s = "issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}"
1205
    s << " category-#{category_id}" if category.present?
1205 1206
    s << ' closed' if closed?
1206 1207
    s << ' overdue' if overdue?
1207 1208
    s << ' child' if child?
test/unit/issue_test.rb
2454 2454
    assert_include 'priority-highest', classes
2455 2455
  end
2456 2456

  
2457
  def test_css_classes_should_include_issue_category_when_present
2458
    issue = Issue.new
2459
    classes = issue.css_classes.split(' ')
2460
    assert_not_include 'category-', classes
2461

  
2462
    issue = Issue.new(:category => IssueCategory.find(1))
2463
    classes = issue.css_classes.split(' ')
2464
    assert_include 'category-1', classes
2465
  end
2466

  
2457 2467
  def test_css_classes_should_include_user_and_group_assignment
2458 2468
    project = Project.first
2459 2469
    user = User.generate!
    (1-1/1)