diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-04-05 16:40:26 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-04-05 16:40:26 +0000 |
commit | 4e961f44eff23b53351d550fb46c2a346688a271 (patch) | |
tree | 370ce1c53d2620adaed3d9da904936769fe0fc5d /app/views/timelog | |
parent | 8d4aa6f9ade613f831ff2043713ad062293babfd (diff) | |
download | redmine-4e961f44eff23b53351d550fb46c2a346688a271.tar.gz redmine-4e961f44eff23b53351d550fb46c2a346688a271.zip |
Various timelog report enhancements:
* report can be done using days as columns (#993)
* add a total column to the time report
* replace upper-right links by tabs to switch between details and report
* preserve date range filter when switching between details and report
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1326 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/timelog')
-rw-r--r-- | app/views/timelog/_date_range.rhtml | 10 | ||||
-rw-r--r-- | app/views/timelog/_report_criteria.rhtml | 4 | ||||
-rw-r--r-- | app/views/timelog/details.rhtml | 1 | ||||
-rw-r--r-- | app/views/timelog/report.rhtml | 17 |
4 files changed, 24 insertions, 8 deletions
diff --git a/app/views/timelog/_date_range.rhtml b/app/views/timelog/_date_range.rhtml index ac46fea18..a54f7a2f0 100644 --- a/app/views/timelog/_date_range.rhtml +++ b/app/views/timelog/_date_range.rhtml @@ -14,3 +14,13 @@ <%= submit_tag l(:button_apply), :name => nil, :onclick => '$("period_type_2").checked = true;' %> </p> </fieldset> + +<div class="tabs"> +<% url_params = @free_period ? { :from => @from, :to => @to } : { :period => params[:period] } %> +<ul> + <li><%= link_to(l(:label_details), url_params.merge({:controller => 'timelog', :action => 'details', :project_id => @project }), + :class => (@controller.action_name == 'details' ? 'selected' : nil)) %></li> + <li><%= link_to(l(:label_report), url_params.merge({:controller => 'timelog', :action => 'report', :project_id => @project}), + :class => (@controller.action_name == 'report' ? 'selected' : nil)) %></li> +</ul> +</div> diff --git a/app/views/timelog/_report_criteria.rhtml b/app/views/timelog/_report_criteria.rhtml index b048c874a..661e1fdb8 100644 --- a/app/views/timelog/_report_criteria.rhtml +++ b/app/views/timelog/_report_criteria.rhtml @@ -5,10 +5,12 @@ <%= '<td></td>' * level %> <td><%= value.nil? ? l(:label_none) : @available_criterias[criterias[level]][:klass].find_by_id(value) %></td> <%= '<td></td>' * (criterias.length - level - 1) -%> + <% total = 0 -%> <% @periods.each do |period| -%> - <% sum = sum_hours(select_hours(hours_for_value, @columns, period.to_s)) %> + <% sum = sum_hours(select_hours(hours_for_value, @columns, period.to_s)); total += sum -%> <td class="hours"><%= html_hours("%.2f" % sum) if sum > 0 %></td> <% end -%> + <td class="hours"><%= html_hours("%.2f" % total) if total > 0 %></td> </tr> <% if criterias.length > level+1 -%> <%= render(:partial => 'report_criteria', :locals => {:criterias => criterias, :hours => hours_for_value, :level => (level + 1)}) %> diff --git a/app/views/timelog/details.rhtml b/app/views/timelog/details.rhtml index a0810fbde..f02da9959 100644 --- a/app/views/timelog/details.rhtml +++ b/app/views/timelog/details.rhtml @@ -1,5 +1,4 @@ <div class="contextual">
-<%= link_to(l(:label_report), {:controller => 'timelog', :action => 'report', :project_id => @project}, :class => 'icon icon-report') %>
<%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'edit', :project_id => @project, :issue_id => @issue}, :class => 'icon icon-time' %>
</div>
diff --git a/app/views/timelog/report.rhtml b/app/views/timelog/report.rhtml index 92d0e8782..c29cadf9c 100644 --- a/app/views/timelog/report.rhtml +++ b/app/views/timelog/report.rhtml @@ -1,5 +1,4 @@ <div class="contextual"> -<%= link_to(l(:label_details), {:controller => 'timelog', :action => 'details', :project_id => @project}, :class => 'icon icon-details') %> <%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'edit', :project_id => @project, :issue_id => @issue}, :class => 'icon icon-time' %> </div> @@ -14,7 +13,8 @@ <p><%= l(:label_details) %>: <%= select_tag 'columns', options_for_select([[l(:label_year), 'year'], [l(:label_month), 'month'], - [l(:label_week), 'week']], @columns), + [l(:label_week), 'week'], + [l(:label_day_plural).titleize, 'day']], @columns), :onchange => "this.form.onsubmit();" %> <%= l(:button_add) %>: <%= select_tag('criterias[]', options_for_select([[]] + (@available_criterias.keys - @criterias).collect{|k| [l(@available_criterias[k][:label]), k]}), @@ -22,8 +22,9 @@ :style => 'width: 200px', :id => nil, :disabled => (@criterias.length >= 3)) %> - <%= link_to_remote l(:button_clear), {:url => {:project_id => @project, :date_from => @date_from, :date_to => @date_to, :period => @columns}, :update => 'content'}, - :class => 'icon icon-reload' %></p> + <%= link_to_remote l(:button_clear), {:url => {:project_id => @project, :period_type => params[:period_type], :period => params[:period], :from => @from, :to => @to, :columns => @columns}, + :update => 'content' + }, :class => 'icon icon-reload' %></p> <% end %> <% unless @criterias.empty? %> @@ -38,9 +39,11 @@ <% @criterias.each do |criteria| %> <th><%= l(@available_criterias[criteria][:label]) %></th> <% end %> +<% columns_width = (40 / (@periods.length+1)).to_i %> <% @periods.each do |period| %> - <th class="period" width="<%= (40 / @periods.length).to_i %>%"><%= period %></th> + <th class="period" width="<%= columns_width %>%"><%= period %></th> <% end %> + <th class="total" width="<%= columns_width %>%"><%= l(:label_total) %></th> </tr> </thead> <tbody> @@ -48,10 +51,12 @@ <tr class="total"> <td><%= l(:label_total) %></td> <%= '<td></td>' * (@criterias.size - 1) %> + <% total = 0 -%> <% @periods.each do |period| -%> - <% sum = sum_hours(select_hours(@hours, @columns, period.to_s)) %> + <% sum = sum_hours(select_hours(@hours, @columns, period.to_s)); total += sum -%> <td class="hours"><%= html_hours("%.2f" % sum) if sum > 0 %></td> <% end -%> + <td class="hours"><%= html_hours("%.2f" % total) if total > 0 %></td> </tr> </tbody> </table> |