@@ -1,49 +1,49 | |||||
1 | <%= error_messages_for 'time_entry' %> |
|
1 | <%= error_messages_for 'time_entry' %> | |
2 | <%= back_url_hidden_field_tag %> |
|
2 | <%= back_url_hidden_field_tag %> | |
3 |
|
3 | |||
4 | <div class="box tabular"> |
|
4 | <div class="box tabular"> | |
5 | <% if @time_entry.new_record? %> |
|
5 | <% if @time_entry.new_record? %> | |
6 | <% if params[:project_id] %> |
|
6 | <% if params[:project_id] %> | |
7 | <%= hidden_field_tag 'project_id', params[:project_id] %> |
|
7 | <%= hidden_field_tag 'project_id', params[:project_id] %> | |
8 | <% elsif params[:issue_id] %> |
|
8 | <% elsif params[:issue_id] %> | |
9 | <%= hidden_field_tag 'issue_id', params[:issue_id] %> |
|
9 | <%= hidden_field_tag 'issue_id', params[:issue_id] %> | |
10 | <% else %> |
|
10 | <% else %> | |
11 | <p><%= f.select :project_id, project_tree_options_for_select(Project.allowed_to(:log_time).to_a, :selected => @time_entry.project, :include_blank => true) %></p> |
|
11 | <p><%= f.select :project_id, project_tree_options_for_select(Project.allowed_to(:log_time).to_a, :selected => @time_entry.project, :include_blank => true), :required => true %></p> | |
12 | <% end %> |
|
12 | <% end %> | |
13 | <% end %> |
|
13 | <% end %> | |
14 | <p> |
|
14 | <p> | |
15 | <%= f.text_field :issue_id, :size => 6 %> |
|
15 | <%= f.text_field :issue_id, :size => 6 %> | |
16 | <% if @time_entry.issue.try(:visible?) %> |
|
16 | <% if @time_entry.issue.try(:visible?) %> | |
17 | <span id="time_entry_issue"><%= "#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}" %></span> |
|
17 | <span id="time_entry_issue"><%= "#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}" %></span> | |
18 | <% end %> |
|
18 | <% end %> | |
19 | </p> |
|
19 | </p> | |
20 | <p><%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p> |
|
20 | <p><%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p> | |
21 | <p><%= f.text_field :hours, :size => 6, :required => true %></p> |
|
21 | <p><%= f.text_field :hours, :size => 6, :required => true %></p> | |
22 | <p><%= f.text_field :comments, :size => 100, :maxlength => 1024 %></p> |
|
22 | <p><%= f.text_field :comments, :size => 100, :maxlength => 1024 %></p> | |
23 | <p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p> |
|
23 | <p><%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %></p> | |
24 | <% @time_entry.custom_field_values.each do |value| %> |
|
24 | <% @time_entry.custom_field_values.each do |value| %> | |
25 | <p><%= custom_field_tag_with_label :time_entry, value %></p> |
|
25 | <p><%= custom_field_tag_with_label :time_entry, value %></p> | |
26 | <% end %> |
|
26 | <% end %> | |
27 | <%= call_hook(:view_timelog_edit_form_bottom, { :time_entry => @time_entry, :form => f }) %> |
|
27 | <%= call_hook(:view_timelog_edit_form_bottom, { :time_entry => @time_entry, :form => f }) %> | |
28 | </div> |
|
28 | </div> | |
29 |
|
29 | |||
30 | <%= javascript_tag do %> |
|
30 | <%= javascript_tag do %> | |
31 | <% if @time_entry.new_record? %> |
|
31 | <% if @time_entry.new_record? %> | |
32 | $(document).ready(function(){ |
|
32 | $(document).ready(function(){ | |
33 | $('#time_entry_project_id, #time_entry_issue_id').change(function(){ |
|
33 | $('#time_entry_project_id, #time_entry_issue_id').change(function(){ | |
34 | $.ajax({ |
|
34 | $.ajax({ | |
35 | url: '<%= escape_javascript new_time_entry_path(:format => 'js') %>', |
|
35 | url: '<%= escape_javascript new_time_entry_path(:format => 'js') %>', | |
36 | type: 'post', |
|
36 | type: 'post', | |
37 | data: $('#new_time_entry').serialize() |
|
37 | data: $('#new_time_entry').serialize() | |
38 | }); |
|
38 | }); | |
39 | }); |
|
39 | }); | |
40 | }); |
|
40 | }); | |
41 | <% end %> |
|
41 | <% end %> | |
42 |
|
42 | |||
43 | observeAutocompleteField('time_entry_issue_id', '<%= escape_javascript auto_complete_issues_path(:project_id => @project, :scope => (@project ? nil : 'all'))%>', { |
|
43 | observeAutocompleteField('time_entry_issue_id', '<%= escape_javascript auto_complete_issues_path(:project_id => @project, :scope => (@project ? nil : 'all'))%>', { | |
44 | select: function(event, ui) { |
|
44 | select: function(event, ui) { | |
45 | $('#time_entry_issue').text(ui.item.label); |
|
45 | $('#time_entry_issue').text(ui.item.label); | |
46 | $('#time_entry_issue_id').blur(); |
|
46 | $('#time_entry_issue_id').blur(); | |
47 | } |
|
47 | } | |
48 | }); |
|
48 | }); | |
49 | <% end %> |
|
49 | <% end %> |
General Comments 0
You need to be logged in to leave comments.
Login now