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.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. <%=
  20. content_tag 'li',
  21. link_to(
  22. "#{format_date(entry.spent_on)} - #{entry.project}: #{l(:label_f_hour_plural, :value => entry.hours)} (#{entry.user})",
  23. edit_time_entry_path(entry)
  24. )
  25. %>
  26. <% end %>
  27. </ul>
  28. <%= form_tag(bulk_update_time_entries_path, :id => 'bulk_edit_form') do %>
  29. <%= @time_entries.collect {|i| hidden_field_tag('ids[]', i.id, :id => nil)}.join.html_safe %>
  30. <div class="box tabular">
  31. <div>
  32. <p>
  33. <label><%= l(:field_project) %></label>
  34. <%= select_tag('time_entry[project_id]', project_tree_options_for_select(@target_projects,
  35. :include_blank => l(:label_no_change_option), :selected => @target_project),
  36. :onchange => "updateBulkEditFrom('#{escape_javascript url_for(:action => 'bulk_edit', :format => 'js')}')" ) %>
  37. </p>
  38. <p>
  39. <label for="time_entry_issue_id"><%= l(:field_issue) %></label>
  40. <%= text_field :time_entry, :issue_id, :size => 6 %>
  41. <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>
  42. <span id="time_entry_issue"></span>
  43. </p>
  44. <p>
  45. <label for="time_entry_spent_on"><%= l(:field_spent_on) %></label>
  46. <%= date_field :time_entry, :spent_on, :size => 10, :value => @time_entry_params[:spent_on] %><%= calendar_for('time_entry_spent_on') %>
  47. </p>
  48. <p>
  49. <label for="time_entry_hours"><%= l(:field_hours) %></label>
  50. <%= text_field :time_entry, :hours, :size => 6, :value => @time_entry_params[:hours] %>
  51. </p>
  52. <% if @available_activities.any? %>
  53. <p>
  54. <label for="time_entry_activity_id"><%= l(:field_activity) %></label>
  55. <%= 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])) %>
  56. </p>
  57. <% end %>
  58. <p>
  59. <label for="time_entry_comments"><%= l(:field_comments) %></label>
  60. <%= text_field(:time_entry, :comments, :size => 100, :value => @time_entry_params[:comments]) %>
  61. </p>
  62. <% @custom_fields.each do |custom_field| %>
  63. <p>
  64. <label><%= h(custom_field.name) %></label>
  65. <%= custom_field_tag_for_bulk_edit('time_entry', custom_field, @time_entries, @time_entry_params[:custom_field_values][custom_field.id.to_s]) %>
  66. </p>
  67. <%= wikitoolbar_for "time_entry_custom_field_values_#{custom_field.id}", preview_issue_path(:project_id => @project) if custom_field.full_text_formatting? %>
  68. <% end %>
  69. <%= call_hook(:view_time_entries_bulk_edit_details_bottom, { :time_entries => @time_entries }) %>
  70. </div>
  71. </div>
  72. <p><%= submit_tag l(:button_submit) %></p>
  73. <% end %>
  74. <%= javascript_tag do %>
  75. $(document).ready(function(){
  76. $('#time_entry_project_id').change(function(){
  77. <!-- $('#time_entry_issue_id').val(''); -->
  78. $('#time_entry_issue').text('');
  79. });
  80. });
  81. <% if @project || @target_project %>
  82. observeAutocompleteField('time_entry_issue_id',
  83. function(request, callback) {
  84. var url = '<%= j auto_complete_issues_path %>';
  85. var data = {
  86. term: request.term
  87. };
  88. var project_id;
  89. <% if @project %>
  90. project_id = '<%= @project.id %>';
  91. <% end %>
  92. current_project_id = $('#time_entry_project_id').val();
  93. if(current_project_id === ''){
  94. data['project_id'] = project_id;
  95. } else {
  96. data['project_id'] = current_project_id;
  97. }
  98. $.get(url, data, null, 'json')
  99. .done(function(data){
  100. callback(data);
  101. })
  102. .fail(function(jqXHR, status, error){
  103. callback([]);
  104. });
  105. },
  106. {
  107. select: function(event, ui, data) {
  108. $('#time_entry_issue').text(ui.item.label);
  109. }
  110. }
  111. );
  112. <% end %>
  113. <% end %>