From 8d54d9700746636849bd104f4d18db479492505e Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang <jp_lang@yahoo.fr> Date: Fri, 23 Mar 2007 12:22:31 +0000 Subject: Simple time tracking functionality added. Time can be logged at issue or project level. There's no aggregation reports for now, it's just possible to see all time entries for a project or an issue. A new "activities" enumeration is added. Permission for a role to log time must be set (new "Time tracking" section in role permissions screen). git-svn-id: http://redmine.rubyforge.org/svn/trunk@368 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/issues/show.rhtml | 4 ++- app/views/reports/issue_report.rhtml | 11 ++++++++ app/views/timelog/details.rhtml | 51 ++++++++++++++++++++++++++++++++++++ app/views/timelog/edit.rhtml | 23 ++++++++++++++++ 4 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 app/views/timelog/details.rhtml create mode 100644 app/views/timelog/edit.rhtml (limited to 'app/views') diff --git a/app/views/issues/show.rhtml b/app/views/issues/show.rhtml index 43e959c1b..98e88671c 100644 --- a/app/views/issues/show.rhtml +++ b/app/views/issues/show.rhtml @@ -28,7 +28,8 @@ </tr> <tr> <td><b><%=l(:field_fixed_version)%> :</b></td><td><%= @issue.fixed_version ? @issue.fixed_version.name : "-" %></td> - <td></td><td></td> + <td><b><%=l(:label_spent_time)%> :</b></td> + <td><%= @issue.spent_hours > 0 ? (link_to lwr(:label_f_hour, @issue.spent_hours), {:controller => 'timelog', :action => 'details', :issue_id => @issue}, :class => 'icon icon-time') : "-" %></td> </tr> <tr> <% n = 0 @@ -51,6 +52,7 @@ end %> <div class="contextual"> <%= link_to_if_authorized l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue}, :class => 'icon icon-edit' %> +<%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'edit', :issue_id => @issue}, :class => 'icon icon-time' %> <%= link_to_if_authorized l(:button_move), {:controller => 'projects', :action => 'move_issues', :id => @project, "issue_ids[]" => @issue.id }, :class => 'icon icon-move' %> <%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> </div> diff --git a/app/views/reports/issue_report.rhtml b/app/views/reports/issue_report.rhtml index 8ad45afcf..8f832f87e 100644 --- a/app/views/reports/issue_report.rhtml +++ b/app/views/reports/issue_report.rhtml @@ -1,5 +1,6 @@ <h2><%=l(:label_report_plural)%></h2> +<div class="splitcontentleft"> <div class="contextual"> <%= link_to_if_authorized l(:label_query_new), {:controller => 'projects', :action => 'add_query', :id => @project}, :class => 'icon icon-add' %> </div> @@ -11,6 +12,16 @@ <li><%= link_to query.name, :controller => 'projects', :action => 'list_issues', :id => @project, :query_id => query %></li> <% end %> </ul> +</div> +<div class="splitcontentright"> +<% if @total_hours %> +<h3 class="textright"><%= l(:label_spent_time) %>: +<%= link_to(lwr(:label_f_hour, @total_hours), {:controller => 'timelog', :action => 'details', :project_id => @project}, :class => 'icon icon-time') %> +</h3> +<% end %> +</div> + +<div class="clear"></div> <div class="splitcontentleft"> <h3><%=l(:field_tracker)%> <%= link_to image_tag('zoom_in.png'), :detail => 'tracker' %></h3> diff --git a/app/views/timelog/details.rhtml b/app/views/timelog/details.rhtml new file mode 100644 index 000000000..f85eb0f5a --- /dev/null +++ b/app/views/timelog/details.rhtml @@ -0,0 +1,51 @@ +<div class="contextual"> +<%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'edit', :project_id => @project, :issue_id => @issue}, :class => 'icon icon-time' %> +</div> + +<h2><%= l(:label_spent_time) %></h2> + +<h3><%= link_to(@project.name, {:action => 'details', :project_id => @project}) if @project %> +<%= "/ " + link_to("#{@issue.tracker.name} ##{@issue.id}", {:action => 'details', :issue_id => @issue }) + ": #{h(@issue.subject)}" if @issue %></h3> + +<h3 class="textright"><%= l(:label_total) %>: <%= lwr(:label_f_hour, @total_hours) %></h3> + +<% unless @entries.empty? %> +<table class="list"> +<thead> +<%= sort_header_tag('spent_on', :caption => l(:label_date)) %> +<%= sort_header_tag('user_id', :caption => l(:label_member)) %> +<%= sort_header_tag('activity_id', :caption => l(:label_activity)) %> +<%= sort_header_tag('issue_id', :caption => l(:label_issue)) %> +<th><%= l(:label_comment) %></th> +<%= sort_header_tag('hours', :caption => l(:field_hours)) %> +<th></th> +</thead> +<tbody> +<% @entries.each do |entry| %> +<tr class="<%= cycle("odd", "even") %>"> +<td align="center"><%= format_date(entry.spent_on) %></td> +<td align="center"><%= entry.user.name %></td> +<td align="center"><%= entry.activity.name %></td> +<td align="center"> + <% if entry.issue %> + <div class="tooltip"> + <%= link_to "#{entry.issue.tracker.name} ##{entry.issue.id}", {:action => 'details', :issue_id => entry.issue } %> + <span class="tip"> + <%= render :partial => "issues/tooltip", :locals => { :issue => entry.issue }%> + </span> + </div> + <% end %> +</td> +<td><%=h entry.comment %></td> +<td align="center"><strong><%= entry.hours %></strong></td> +<td align="center"><%= link_to_if_authorized(l(:button_edit), {:controller => 'timelog', :action => 'edit', :id => entry}, :class => "icon icon-edit") if entry.user_id == @owner_id %></td> +</tr> +<% end %> +</tbdoy> +</table> + +<div class="contextual"> +<%= l(:label_export_to) %> +<%= link_to 'CSV', params.update(:export => 'csv'), :class => 'icon icon-csv' %> +</div> +<% end %> \ No newline at end of file diff --git a/app/views/timelog/edit.rhtml b/app/views/timelog/edit.rhtml new file mode 100644 index 000000000..b826f7be7 --- /dev/null +++ b/app/views/timelog/edit.rhtml @@ -0,0 +1,23 @@ +<h2><%= l(:label_spent_time) %></h2> + +<% labelled_tabular_form_for :time_entry, @time_entry, :url => {:action => 'edit', :project_id => @time_entry.project} do |f| %> +<%= error_messages_for 'time_entry' %> + +<div class="box"> +<p><%= f.text_field :issue_id, :size => 6 %> <em><%= h("#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}") if @time_entry.issue %></em></p> +<p><%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p> +<p><%= f.text_field :hours, :size => 6, :required => true %></p> +<p><%= f.text_field :comment, :size => 100 %></p> +<p><%= f.select :activity_id, (@activities.collect {|p| [p.name, p.id]}), :required => true %></p> +</div> + +<%= submit_tag l(:button_save) %> + +<% end %> + +<% content_for :header_tags do %> +<%= javascript_include_tag 'calendar/calendar' %> +<%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %> +<%= javascript_include_tag 'calendar/calendar-setup' %> +<%= stylesheet_link_tag 'calendar' %> +<% end %> \ No newline at end of file -- cgit v1.2.3