You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bulk_edit.html.erb 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <h2><%= l(:label_bulk_edit_selected_time_entries) %></h2>
  2. <% if @unsaved_time_entries.present? %>
  3. <div id="errorExplanation">
  4. <span>
  5. <%= l(:notice_failed_to_save_time_entries,
  6. :count => @unsaved_time_entries.size,
  7. :total => @saved_time_entries.size,
  8. :ids => @unsaved_time_entries.map {|i| "##{i.id}"}.join(', ')) %>
  9. </span>
  10. <ul>
  11. <% bulk_edit_error_messages(@unsaved_time_entries).each do |message| %>
  12. <li><%= message %></li>
  13. <% end %>
  14. </ul>
  15. </div>
  16. <% end %>
  17. <ul id="bulk-selection">
  18. <% @time_entries.each do |entry| %>
  19. <%= content_tag 'li',
  20. link_to("#{format_date(entry.spent_on)} - #{entry.project}: #{l(:label_f_hour_plural, :value => entry.hours)}", edit_time_entry_path(entry)) %>
  21. <% end %>
  22. </ul>
  23. <%= form_tag(bulk_update_time_entries_path, :id => 'bulk_edit_form') do %>
  24. <%= @time_entries.collect {|i| hidden_field_tag('ids[]', i.id, :id => nil)}.join.html_safe %>
  25. <div class="box tabular">
  26. <div>
  27. <p>
  28. <label><%= l(:field_project) %></label>
  29. <%= select_tag('time_entry[project_id]', project_tree_options_for_select(@target_projects,
  30. :include_blank => l(:label_no_change_option), :selected => @target_project),
  31. :onchange => "updateBulkEditFrom('#{escape_javascript url_for(:action => 'bulk_edit', :format => 'js')}')" ) %>
  32. </p>
  33. <p>
  34. <label for="time_entry_issue_id"><%= l(:field_issue) %></label>
  35. <%= text_field :time_entry, :issue_id, :size => 6 %>
  36. <label class="inline"><%= check_box_tag 'time_entry[issue_id]', 'none', (@time_entry_params[:issue_id] == 'none'), :id => nil, :data => {:disables => '#time_entry_issue_id'} %><%= l(:button_clear) %></label>
  37. <span id="time_entry_issue"></span>
  38. </p>
  39. <p>
  40. <label for="time_entry_spent_on"><%= l(:field_spent_on) %></label>
  41. <%= date_field :time_entry, :spent_on, :size => 10, :value => @time_entry_params[:spent_on] %><%= calendar_for('time_entry_spent_on') %>
  42. </p>
  43. <p>
  44. <label for="time_entry_hours"><%= l(:field_hours) %></label>
  45. <%= text_field :time_entry, :hours, :size => 6, :value => @time_entry_params[:hours] %>
  46. </p>
  47. <% if @available_activities.any? %>
  48. <p>
  49. <label for="time_entry_activity_id"><%= l(:field_activity) %></label>
  50. <%= select_tag('time_entry[activity_id]', content_tag('option', l(:label_no_change_option), :value => '') + options_from_collection_for_select(@available_activities, :id, :name, @time_entry_params[:activity_id])) %>
  51. </p>
  52. <% end %>
  53. <p>
  54. <label for="time_entry_comments"><%= l(:field_comments) %></label>
  55. <%= text_field(:time_entry, :comments, :size => 100, :value => @time_entry_params[:comments]) %>
  56. </p>
  57. <% @custom_fields.each do |custom_field| %>
  58. <p><label><%= h(custom_field.name) %></label> <%= custom_field_tag_for_bulk_edit('time_entry', custom_field, @time_entries, @time_entry_params[:custom_field_values][custom_field.id.to_s]) %></p>
  59. <% end %>
  60. <%= call_hook(:view_time_entries_bulk_edit_details_bottom, { :time_entries => @time_entries }) %>
  61. </div>
  62. </div>
  63. <p><%= submit_tag l(:button_submit) %></p>
  64. <% end %>
  65. <%= javascript_tag do %>
  66. $(document).ready(function(){
  67. $('#time_entry_project_id').change(function(){
  68. <!-- $('#time_entry_issue_id').val(''); -->
  69. $('#time_entry_issue').text('');
  70. });
  71. });
  72. <% if @project || @target_project %>
  73. observeAutocompleteField('time_entry_issue_id',
  74. function(request, callback) {
  75. var url = '<%= j auto_complete_issues_path %>';
  76. var data = {
  77. term: request.term
  78. };
  79. var project_id;
  80. <% if @project %>
  81. project_id = '<%= @project.id %>';
  82. <% end %>
  83. current_project_id = $('#time_entry_project_id').val();
  84. if(current_project_id === ''){
  85. data['project_id'] = project_id;
  86. } else {
  87. data['project_id'] = current_project_id;
  88. }
  89. $.get(url, data, null, 'json')
  90. .done(function(data){
  91. callback(data);
  92. })
  93. .fail(function(jqXHR, status, error){
  94. callback([]);
  95. });
  96. },
  97. {
  98. select: function(event, ui, data) {
  99. $('#time_entry_issue').text(ui.item.label);
  100. }
  101. }
  102. );
  103. <% end %>
  104. <% end %>