From fe0f7cd3c3c034461e2bd02fc940707c44572bfb Mon Sep 17 00:00:00 2001 From: onozaty Date: Sat, 6 Jan 2024 15:25:02 +0900 Subject: [PATCH 1/3] #116 Add total estimated hours and total spent hours to ViewCustomize.context.issue. --- lib/redmine_view_customize/view_hook.rb | 4 ++- test/unit/view_customize_view_hook_test.rb | 29 +++++++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/lib/redmine_view_customize/view_hook.rb b/lib/redmine_view_customize/view_hook.rb index 5243aad..15e7fda 100644 --- a/lib/redmine_view_customize/view_hook.rb +++ b/lib/redmine_view_customize/view_hook.rb @@ -32,7 +32,9 @@ def view_issues_show_details_bottom(context={}) "author" => { "id" => context[:issue].author.id, "name" => context[:issue].author.name - } + }, + "totalEstimatedHours" => context[:issue].total_estimated_hours, + "totalSpentHours" => context[:issue].total_spent_hours } if context[:issue].last_updated_by.present? diff --git a/test/unit/view_customize_view_hook_test.rb b/test/unit/view_customize_view_hook_test.rb index 5b08608..096b1b2 100644 --- a/test/unit/view_customize_view_hook_test.rb +++ b/test/unit/view_customize_view_hook_test.rb @@ -3,7 +3,7 @@ class ViewCustomizeViewHookTest < ActiveSupport::TestCase fixtures :projects, :users, :email_addresses, :user_preferences, :members, :member_roles, :roles, - :issues, :journals, :custom_fields, :custom_fields_projects, :custom_values, + :issues, :journals, :custom_fields, :custom_fields_projects, :custom_values, :time_entries, :view_customizes class Request @@ -170,7 +170,7 @@ def test_view_issues_show_details_bottom @@ -193,7 +193,7 @@ def test_view_issues_show_details_bottom_with_journals @@ -207,4 +207,27 @@ def test_view_issues_show_details_bottom_with_journals end + def test_view_issues_show_details_bottom_with_time_entries + + User.current = User.find(1) + issue = Issue.find(1) + + expected = < +// + + + +HTML + + html = @hook.view_issues_show_details_bottom({:request => Request.new("/issues/1"), :issue => issue, :project => @project_onlinestore}) + assert_equal expected, html + + end + end From 00f8ca997d970f3a6ea03e2b48cd5609c1a80f6b Mon Sep 17 00:00:00 2001 From: onozaty Date: Sat, 6 Jan 2024 21:47:15 +0900 Subject: [PATCH 2/3] #116 Fix ViewCustomize.context example --- README.ja.md | 2 ++ README.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/README.ja.md b/README.ja.md index 3b52a7e..dec8d63 100644 --- a/README.ja.md +++ b/README.ja.md @@ -132,6 +132,8 @@ ViewCustomize = { "issue": { "id": 1, "author": {"id": 2, "name": "John Smith"}, + "totalEstimatedHours": 10.0, + "totalSpentHours": 11.5, "lastUpdatedBy": {"id": 1, "name": "Redmine Admin"} } } diff --git a/README.md b/README.md index 7bcf61f..31d413c 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,8 @@ ViewCustomize = { "issue": { "id": 1, "author": {"id": 2, "name": "John Smith"}, + "totalEstimatedHours": 10.0, + "totalSpentHours": 11.5, "lastUpdatedBy": {"id": 1, "name": "Redmine Admin"} } } From 41a1af58c25484f53c8f9a259fa585f4066201e4 Mon Sep 17 00:00:00 2001 From: onozaty Date: Sat, 6 Jan 2024 21:47:48 +0900 Subject: [PATCH 3/3] Update version number to 3.5.0 --- init.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.rb b/init.rb index 5369414..8214018 100644 --- a/init.rb +++ b/init.rb @@ -3,7 +3,7 @@ name 'View Customize plugin' author 'onozaty' description 'View Customize plugin for Redmine' - version '3.4.1' + version '3.5.0' url 'https://github.com/onozaty/redmine-view-customize' author_url 'https://github.com/onozaty'