Adds a branch for unlimited project hierarchy.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/work@2148 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<fieldset id="filters"><legend><%= l(:label_date_range) %></legend>
|
||||
<p>
|
||||
<%= radio_button_tag 'period_type', '1', !@free_period %>
|
||||
<%= select_tag 'period', options_for_period_select(params[:period]),
|
||||
:onchange => 'this.form.onsubmit();',
|
||||
:onfocus => '$("period_type_1").checked = true;' %>
|
||||
</p>
|
||||
<p>
|
||||
<%= radio_button_tag 'period_type', '2', @free_period %>
|
||||
<span onclick="$('period_type_2').checked = true;">
|
||||
<%= l(:label_date_from) %>
|
||||
<%= text_field_tag 'from', @from, :size => 10 %> <%= calendar_for('from') %>
|
||||
<%= l(:label_date_to) %>
|
||||
<%= text_field_tag 'to', @to, :size => 10 %> <%= calendar_for('to') %>
|
||||
</span>
|
||||
<%= submit_tag l(:button_apply), :name => nil %>
|
||||
</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>
|
||||
@@ -0,0 +1,41 @@
|
||||
<table class="list time-entries">
|
||||
<thead>
|
||||
<tr>
|
||||
<%= sort_header_tag('spent_on', :caption => l(:label_date), :default_order => 'desc') %>
|
||||
<%= sort_header_tag('user_id', :caption => l(:label_member)) %>
|
||||
<%= sort_header_tag('activity_id', :caption => l(:label_activity)) %>
|
||||
<%= sort_header_tag("#{Project.table_name}.name", :caption => l(:label_project)) %>
|
||||
<%= sort_header_tag('issue_id', :caption => l(:label_issue), :default_order => 'desc') %>
|
||||
<th><%= l(:field_comments) %></th>
|
||||
<%= sort_header_tag('hours', :caption => l(:field_hours)) %>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% entries.each do |entry| -%>
|
||||
<tr class="time-entry <%= cycle("odd", "even") %>">
|
||||
<td class="spent_on"><%= format_date(entry.spent_on) %></td>
|
||||
<td class="user"><%=h entry.user %></td>
|
||||
<td class="activity"><%=h entry.activity %></td>
|
||||
<td class="project"><%=h entry.project %></td>
|
||||
<td class="subject">
|
||||
<% if entry.issue -%>
|
||||
<%= link_to_issue entry.issue %>: <%= h(truncate(entry.issue.subject, 50)) -%>
|
||||
<% end -%>
|
||||
</td>
|
||||
<td class="comments"><%=h entry.comments %></td>
|
||||
<td class="hours"><%= html_hours("%.2f" % entry.hours) %></td>
|
||||
<td align="center">
|
||||
<% if entry.editable_by?(User.current) -%>
|
||||
<%= link_to image_tag('edit.png'), {:controller => 'timelog', :action => 'edit', :id => entry, :project_id => nil},
|
||||
:title => l(:button_edit) %>
|
||||
<%= link_to image_tag('delete.png'), {:controller => 'timelog', :action => 'destroy', :id => entry, :project_id => nil},
|
||||
:confirm => l(:text_are_you_sure),
|
||||
:method => :post,
|
||||
:title => l(:button_delete) %>
|
||||
<% end -%>
|
||||
</td>
|
||||
</tr>
|
||||
<% end -%>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,19 @@
|
||||
<% @hours.collect {|h| h[criterias[level]].to_s}.uniq.each do |value| %>
|
||||
<% hours_for_value = select_hours(hours, criterias[level], value) -%>
|
||||
<% next if hours_for_value.empty? -%>
|
||||
<tr class="<%= cycle('odd', 'even') %> <%= 'last-level' unless criterias.length > level+1 %>">
|
||||
<%= '<td></td>' * level %>
|
||||
<td><%= h(format_criteria_value(criterias[level], 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)); 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)}) %>
|
||||
<% end -%>
|
||||
|
||||
<% end %>
|
||||
@@ -0,0 +1,34 @@
|
||||
<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>
|
||||
|
||||
<%= render_timelog_breadcrumb %>
|
||||
|
||||
<h2><%= l(:label_spent_time) %></h2>
|
||||
|
||||
<% form_remote_tag( :url => {}, :method => :get, :update => 'content' ) do %>
|
||||
<%= hidden_field_tag 'project_id', params[:project_id] %>
|
||||
<%= hidden_field_tag 'issue_id', params[:issue_id] if @issue %>
|
||||
<%= render :partial => 'date_range' %>
|
||||
<% end %>
|
||||
|
||||
<div class="total-hours">
|
||||
<p><%= l(:label_total) %>: <%= html_hours(lwr(:label_f_hour, @total_hours)) %></p>
|
||||
</div>
|
||||
|
||||
<% unless @entries.empty? %>
|
||||
<%= render :partial => 'list', :locals => { :entries => @entries }%>
|
||||
<p class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></p>
|
||||
|
||||
<p class="other-formats">
|
||||
<%= l(:label_export_to) %>
|
||||
<span><%= link_to 'Atom', {:issue_id => @issue, :format => 'atom', :key => User.current.rss_key}, :class => 'feed' %></span>
|
||||
<span><%= link_to 'CSV', params.merge(:format => 'csv'), :class => 'csv' %></span>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<% html_title l(:label_spent_time), l(:label_details) %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= auto_discovery_link_tag(:atom, {:issue_id => @issue, :format => 'atom', :key => User.current.rss_key}, :title => l(:label_spent_time)) %>
|
||||
<% end %>
|
||||
@@ -0,0 +1,21 @@
|
||||
<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' %>
|
||||
<%= back_url_hidden_field_tag %>
|
||||
|
||||
<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 :comments, :size => 100 %></p>
|
||||
<p><%= f.select :activity_id, activity_collection_for_select_options, :required => true %></p>
|
||||
<% @time_entry.custom_field_values.each do |value| %>
|
||||
<p><%= custom_field_tag_with_label :time_entry, value %></p>
|
||||
<% end %>
|
||||
<%= call_hook(:view_timelog_edit_form_bottom, { :time_entry => @time_entry, :form => f }) %>
|
||||
</div>
|
||||
|
||||
<%= submit_tag l(:button_save) %>
|
||||
|
||||
<% end %>
|
||||
@@ -0,0 +1,74 @@
|
||||
<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>
|
||||
|
||||
<%= render_timelog_breadcrumb %>
|
||||
|
||||
<h2><%= l(:label_spent_time) %></h2>
|
||||
|
||||
<% form_remote_tag(:url => {}, :update => 'content') do %>
|
||||
<% @criterias.each do |criteria| %>
|
||||
<%= hidden_field_tag 'criterias[]', criteria, :id => nil %>
|
||||
<% end %>
|
||||
<%= hidden_field_tag 'project_id', params[:project_id] %>
|
||||
<%= render :partial => 'date_range' %>
|
||||
|
||||
<p><%= l(:label_details) %>: <%= select_tag 'columns', options_for_select([[l(:label_year), 'year'],
|
||||
[l(:label_month), 'month'],
|
||||
[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]}),
|
||||
:onchange => "this.form.onsubmit();",
|
||||
:style => 'width: 200px',
|
||||
:id => nil,
|
||||
:disabled => (@criterias.length >= 3)) %>
|
||||
<%= 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? %>
|
||||
<div class="total-hours">
|
||||
<p><%= l(:label_total) %>: <%= html_hours(lwr(:label_f_hour, @total_hours)) %></p>
|
||||
</div>
|
||||
|
||||
<% unless @hours.empty? %>
|
||||
<table class="list" id="time-report">
|
||||
<thead>
|
||||
<tr>
|
||||
<% @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="<%= columns_width %>%"><%= period %></th>
|
||||
<% end %>
|
||||
<th class="total" width="<%= columns_width %>%"><%= l(:label_total) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%= render :partial => 'report_criteria', :locals => {:criterias => @criterias, :hours => @hours, :level => 0} %>
|
||||
<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)); 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>
|
||||
|
||||
<p class="other-formats">
|
||||
<%= l(:label_export_to) %>
|
||||
<span><%= link_to 'CSV', params.merge({:format => 'csv'}), :class => 'csv' %></span>
|
||||
</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% html_title l(:label_spent_time), l(:label_report) %>
|
||||
|
||||
Reference in New Issue
Block a user