summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2019-06-20 07:11:26 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2019-06-20 07:11:26 +0000
commit0714ced81572a1501d37bc866855a7f339c3bf03 (patch)
tree7c47bf17258264168494a7bda5f31036cbaab132 /app
parentbe660e11cc2bf68b94451f77e612e0ee0cd666cc (diff)
downloadredmine-0714ced81572a1501d37bc866855a7f339c3bf03.tar.gz
redmine-0714ced81572a1501d37bc866855a7f339c3bf03.zip
Add time entries tab to issue history tabs (#3058).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@18274 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/issues_controller.rb1
-rw-r--r--app/helpers/issues_helper.rb1
-rw-r--r--app/views/issues/tabs/_time_entries.html.erb28
3 files changed, 30 insertions, 0 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index dcc806462..73afc79d5 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -104,6 +104,7 @@ class IssuesController < ApplicationController
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
@priorities = IssuePriority.active
@time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
+ @time_entries = @issue.time_entries.visible.preload(:activity, :user)
@relation = IssueRelation.new
retrieve_previous_and_next_issue_ids
render :template => 'issues/show'
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 16ac24602..3068afe09 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -557,6 +557,7 @@ module IssuesHelper
tabs << {:name => 'notes', :label => :label_issue_history_notes, :onclick => 'showIssueHistory("notes", this.href)'} if journals_with_notes.any?
tabs << {:name => 'properties', :label => :label_issue_history_properties, :onclick => 'showIssueHistory("properties", this.href)'} if journals_without_notes.any?
end
+ tabs << {:name => 'time_entries', :label => :label_time_entry_plural, :partial => 'issues/tabs/time_entries', :locals => {:time_entries => @time_entries}} if User.current.allowed_to?(:view_time_entries, @project) && @issue.spent_hours > 0
tabs << {:name => 'changesets', :label => :label_associated_revisions, :partial => 'issues/tabs/changesets', :locals => {:changesets => @changesets}} if @changesets.present?
tabs
end
diff --git a/app/views/issues/tabs/_time_entries.html.erb b/app/views/issues/tabs/_time_entries.html.erb
new file mode 100644
index 000000000..931a8df39
--- /dev/null
+++ b/app/views/issues/tabs/_time_entries.html.erb
@@ -0,0 +1,28 @@
+<% for time_entry in tab[:locals][:time_entries] %>
+ <div id="time-entry-<%= time_entry.id %>" class="time_entry journal">
+ <% if time_entry.editable_by?(User.current) -%>
+ <div class="contextual">
+ <%= link_to l(:button_edit), edit_time_entry_path(time_entry),
+ :title => l(:button_edit),
+ :class => 'icon-only icon-edit' %>
+ <%= link_to l(:button_delete), time_entry_path(time_entry),
+ :data => {:confirm => l(:text_are_you_sure)},
+ :method => :delete,
+ :title => l(:button_delete),
+ :class => 'icon-only icon-del' %>
+ </div>
+ <% end -%>
+ <h4>
+ <%= avatar(time_entry.user, :size => "24") %>
+ <%= authoring time_entry.created_on, time_entry.user, :label => :label_added_time_by %>
+ </h4>
+ <ul class="details">
+ <li>
+ <strong><%= l(:label_time_entry_plural) %></strong>:
+ <%= l_hours_short time_entry.hours %>
+ </li>
+ </ul>
+ <p><%= time_entry.comments %></p>
+ </div>
+ <%= call_hook(:view_issues_history_time_entry_bottom, { :time_entry => time_entry }) %>
+<% end %> \ No newline at end of file