Project

General

Profile

Patch #14767 ยป patch_more_css_classes.diff

Daniel Felix, 2013-08-24 22:46

View differences:

app/helpers/application_helper.rb
css << 'theme-' + theme.name
end
css << 'project-'+@project.identifier if @project
css << 'controller-' + controller_name
css << 'action-' + action_name
css.join(' ')
......
(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
app/models/issue.rb
!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
......
# 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?
......
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
app/views/issues/show.html.erb
<%= render :partial => 'action_menu' %>
<h2><%= issue_heading(@issue) %></h2>
<h2 class="<%= "tracker tracker-#{@issue.tracker.name.downcase}" %>"><%= issue_heading(@issue) %></h2>
<div class="<%= @issue.css_classes %> details">
<% if @prev_issue_id || @next_issue_id %>
app/views/versions/index.html.erb
<% issues.each do |issue| -%>
<tr class="hascontextmenu">
<td class="checkbox"><%= check_box_tag 'ids[]', issue.id, false, :id => nil %></td>
<td><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
<td class="issue"><%= link_to_issue(issue, :project => (@project != issue.project)) %></td>
</tr>
<% end -%>
</table>
test/unit/issue_test.rb
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)
    (1-1/1)