Project

General

Profile

Patch #14767 ยป patch_more_css_classes.diff

Daniel Felix, 2013-08-24 22:46

View differences:

app/helpers/application_helper.rb
488 488
      css << 'theme-' + theme.name
489 489
    end
490 490

  
491
    css << 'project-'+@project.identifier if @project
491 492
    css << 'controller-' + controller_name
492 493
    css << 'action-' + action_name
493 494
    css.join(' ')
......
1061 1062
        (pcts[0] > 0 ? content_tag('td', '', :style => "width: #{pcts[0]}%;", :class => 'closed') : ''.html_safe) +
1062 1063
        (pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1]}%;", :class => 'done') : ''.html_safe) +
1063 1064
        (pcts[2] > 0 ? content_tag('td', '', :style => "width: #{pcts[2]}%;", :class => 'todo') : ''.html_safe)
1064
      ), :class => 'progress', :style => "width: #{width};").html_safe +
1065
      ), :class => 'progress progress-#{pcts[0]}', :style => "width: #{width};").html_safe +
1065 1066
      content_tag('p', legend, :class => 'percent').html_safe
1066 1067
  end
1067 1068

  
app/models/issue.rb
744 744
    !relations_to.detect {|ir| ir.relation_type == 'blocks' && !ir.issue_from.closed?}.nil?
745 745
  end
746 746

  
747
  # Returns true if this issue has a relation to another preceding issue, which is still open
748
  def follows?
749
    !relations_to.detect {|ir| ir.relation_type == 'precedes' && !ir.issue_from.closed?}.nil?
750
  end
751

  
747 752
  # Returns an array of statuses that user is able to apply
748 753
  def new_statuses_allowed_to(user=User.current, include_default=false)
749 754
    if new_record? && @copied_from
......
1073 1078

  
1074 1079
  # Returns a string of css classes that apply to the issue
1075 1080
  def css_classes(user=User.current)
1076
    s = "issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}"
1081
    s = "issue tracker-#{tracker_id} tracker-#{tracker.name.downcase} status-#{status_id} status-#{status.name.downcase} #{priority.try(:css_classes)}"
1077 1082
    s << ' closed' if closed?
1083
    s << ' timed' unless due_date.blank?
1078 1084
    s << ' overdue' if overdue?
1079 1085
    s << ' child' if child?
1080 1086
    s << ' parent' unless leaf?
......
1084 1090
      s << ' assigned-to-me' if assigned_to_id == user.id
1085 1091
      s << ' assigned-to-my-group' if user.groups.any? {|g| g.id = assigned_to_id}
1086 1092
    end
1093
    rel = 'blocked' if blocked?
1094
    rel ||= ' follows' if follows?
1095
    rel ||= ' free'
1096
    s << rel
1087 1097
    s
1088 1098
  end
1089 1099

  
app/views/issues/show.html.erb
1 1
<%= render :partial => 'action_menu' %>
2 2

  
3
<h2><%= issue_heading(@issue) %></h2>
3
<h2 class="<%= "tracker tracker-#{@issue.tracker.name.downcase}" %>"><%= issue_heading(@issue) %></h2>
4 4

  
5 5
<div class="<%= @issue.css_classes %> details">
6 6
  <% if @prev_issue_id || @next_issue_id %>
app/views/versions/index.html.erb
21 21
        <% issues.each do |issue| -%>
22 22
          <tr class="hascontextmenu">
23 23
            <td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td>
24
            <td><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
24
            <td class="issue"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
25 25
          </tr>
26 26
        <% end -%>
27 27
        </table>
test/unit/issue_test.rb
1407 1407
    assert !blocking_issue.blocked?
1408 1408
  end
1409 1409

  
1410
  def test_follows
1411
    followed_issue = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17')
1412
    following_issue = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17')
1413
    IssueRelation.create!(:issue_from => issue1, :issue_to => issue2,
1414
                          :relation_type => IssueRelation::TYPE_PRECEDES)
1415

  
1416
    assert !followed.follows?
1417
    assert following_issue.follows?
1418

  
1419
    followed_issue.status_id = 5
1420
    followed_issue.save!
1421
    following_isse.reload
1422

  
1423
    assert !following_issue.follows?
1424
  end
1425

  
1410 1426
  def test_blocked_issues_dont_allow_closed_statuses
1411 1427
    blocked_issue = Issue.find(9)
1412 1428

  
    (1-1/1)