Skip to content

Commit

Permalink
[#5072] Add a small counter icon to Kanban
Browse files Browse the repository at this point in the history
  • Loading branch information
edavis10 committed Apr 8, 2011
1 parent 9696494 commit 635cdd8
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/locales/en.yml
Expand Up @@ -3,3 +3,4 @@ en:
issue_aging_text_number_of_days_for_error: "Number of days before an issue enters the error state"
issue_aging_text_title: "Aging Issues"
issue_aging_text_last_status_change: "Last status change"
issue_aging_text_days_ago: "%{count} days ago"
2 changes: 2 additions & 0 deletions init.rb
Expand Up @@ -22,3 +22,5 @@
require_dependency 'issue'
Issue.send(:include, ChiliprojectIssueAging::Patches::IssuePatch)
end
require 'chiliproject_issue_aging/hooks/view_kanbans_issue_details_hook'
require 'chiliproject_issue_aging/hooks/view_layouts_base_html_head_hook'
@@ -0,0 +1,33 @@
module ChiliprojectIssueAging
module Hooks
class ViewKanbansIssueDetailsHook < Redmine::Hook::ViewListener
def view_kanbans_issue_details(context={})
issue = context[:issue]

aging_status = issue.aging_status
journal = issue.last_status_change_journal

if aging_status && journal
time_ago = (Date.today - journal.created_on.to_date).to_i

if aging_status == :warning
css_class = 'aging warning-state'
elsif aging_status == :error
css_class = 'aging error-state'
end

return content_tag(:span,
time_ago,
{
:title => l(:issue_aging_text_days_ago, :count => time_ago),
:class => css_class
})

else
return ''
end

end
end
end
end
@@ -0,0 +1,20 @@
module ChiliprojectIssueAging
module Hooks
class ViewLayoutsBaseHtmlHeadHook < Redmine::Hook::ViewListener
def view_layouts_base_html_head(context={})
return <<CSS
<!-- chiliproject_issue_aging plugin -->
<style type="text/css">
.aging.warning-state { background-color: #FDBF3B; }
.aging.error-state { background-color: #dd0000; color: #FFFFFF; }
#kanban .aging { padding: 2px; border: solid 1px #D5D5D5; font-size: 10px; }
/* color on white */
#kanban .aging.warning-state {background-color: white; color: #FDBF3B; }
#kanban .aging.error-state {background-color: white; color: #dd0000; }
</style>
<!-- chiliproject_issue_aging plugin -->
CSS
end
end
end
end
@@ -0,0 +1,12 @@
require File.dirname(__FILE__) + '/../../../test_helper'

class ChiliprojectIssueAging::Hooks::ViewKanbansIssueDetailsTest < ActionController::IntegrationTest
include Redmine::Hook::Helper

context "#view_kanbans_issue_details" do
setup do
end

should "be tested"
end
end
@@ -0,0 +1,12 @@
require File.dirname(__FILE__) + '/../../../test_helper'

class ChiliprojectIssueAging::Hooks::ViewLayoutsBaseHtmlHeadTest < ActionController::IntegrationTest
include Redmine::Hook::Helper

context "#view_layouts_base_html_head" do
setup do
end

should "be tested"
end
end

0 comments on commit 635cdd8

Please sign in to comment.