Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#5072] Add a small counter icon to Kanban
- Loading branch information
Showing
6 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
lib/chiliproject_issue_aging/hooks/view_kanbans_issue_details_hook.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
20 changes: 20 additions & 0 deletions
20
lib/chiliproject_issue_aging/hooks/view_layouts_base_html_head_hook.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
12 changes: 12 additions & 0 deletions
12
test/integration/chiliproject_issue_aging/hooks/view_kanbans_issue_details_hook_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
12 changes: 12 additions & 0 deletions
12
test/integration/chiliproject_issue_aging/hooks/view_layouts_base_html_head_hook_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |