Revision 1298:4f746d8966dd app/views/timelog

View differences:

app/views/timelog/_date_range.html.erb
1
<fieldset id="date-range" class="collapsible">
2
<legend onclick="toggleFieldset(this);"><%= l(:label_date_range) %></legend>
3
<div>
4
<p>
5
<%= label_tag "period_type_list", l(:description_date_range_list), :class => "hidden-for-sighted" %>
6
<%= radio_button_tag 'period_type', '1', !@free_period, :onclick => '$("#from,#to").attr("disabled", true);$("#period").removeAttr("disabled");', :id => "period_type_list"%>
7
<%= select_tag 'period', options_for_period_select(params[:period]),
8
                         :onchange => 'this.form.submit();',
9
                         :onfocus => '$("#period_type_1").attr("checked", true);',
10
                         :disabled => @free_period %>
11
</p>
12
<p>
13
<%= label_tag "period_type_interval", l(:description_date_range_interval), :class => "hidden-for-sighted" %>
14
<%= radio_button_tag 'period_type', '2', @free_period, :onclick => '$("#from,#to").removeAttr("disabled");$("#period").attr("disabled", true);', :id => "period_type_interval" %>
15
<%= l(:label_date_from_to,
16
        :start => ((label_tag "from", l(:description_date_from), :class => "hidden-for-sighted") + 
17
            text_field_tag('from', @from, :size => 10, :disabled => !@free_period) + calendar_for('from')),
18
        :end => ((label_tag "to", l(:description_date_to), :class => "hidden-for-sighted") +
19
            text_field_tag('to', @to, :size => 10, :disabled => !@free_period) + calendar_for('to'))).html_safe %>
20
</p>
1
<div id="query_form_content" class="hide-when-print">
2
  <fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>">
3
    <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend>
4
    <div style="<%= @query.new_record? ? "" : "display: none;" %>">
5
      <%= render :partial => 'queries/filters', :locals => {:query => @query} %>
6
    </div>
7
  </fieldset>
8
  <fieldset class="collapsible collapsed">
9
    <legend onclick="toggleFieldset(this);"><%= l(:label_options) %></legend>
10
    <div style="display: none;">
11
      <table>
12
        <tr>
13
          <td><%= l(:field_column_names) %></td>
14
          <td><%= render_query_columns_selection(@query) %></td>
15
        </tr>
16
      </table>
17
    </div>
18
  </fieldset>
21 19
</div>
22
</fieldset>
23
<p class="buttons">
24
  <%= link_to_function l(:button_apply), '$("#query_form").submit()', :class => 'icon icon-checked' %>
25
  <%= link_to l(:button_clear), {:controller => controller_name, :action => action_name, :project_id => @project, :issue_id => @issue}, :class => 'icon icon-reload' %>
20

  
21
<p class="buttons hide-when-print">
22
  <%= link_to_function l(:button_apply), 'submit_query_form("query_form")', :class => 'icon icon-checked' %>
23
  <%= link_to l(:button_clear), {:project_id => @project, :issue_id => @issue}, :class => 'icon icon-reload'  %>
26 24
</p>
27 25

  
28 26
<div class="tabs">
29
<% url_params = @free_period ? { :from => @from, :to => @to } : { :period => params[:period] } %>
27
<% query_params = params.slice(:f, :op, :v, :sort) %>
30 28
<ul>
31
    <li><%= link_to(l(:label_details), url_params.merge({:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue }),
29
    <li><%= link_to(l(:label_details), query_params.merge({:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue }),
32 30
                                       :class => (action_name == 'index' ? 'selected' : nil)) %></li>
33
    <li><%= link_to(l(:label_report), url_params.merge({:controller => 'timelog', :action => 'report', :project_id => @project, :issue_id => @issue}),
31
    <li><%= link_to(l(:label_report), query_params.merge({:controller => 'timelog', :action => 'report', :project_id => @project, :issue_id => @issue}),
34 32
                                       :class => (action_name == 'report' ? 'selected' : nil)) %></li>
35 33
</ul>
36 34
</div>
37

  
38
<%= javascript_tag do %>
39
$('#from, #to').change(function(){
40
  $('#period_type_interval').attr('checked', true); $('#from,#to').removeAttr('disabled'); $('#period').attr('disabled', true);
41
});
42
<% end %>
app/views/timelog/_form.html.erb
2 2
<%= back_url_hidden_field_tag %>
3 3

  
4 4
<div class="box tabular">
5
	<% if @time_entry.new_record? %>
6
	  <% if params[:project_id] || @time_entry.issue %>
7
	    <%= f.hidden_field :project_id %>
8
	  <% else %>
9
	    <p><%= f.select :project_id, project_tree_options_for_select(Project.allowed_to(:log_time).all, :selected => @time_entry.project), :required => true %></p>
10
	  <% end %>
11
	<% end %>
12
	<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>
13
	<p><%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
14
	<p><%= f.text_field :hours, :size => 6, :required => true %></p>
15
	<p><%= f.text_field :comments, :size => 100, :maxlength => 255 %></p>
16
	<p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p>
17
	<% @time_entry.custom_field_values.each do |value| %>
18
	  <p><%= custom_field_tag_with_label :time_entry, value %></p>
19
	<% end %>
20
	<%= call_hook(:view_timelog_edit_form_bottom, { :time_entry => @time_entry, :form => f }) %>
5
  <% if @time_entry.new_record? %>
6
    <% if params[:project_id] || @time_entry.issue %>
7
      <%= f.hidden_field :project_id %>
8
    <% else %>
9
      <p><%= f.select :project_id, project_tree_options_for_select(Project.allowed_to(:log_time).all, :selected => @time_entry.project), :required => true %></p>
10
    <% end %>
11
  <% end %>
12
  <p>
13
    <%= f.text_field :issue_id, :size => 6 %>
14
    <span id="time_entry_issue"><%= h("#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}") if @time_entry.issue %></span>
15
  </p>
16
  <p><%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
17
  <p><%= f.text_field :hours, :size => 6, :required => true %></p>
18
  <p><%= f.text_field :comments, :size => 100, :maxlength => 255 %></p>
19
  <p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p>
20
  <% @time_entry.custom_field_values.each do |value| %>
21
    <p><%= custom_field_tag_with_label :time_entry, value %></p>
22
  <% end %>
23
  <%= call_hook(:view_timelog_edit_form_bottom, { :time_entry => @time_entry, :form => f }) %>
21 24
</div>
22 25

  
23
<%= javascript_tag "observeAutocompleteField('time_entry_issue_id', '#{escape_javascript auto_complete_issues_path(:project_id => @project, :scope => (@project ? nil : 'all'))}')" %>
26
<%= javascript_tag do %>
27
  observeAutocompleteField('time_entry_issue_id', '<%= escape_javascript auto_complete_issues_path(:project_id => @project, :scope => (@project ? nil : 'all'))%>', {
28
    select: function(event, ui) {
29
      $('#time_entry_issue').text(ui.item.label);
30
    }
31
  });
32
<% end %>
app/views/timelog/_list.html.erb
3 3
<div class="autoscroll">
4 4
<table class="list time-entries">
5 5
<thead>
6
<tr>
7
<th class="checkbox hide-when-print">
8
  <%= link_to image_tag('toggle_check.png'),
9
    {},
10
    :onclick => 'toggleIssuesSelection(this); return false;',
11
    :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
12
</th>
13
<%= sort_header_tag('spent_on', :caption => l(:label_date), :default_order => 'desc') %>
14
<%= sort_header_tag('user', :caption => l(:label_member)) %>
15
<%= sort_header_tag('activity', :caption => l(:label_activity)) %>
16
<%= sort_header_tag('project', :caption => l(:label_project)) %>
17
<%= sort_header_tag('issue', :caption => l(:label_issue), :default_order => 'desc') %>
18
<th><%= l(:field_comments) %></th>
19
<%= sort_header_tag('hours', :caption => l(:field_hours)) %>
20
<th></th>
21
</tr>
6
  <tr>
7
    <th class="checkbox hide-when-print">
8
      <%= link_to image_tag('toggle_check.png'),
9
        {},
10
        :onclick => 'toggleIssuesSelection(this); return false;',
11
        :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
12
    </th>
13
    <% @query.inline_columns.each do |column| %>
14
      <%= column_header(column) %>
15
    <% end %>
16
    <th></th>
17
  </tr>
22 18
</thead>
23 19
<tbody>
24 20
<% entries.each do |entry| -%>
25
<tr class="time-entry <%= cycle("odd", "even") %> hascontextmenu">
26
<td class="checkbox hide-when-print"><%= check_box_tag("ids[]", entry.id, false, :id => nil) %></td>
27
<td class="spent_on"><%= format_date(entry.spent_on) %></td>
28
<td class="user"><%= link_to_user(entry.user) %></td>
29
<td class="activity"><%=h entry.activity %></td>
30
<td class="project"><%= link_to_project(entry.project) %></td>
31
<td class="subject">
32
<% if entry.issue -%>
33
<%= entry.issue.visible? ? link_to_issue(entry.issue, :truncate => 50) : "##{entry.issue.id}" -%>
34
<% end -%>
35
</td>
36
<td class="comments"><%=h entry.comments %></td>
37
<td class="hours"><%= html_hours("%.2f" % entry.hours) %></td>
38
<td align="center">
39
<% if entry.editable_by?(User.current) -%>
40
    <%= link_to image_tag('edit.png'), edit_time_entry_path(entry),
41
                                       :title => l(:button_edit) %>
42
    <%= link_to image_tag('delete.png'), time_entry_path(entry),
43
                                         :data => {:confirm => l(:text_are_you_sure)},
44
                                         :method => :delete,
45
                                         :title => l(:button_delete) %>
46
<% end -%>
47
</td>
48
</tr>
21
  <tr class="time-entry <%= cycle("odd", "even") %> hascontextmenu">
22
    <td class="checkbox hide-when-print"><%= check_box_tag("ids[]", entry.id, false, :id => nil) %></td>
23
    <%= raw @query.inline_columns.map {|column| "<td class=\"#{column.css_classes}\">#{column_content(column, entry)}</td>"}.join %>
24
    <td align="center">
25
    <% if entry.editable_by?(User.current) -%>
26
        <%= link_to image_tag('edit.png'), edit_time_entry_path(entry),
27
                                           :title => l(:button_edit) %>
28
        <%= link_to image_tag('delete.png'), time_entry_path(entry),
29
                                             :data => {:confirm => l(:text_are_you_sure)},
30
                                             :method => :delete,
31
                                             :title => l(:button_delete) %>
32
    <% end -%>
33
    </td>
34
  </tr>
49 35
<% end -%>
50 36
</tbody>
51 37
</table>
app/views/timelog/bulk_edit.html.erb
1 1
<h2><%= l(:label_bulk_edit_selected_time_entries) %></h2>
2 2

  
3
<ul>
4
<%= @time_entries.collect {|i| content_tag('li', 
5
        link_to(h("#{i.spent_on.strftime("%Y-%m-%d")} - #{i.project}:  #{l(:label_f_hour_plural, :value => i.hours)}"),
6
                { :action => 'edit', :id => i })
7
     )}.join("\n").html_safe %>
3
<ul id="bulk-selection">
4
<% @time_entries.each do |entry| %>
5
  <%= content_tag 'li',
6
        link_to("#{format_date(entry.spent_on)} - #{entry.project}: #{l(:label_f_hour_plural, :value => entry.hours)}", edit_time_entry_path(entry)) %>
7
<% end %>
8 8
</ul>
9 9

  
10
<%= form_tag(:action => 'bulk_update') do %>
10
<%= form_tag(bulk_update_time_entries_path, :id => 'bulk_edit_form') do %>
11 11
<%= @time_entries.collect {|i| hidden_field_tag('ids[]', i.id)}.join.html_safe %>
12 12
<div class="box tabular">
13 13
  <div>
app/views/timelog/index.html.erb
13 13
<% end %>
14 14

  
15 15
<div class="total-hours">
16
<p><%= l(:label_total) %>: <%= html_hours(l_hours(@total_hours)) %></p>
16
<p><%= l(:label_total_time) %>: <%= html_hours(l_hours(@total_hours)) %></p>
17 17
</div>
18 18

  
19 19
<% unless @entries.empty? %>
......
22 22

  
23 23
<% other_formats_links do |f| %>
24 24
  <%= f.link_to 'Atom', :url => params.merge({:issue_id => @issue, :key => User.current.rss_key}) %>
25
  <%= f.link_to 'CSV', :url => params %>
25
  <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %>
26 26
<% end %>
27

  
28
<div id="csv-export-options" style="display:none;">
29
  <h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>
30
  <%= form_tag(params.slice(:project_id, :issue_id).merge(:format => 'csv', :page=>nil), :method => :get, :id => 'csv-export-form') do %>
31
  <%= query_hidden_tags @query %>
32
  <p>
33
    <label><%= radio_button_tag 'columns', '', true %> <%= l(:description_selected_columns) %></label><br />
34
    <label><%= radio_button_tag 'columns', 'all' %> <%= l(:description_all_columns) %></label>
35
  </p>
36
  <p class="buttons">
37
    <%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);" %>
38
    <%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %>
39
  </p>
40
  <% end %>
41
</div>
27 42
<% end %>
28 43

  
29 44
<% html_title l(:label_spent_time), l(:label_details) %>
app/views/timelog/report.html.erb
30 30

  
31 31
<% unless @report.criteria.empty? %>
32 32
<div class="total-hours">
33
<p><%= l(:label_total) %>: <%= html_hours(l_hours(@report.total_hours)) %></p>
33
<p><%= l(:label_total_time) %>: <%= html_hours(l_hours(@report.total_hours)) %></p>
34 34
</div>
35 35

  
36 36
<% unless @report.hours.empty? %>
......
45 45
<% @report.periods.each do |period| %>
46 46
  <th class="period" width="<%= columns_width %>%"><%= period %></th>
47 47
<% end %>
48
  <th class="total" width="<%= columns_width %>%"><%= l(:label_total) %></th>
48
  <th class="total" width="<%= columns_width %>%"><%= l(:label_total_time) %></th>
49 49
</tr>
50 50
</thead>
51 51
<tbody>
52 52
<%= render :partial => 'report_criteria', :locals => {:criterias => @report.criteria, :hours => @report.hours, :level => 0} %>
53 53
  <tr class="total">
54
  <td><%= l(:label_total) %></td>
54
  <td><%= l(:label_total_time) %></td>
55 55
  <%= ('<td></td>' * (@report.criteria.size - 1)).html_safe %>
56 56
  <% total = 0 -%>
57 57
  <% @report.periods.each do |period| -%>

Also available in: Unified diff