File tree Expand file tree Collapse file tree 3 files changed +38
-29
lines changed Expand file tree Collapse file tree 3 files changed +38
-29
lines changed Original file line number Diff line number Diff line change 13
13
<% @issue . time_entries . last ( Setting . plugin_redmine_spent_time_in_issue_description [ 'spent_time_max_display' ] . to_i ) . each_with_index do |entry , index | %>
14
14
<%= "," if index > 0 %> {
15
15
16
- <% if Setting . plugin_redmine_spent_time_in_issue_description [ 'time_format' ] . eql? "human"
17
- time_spent = humanized_time ( entry . hours )
18
- else
19
- time_spent = entry . hours
20
- end
21
- %>
22
-
23
- <%= raw '"spent_on":"' << entry . spent_on . strftime ( "%m/%d/%Y" ) << '",' if Setting . plugin_redmine_spent_time_in_issue_description [ 'display_columns' ] . include? 'spentOn' %>
24
- <%= raw '"user":"' << entry . user . to_s << '",' if Setting . plugin_redmine_spent_time_in_issue_description [ 'display_columns' ] . include? 'user' %>
25
- <%= raw '"hours":"' << time_spent << '",' if Setting . plugin_redmine_spent_time_in_issue_description [ 'display_columns' ] . include? 'hours' %>
26
- <%= raw '"activity":"' << entry . activity . to_s << '",' if Setting . plugin_redmine_spent_time_in_issue_description [ 'display_columns' ] . include? 'activity' %>
27
- <%= raw '"comments":"' << entry . comments << '",' if Setting . plugin_redmine_spent_time_in_issue_description [ 'display_columns' ] . include? 'comments' %>
16
+ <%= raw '"spent_on":"' << entry . spent_on . strftime ( "%m/%d/%Y" ) << '",' if is_spent_on_shown ( entry ) %>
17
+ <%= raw '"user":"' << entry . user . to_s << '",' if is_user_shown ( entry ) %>
18
+ <%= raw '"hours":"' << report_time_spent ( entry ) << '",' if is_report_time_shown ( entry ) %>
19
+ <%= raw '"activity":"' << entry . activity . to_s << '",' if is_activity_shown ( entry ) %>
20
+ <%= raw '"comments":"' << entry . comments << '",' if is_comment_shown ( entry ) %>
28
21
29
22
}
30
23
<% end %>
Original file line number Diff line number Diff line change 17
17
< tbody >
18
18
<% @issue . time_entries . last ( Setting . plugin_redmine_spent_time_in_issue_description [ 'spent_time_max_display' ] . to_i ) . each do |entry | %>
19
19
< tr >
20
- <%= content_tag ( :td , entry . spent_on . strftime ( "%m/%d/%Y" ) ) if Setting . plugin_redmine_spent_time_in_issue_description [ 'display_columns' ] . include? 'spentOn' %>
21
- <%= content_tag ( :td , link_to_user ( entry . user ) ) if Setting . plugin_redmine_spent_time_in_issue_description [ 'display_columns' ] . include? 'user' %>
22
- <% if Setting . plugin_redmine_spent_time_in_issue_description [ 'display_columns' ] . include? 'hours'
23
-
24
- if Setting . plugin_redmine_spent_time_in_issue_description [ 'time_format' ] . eql? "human"
25
- time_spent = humanized_time ( entry . hours )
26
- else
27
- time_spent = entry . hours
28
- end
29
-
30
- %>
31
-
32
- <%= content_tag ( :td , time_spent ) %>
33
-
34
- <% end %>
35
- <%= content_tag ( :td , entry . comments ) if Setting . plugin_redmine_spent_time_in_issue_description [ 'display_columns' ] . include? 'comments' %>
36
- <%= content_tag ( :td , entry . activity ) if Setting . plugin_redmine_spent_time_in_issue_description [ 'display_columns' ] . include? 'activity' %>
20
+ <%= content_tag ( :td , entry . spent_on . strftime ( "%m/%d/%Y" ) ) if is_spent_on_shown ( entry ) %>
21
+ <%= content_tag ( :td , link_to_user ( entry . user ) ) if is_user_shown ( entry ) %>
22
+ <%= content_tag ( :td , report_time_spent ( entry ) ) if is_report_time_shown ( entry ) %>
23
+ <%= content_tag ( :td , entry . comments ) if is_comment_shown ( entry ) %>
24
+ <%= content_tag ( :td , entry . activity ) if is_activity_shown ( entry ) %>
37
25
</ tr >
38
26
<% end %>
39
27
</ tbody >
Original file line number Diff line number Diff line change @@ -26,6 +26,34 @@ def humanized_time(entry_hours)
26
26
27
27
end
28
28
29
+ def report_time_spent ( entry )
30
+ if Setting . plugin_redmine_spent_time_in_issue_description [ 'time_format' ] . eql? "human"
31
+ time_spent = humanized_time ( entry . hours )
32
+ else
33
+ time_spent = entry . hours
34
+ end
35
+ end
36
+
37
+ def is_report_time_shown ( entry )
38
+ Setting . plugin_redmine_spent_time_in_issue_description [ 'display_columns' ] . include? 'hours'
39
+ end
40
+
41
+ def is_spent_on_shown ( entry )
42
+ Setting . plugin_redmine_spent_time_in_issue_description [ 'display_columns' ] . include? 'spentOn'
43
+ end
44
+
45
+ def is_user_shown ( entry )
46
+ Setting . plugin_redmine_spent_time_in_issue_description [ 'display_columns' ] . include? 'user'
47
+ end
48
+
49
+ def is_comment_shown ( entry )
50
+ Setting . plugin_redmine_spent_time_in_issue_description [ 'display_columns' ] . include? 'comments'
51
+ end
52
+
53
+ def is_activity_shown ( entry )
54
+ Setting . plugin_redmine_spent_time_in_issue_description [ 'display_columns' ] . include? 'activity'
55
+ end
56
+
29
57
def self . included ( receiver )
30
58
receiver . send :include , InstanceMethods
31
59
end
You can’t perform that action at this time.
0 commit comments