diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3cac90d..475e57b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -488,6 +488,7 @@ module ApplicationHelper css << 'theme-' + theme.name end + css << 'project-'+@project.identifier if @project css << 'controller-' + controller_name css << 'action-' + action_name css.join(' ') @@ -1061,7 +1062,7 @@ module ApplicationHelper (pcts[0] > 0 ? content_tag('td', '', :style => "width: #{pcts[0]}%;", :class => 'closed') : ''.html_safe) + (pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1]}%;", :class => 'done') : ''.html_safe) + (pcts[2] > 0 ? content_tag('td', '', :style => "width: #{pcts[2]}%;", :class => 'todo') : ''.html_safe) - ), :class => 'progress', :style => "width: #{width};").html_safe + + ), :class => 'progress progress-#{pcts[0]}', :style => "width: #{width};").html_safe + content_tag('p', legend, :class => 'percent').html_safe end diff --git a/app/models/issue.rb b/app/models/issue.rb index d04f5bd..ae2b59d 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -744,6 +744,11 @@ class Issue < ActiveRecord::Base !relations_to.detect {|ir| ir.relation_type == 'blocks' && !ir.issue_from.closed?}.nil? end + # Returns true if this issue has a relation to another preceding issue, which is still open + def follows? + !relations_to.detect {|ir| ir.relation_type == 'precedes' && !ir.issue_from.closed?}.nil? + end + # Returns an array of statuses that user is able to apply def new_statuses_allowed_to(user=User.current, include_default=false) if new_record? && @copied_from @@ -1073,8 +1078,9 @@ class Issue < ActiveRecord::Base # Returns a string of css classes that apply to the issue def css_classes(user=User.current) - s = "issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}" + s = "issue tracker-#{tracker_id} tracker-#{tracker.name.downcase} status-#{status_id} status-#{status.name.downcase} #{priority.try(:css_classes)}" s << ' closed' if closed? + s << ' timed' unless due_date.blank? s << ' overdue' if overdue? s << ' child' if child? s << ' parent' unless leaf? @@ -1084,6 +1090,10 @@ class Issue < ActiveRecord::Base s << ' assigned-to-me' if assigned_to_id == user.id s << ' assigned-to-my-group' if user.groups.any? {|g| g.id = assigned_to_id} end + rel = 'blocked' if blocked? + rel ||= ' follows' if follows? + rel ||= ' free' + s << rel s end diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 83b4f56..8a51e4a 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -1,6 +1,6 @@ <%= render :partial => 'action_menu' %> -

<%= issue_heading(@issue) %>

+

"><%= issue_heading(@issue) %>

<% if @prev_issue_id || @next_issue_id %> diff --git a/app/views/versions/index.html.erb b/app/views/versions/index.html.erb index b78005a..4e2dade 100644 --- a/app/views/versions/index.html.erb +++ b/app/views/versions/index.html.erb @@ -21,7 +21,7 @@ <% issues.each do |issue| -%> <%= check_box_tag 'ids[]', issue.id, false, :id => nil %> - <%= link_to_issue(issue, :project => (@project != issue.project)) %> + <%= link_to_issue(issue, :project => (@project != issue.project)) %> <% end -%> diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index 8f9f965..a07492b 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -1407,6 +1407,22 @@ class IssueTest < ActiveSupport::TestCase assert !blocking_issue.blocked? end + def test_follows + followed_issue = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17') + following_issue = Issue.generate!(:start_date => '2012-10-15', :due_date => '2012-10-17') + IssueRelation.create!(:issue_from => issue1, :issue_to => issue2, + :relation_type => IssueRelation::TYPE_PRECEDES) + + assert !followed.follows? + assert following_issue.follows? + + followed_issue.status_id = 5 + followed_issue.save! + following_isse.reload + + assert !following_issue.follows? + end + def test_blocked_issues_dont_allow_closed_statuses blocked_issue = Issue.find(9)