Adding issue category name as css class
Added by Najib Mestaoui over 11 years ago
Hello everyone,
I have been using redmine for about 8 months now and I'd like to add the ability to style issues depending on its category name. I believe this is a basic task but my knowledge in ruby is almost none so if anyone could help me would be very appreciated. I am also concerned whether this is the right procedure or not??
in issue.rb
def css_classes
s = "issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}"
s << ' closed' if closed?
s << ' overdue' if overdue?
s << ' child' if child?
s << ' parent' unless leaf?
s << ' private' if is_private?
s << ' created-by-me' if User.current.logged? && author_id User.current.id
s << ' assigned-to-me' if User.current.logged? && assigned_to_id User.current.id
s << ' #{self.category.name}'
s
end
Thank you.
Najib
@edit
sorry posted in wrong forum :(
Replies (2)
RE: Adding issue category name as css class - Added by Najib Mestaoui over 11 years ago
ok, I managed to print category ID by using " #{category_id}" no I need to get category name using this id
anyone can give me some helping words :)
thank you.
RE: Adding issue category name as css class - Added by Najib Mestaoui over 11 years ago
I found ittttttt :D #{project.issue_categories.find_by_id(category_id)}
final code is as follow
def css_classes
s = "issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)} "
s << ' closed' if closed?
s << ' overdue' if overdue?
s << ' child' if child?
s << ' parent' unless leaf?
s << ' private' if is_private?
s << ' created-by-me' if User.current.logged? && author_id User.current.id
s << ' assigned-to-me' if User.current.logged? && assigned_to_id User.current.id
s << " #{project.issue_categories.find_by_id(category_id)}"
s
end