Revision 912:5e80956cc792 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 => 'Form.Element.disable("from");Form.Element.disable("to");Form.Element.enable("period");', :id => "period_type_list"%>
7
<%= select_tag 'period', options_for_period_select(params[:period]),
8
                         :onchange => 'this.form.submit();',
9
                         :onfocus => '$("period_type_1").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 => 'Form.Element.enable("from");Form.Element.enable("to");Form.Element.disable("period");', :id => "period_type_interval" %>
15
<span onclick="$('period_type_2').checked = true;">
16
<%= l(:label_date_from_to,
17
        :start => ((label_tag "from", l(:description_date_from), :class => "hidden-for-sighted") + 
18
            text_field_tag('from', @from, :size => 10, :disabled => !@free_period) + calendar_for('from')),
19
        :end => ((label_tag "to", l(:description_date_to), :class => "hidden-for-sighted") +
20
            text_field_tag('to', @to, :size => 10, :disabled => !@free_period) + calendar_for('to'))) %>
21
</span>
22
</p>
23
</div>
24
</fieldset>
25
<p class="buttons">
26
  <%= link_to_function l(:button_apply), '$("query_form").submit()', :class => 'icon icon-checked' %>
27
  <%= link_to l(:button_clear), {:controller => controller_name, :action => action_name, :project_id => @project, :issue_id => @issue}, :class => 'icon icon-reload' %>
28
</p>
29

  
30
<div class="tabs">
31
<% url_params = @free_period ? { :from => @from, :to => @to } : { :period => params[:period] } %>
32
<ul>
33
    <li><%= link_to(l(:label_details), url_params.merge({:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue }),
34
                                       :class => (@controller.action_name == 'index' ? 'selected' : nil)) %></li>
35
    <li><%= link_to(l(:label_report), url_params.merge({:controller => 'time_entry_reports', :action => 'report', :project_id => @project, :issue_id => @issue}),
36
                                       :class => (@controller.action_name == 'report' ? 'selected' : nil)) %></li>
37
</ul>
38
</div>
app/views/timelog/_date_range.rhtml
1
<fieldset id="date-range" class="collapsible">
2
<legend onclick="toggleFieldset(this);"><%= l(:label_date_range) %></legend>
3
<div>
4
<p>
5
<%= radio_button_tag 'period_type', '1', !@free_period, :onclick => 'Form.Element.disable("from");Form.Element.disable("to");Form.Element.enable("period");' %>
6
<%= select_tag 'period', options_for_period_select(params[:period]),
7
                         :onchange => 'this.form.submit();',
8
                         :onfocus => '$("period_type_1").checked = true;',
9
                         :disabled => @free_period %>
10
</p>
11
<p>
12
<%= radio_button_tag 'period_type', '2', @free_period, :onclick => 'Form.Element.enable("from");Form.Element.enable("to");Form.Element.disable("period");' %>
13
<span onclick="$('period_type_2').checked = true;">
14
<%= l(:label_date_from_to, :start => (text_field_tag('from', @from, :size => 10, :disabled => !@free_period) + calendar_for('from')),
15
													 :end => (text_field_tag('to', @to, :size => 10, :disabled => !@free_period) + calendar_for('to'))) %>
16
</span>
17
</p>
18
</div>
19
</fieldset>
20
<p class="buttons">
21
	<%= link_to_function l(:button_apply), '$("query_form").submit()', :class => 'icon icon-checked' %>
22
  <%= link_to l(:button_clear), {:controller => controller_name, :action => action_name, :project_id => @project, :issue_id => @issue}, :class => 'icon icon-reload' %>
23
</p>
24

  
25
<div class="tabs">
26
<% url_params = @free_period ? { :from => @from, :to => @to } : { :period => params[:period] } %>
27
<ul>
28
    <li><%= link_to(l(:label_details), url_params.merge({:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue }),
29
                                       :class => (@controller.action_name == 'index' ? 'selected' : nil)) %></li>
30
    <li><%= link_to(l(:label_report), url_params.merge({:controller => 'time_entry_reports', :action => 'report', :project_id => @project, :issue_id => @issue}),
31
                                       :class => (@controller.action_name == 'report' ? 'selected' : nil)) %></li>
32
</ul>
33
</div>
app/views/timelog/_list.html.erb
1
<% form_tag({}) do -%>
2
<%= hidden_field_tag 'back_url', url_for(params) %>
3
<div class="autoscroll">
4
<table class="list time-entries">
5
<thead>
6
<tr>
7
<th class="checkbox hide-when-print">
8
  <%= link_to image_tag('toggle_check.png'),
9
    {},
10
    :onclick => 'toggleIssuesSelection(Element.up(this, "form")); 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>
22
</thead>
23
<tbody>
24
<% 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'), {:controller => 'timelog', :action => 'edit', :id => entry, :project_id => nil},
41
                                       :title => l(:button_edit) %>
42
    <%= link_to image_tag('delete.png'), {:controller => 'timelog', :action => 'destroy', :id => entry, :project_id => nil},
43
                                         :confirm => l(:text_are_you_sure),
44
                                         :method => :delete,
45
                                         :title => l(:button_delete) %>
46
<% end -%>
47
</td>
48
</tr>
49
<% end -%>
50
</tbody>
51
</table>
52
</div>
53
<% end -%>
54

  
55
<%= context_menu time_entries_context_menu_path %>
app/views/timelog/_list.rhtml
1
<% form_tag({}) do -%>	
2
<%= hidden_field_tag 'back_url', url_for(params) %>
3
<table class="list time-entries">
4
<thead>
5
<tr>
6
<th class="checkbox hide-when-print">
7
  <%= link_to image_tag('toggle_check.png'), 
8
    {}, 
9
    :onclick => 'toggleIssuesSelection(Element.up(this, "form")); return false;', 
10
    :title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
11
</th>
12
<%= sort_header_tag('spent_on', :caption => l(:label_date), :default_order => 'desc') %>
13
<%= sort_header_tag('user', :caption => l(:label_member)) %>
14
<%= sort_header_tag('activity', :caption => l(:label_activity)) %>
15
<%= sort_header_tag('project', :caption => l(:label_project)) %>
16
<%= sort_header_tag('issue', :caption => l(:label_issue), :default_order => 'desc') %>
17
<th><%= l(:field_comments) %></th>
18
<%= sort_header_tag('hours', :caption => l(:field_hours)) %>
19
<th></th>
20
</tr>
21
</thead>
22
<tbody>
23
<% entries.each do |entry| -%>
24
<tr class="time-entry <%= cycle("odd", "even") %> hascontextmenu">
25
<td class="checkbox hide-when-print"><%= check_box_tag("ids[]", entry.id, false, :id => nil) %></td>
26
<td class="spent_on"><%= format_date(entry.spent_on) %></td>
27
<td class="user"><%=h entry.user %></td>
28
<td class="activity"><%=h entry.activity %></td>
29
<td class="project"><%=h entry.project %></td>
30
<td class="subject">
31
<% if entry.issue -%>
32
<%= entry.issue.visible? ? link_to_issue(entry.issue, :truncate => 50) : "##{entry.issue.id}" -%>
33
<% end -%>
34
</td>
35
<td class="comments"><%=h entry.comments %></td>
36
<td class="hours"><%= html_hours("%.2f" % entry.hours) %></td>
37
<td align="center">
38
<% if entry.editable_by?(User.current) -%>
39
    <%= link_to image_tag('edit.png'), {:controller => 'timelog', :action => 'edit', :id => entry, :project_id => nil},
40
                                       :title => l(:button_edit) %>
41
    <%= link_to image_tag('delete.png'), {:controller => 'timelog', :action => 'destroy', :id => entry, :project_id => nil},
42
                                         :confirm => l(:text_are_you_sure),
43
                                         :method => :delete,
44
                                         :title => l(:button_delete) %>
45
<% end -%>
46
</td>
47
</tr>
48
<% end -%>
49
</tbody>
50
</table>
51
<% end -%>
52

  
53
<%= context_menu time_entries_context_menu_path %>
app/views/timelog/bulk_edit.html.erb
1
<h2><%= l(:label_bulk_edit_selected_time_entries) %></h2>
2

  
3
<ul><%= @time_entries.collect {|i| content_tag('li', link_to(h("#{i.spent_on.strftime("%Y-%m-%d")} -- #{i.project}:  #{l(:label_f_hour_plural, :value => i.hours)}"), { :action => 'edit', :id => i }))} %></ul>
4

  
5
<% form_tag(:action => 'bulk_update') do %>
6
<%= @time_entries.collect {|i| hidden_field_tag('ids[]', i.id)}.join %>
7
<div class="box tabular">
8
  <fieldset class="attributes">
9
  <legend><%= l(:label_change_properties) %></legend>
10
  <div>
11
    <p>
12
      <label><%= l(:field_issue) %></label>
13
      <%= text_field :time_entry, :issue_id, :size => 6 %>
14
    </p>
15

  
16
    <p>
17
      <label><%= l(:field_spent_on) %></label>
18
      <%= text_field :time_entry, :spent_on, :size => 10 %><%= calendar_for('time_entry_spent_on') %>
19
    </p>
20

  
21
    <p>
22
      <label><%= l(:field_hours) %></label>
23
      <%= text_field :time_entry, :hours, :size => 6 %>
24
    </p>
25

  
26
    <% if @available_activities.any? %>
27
    <p>
28
      <label><%= l(:field_activity) %></label>
29
      <%= select_tag('time_entry[activity_id]', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@available_activities, :id, :name)) %>
30
    </p>
31
    <% end %>
32

  
33
    <p>
34
      <label><%= l(:field_comments) %></label>
35
      <%= text_field(:time_entry, :comments, :size => 100) %>
36
    </p>
37

  
38
    <% @custom_fields.each do |custom_field| %>
39
      <p><label><%= h(custom_field.name) %></label> <%= custom_field_tag_for_bulk_edit('time_entry', custom_field, @projects) %></p>
40
    <% end %>
41

  
42
    <%= call_hook(:view_time_entries_bulk_edit_details_bottom, { :time_entries => @time_entries }) %>
43
  </div>
44

  
45
  </fieldset>
46
</div>
47

  
48
<p><%= submit_tag l(:button_submit) %></p>
49
<% end %>
app/views/timelog/bulk_edit.rhtml
1
<h2><%= l(:label_bulk_edit_selected_time_entries) %></h2>
2

  
3
<ul><%= @time_entries.collect {|i| content_tag('li', link_to(h("#{i.spent_on.strftime("%Y-%m-%d")} -- #{i.project}:  #{l(:label_f_hour_plural, :value => i.hours)}"), { :action => 'edit', :id => i }))} %></ul>
4

  
5
<% form_tag(:action => 'bulk_update') do %>
6
<%= @time_entries.collect {|i| hidden_field_tag('ids[]', i.id)}.join %>
7
<div class="box tabular">
8
  <fieldset class="attributes">
9
  <legend><%= l(:label_change_properties) %></legend>
10
  <div>
11
    <p>
12
      <label><%= l(:field_issue) %></label>
13
      <%= text_field :time_entry, :issue_id, :size => 6 %>
14
    </p>
15

  
16
    <p>
17
      <label><%= l(:field_spent_on) %></label>
18
      <%= text_field :time_entry, :spent_on, :size => 10 %><%= calendar_for('time_entry_spent_on') %>
19
    </p>
20

  
21
    <p>
22
      <label><%= l(:field_hours) %></label>
23
      <%= text_field :time_entry, :hours, :size => 6 %>
24
    </p>
25

  
26
    <% if @available_activities.any? %>
27
    <p>
28
      <label><%= l(:field_activity) %></label>
29
      <%= select_tag('time_entry[activity_id]', "<option value=\"\">#{l(:label_no_change_option)}</option>" + options_from_collection_for_select(@available_activities, :id, :name)) %>
30
    </p>
31
    <% end %>
32

  
33
    <p>
34
      <label><%= l(:field_comments) %></label>
35
      <%= text_field(:time_entry, :comments, :size => 100) %>
36
    </p>
37

  
38
    <% @custom_fields.each do |custom_field| %>
39
      <p><label><%= h(custom_field.name) %></label> <%= custom_field_tag_for_bulk_edit('time_entry', custom_field, @projects) %></p>
40
    <% end %>
41

  
42
    <%= call_hook(:view_time_entries_bulk_edit_details_bottom, { :time_entries => @time_entries }) %>
43
  </div>
44

  
45
  </fieldset>
46
</div>
47

  
48
<p><%= submit_tag l(:button_submit) %></p>
49
<% end %>
app/views/timelog/edit.html.erb
1
<h2><%= l(:label_spent_time) %></h2>
2

  
3
<% labelled_tabular_form_for(:time_entry, @time_entry, :url => {
4
                               :action => (@time_entry.new_record? ? 'create' : 'update'),
5
                               :id => @time_entry,
6
                               :project_id => @time_entry.project
7
                             },
8
                             :html => {:method => @time_entry.new_record? ? :post : :put}) do |f| %>
9
<%= error_messages_for 'time_entry' %>
10
<%= back_url_hidden_field_tag %>
11

  
12
<div class="box">
13
<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>
14
<p><%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
15
<p><%= f.text_field :hours, :size => 6, :required => true %></p>
16
<p><%= f.text_field :comments, :size => 100 %></p>
17
<p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p>
18
<% @time_entry.custom_field_values.each do |value| %>
19
  <p><%= custom_field_tag_with_label :time_entry, value %></p>
20
<% end %>
21
<%= call_hook(:view_timelog_edit_form_bottom, { :time_entry => @time_entry, :form => f }) %>
22
</div>
23

  
24
<%= submit_tag l(:button_save) %>
25

  
26
<% end %>
app/views/timelog/edit.rhtml
1
<h2><%= l(:label_spent_time) %></h2>
2

  
3
<% labelled_tabular_form_for(:time_entry, @time_entry, :url => {
4
                               :action => (@time_entry.new_record? ? 'create' : 'update'),
5
                               :id => @time_entry,
6
                               :project_id => @time_entry.project
7
                             },
8
                             :html => {:method => @time_entry.new_record? ? :post : :put}) do |f| %>
9
<%= error_messages_for 'time_entry' %>
10
<%= back_url_hidden_field_tag %>
11

  
12
<div class="box">
13
<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>
14
<p><%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p>
15
<p><%= f.text_field :hours, :size => 6, :required => true %></p>
16
<p><%= f.text_field :comments, :size => 100 %></p>
17
<p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p>
18
<% @time_entry.custom_field_values.each do |value| %>
19
	<p><%= custom_field_tag_with_label :time_entry, value %></p>
20
<% end %>
21
<%= call_hook(:view_timelog_edit_form_bottom, { :time_entry => @time_entry, :form => f }) %>
22
</div>
23

  
24
<%= submit_tag l(:button_save) %>
25

  
26
<% end %>
app/views/timelog/index.html.erb
19 19
<p class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></p>
20 20

  
21 21
<% other_formats_links do |f| %>
22
	<%= f.link_to 'Atom', :url => params.merge({:issue_id => @issue, :key => User.current.rss_key}) %>
23
	<%= f.link_to 'CSV', :url => params %>
22
  <%= f.link_to 'Atom', :url => params.merge({:issue_id => @issue, :key => User.current.rss_key}) %>
23
  <%= f.link_to 'CSV', :url => params %>
24 24
<% end %>
25 25
<% end %>
26 26

  

Also available in: Unified diff