@@ -18,8 +18,8 | |||
|
18 | 18 | class TimelogController < ApplicationController |
|
19 | 19 | menu_item :issues |
|
20 | 20 | before_filter :find_project, :only => [:new, :create] |
|
21 |
before_filter :find_time_entry, :only => [:show, :edit, :update |
|
|
22 | before_filter :find_time_entries, :only => [:bulk_edit, :bulk_update] | |
|
21 | before_filter :find_time_entry, :only => [:show, :edit, :update] | |
|
22 | before_filter :find_time_entries, :only => [:bulk_edit, :bulk_update, :destroy] | |
|
23 | 23 | before_filter :authorize, :except => [:index] |
|
24 | 24 | before_filter :find_optional_project, :only => [:index] |
|
25 | 25 | accept_key_auth :index, :show, :create, :update, :destroy |
@@ -180,30 +180,34 class TimelogController < ApplicationController | |||
|
180 | 180 | end |
|
181 | 181 | end |
|
182 | 182 | set_flash_from_bulk_time_entry_save(@time_entries, unsaved_time_entry_ids) |
|
183 | redirect_back_or_default({:controller => 'timelog', :action => 'index', :project_id => @project}) | |
|
183 | redirect_back_or_default({:controller => 'timelog', :action => 'index', :project_id => @projects.first}) | |
|
184 | 184 | end |
|
185 | 185 | |
|
186 | 186 | verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed } |
|
187 | 187 | def destroy |
|
188 | if @time_entry.destroy && @time_entry.destroyed? | |
|
189 | respond_to do |format| | |
|
190 | format.html { | |
|
191 | flash[:notice] = l(:notice_successful_delete) | |
|
192 | redirect_to :back | |
|
193 | } | |
|
194 | format.api { head :ok } | |
|
195 | end | |
|
196 | else | |
|
197 | respond_to do |format| | |
|
198 | format.html { | |
|
199 | flash[:error] = l(:notice_unable_delete_time_entry) | |
|
200 | redirect_to :back | |
|
201 | } | |
|
202 | format.api { render_validation_errors(@time_entry) } | |
|
188 | @time_entries.each do |t| | |
|
189 | begin | |
|
190 | unless t.destroy && t.destroyed? | |
|
191 | respond_to do |format| | |
|
192 | format.html { | |
|
193 | flash[:error] = l(:notice_unable_delete_time_entry) | |
|
194 | redirect_to :back | |
|
195 | } | |
|
196 | format.api { render_validation_errors(t) } | |
|
197 | end | |
|
198 | end | |
|
199 | rescue ::ActionController::RedirectBackError | |
|
200 | redirect_to :action => 'index', :project_id => @projects.first | |
|
203 | 201 | end |
|
204 | 202 | end |
|
205 | rescue ::ActionController::RedirectBackError | |
|
206 | redirect_to :action => 'index', :project_id => @time_entry.project | |
|
203 | ||
|
204 | respond_to do |format| | |
|
205 | format.html { | |
|
206 | flash[:notice] = l(:notice_successful_delete) | |
|
207 | redirect_back_or_default(:action => 'index', :project_id => @projects.first) | |
|
208 | } | |
|
209 | format.api { head :ok } | |
|
210 | end | |
|
207 | 211 | end |
|
208 | 212 | |
|
209 | 213 | private |
@@ -24,4 +24,10 | |||
|
24 | 24 | <% end %> |
|
25 | 25 | |
|
26 | 26 | <%= call_hook(:view_time_entries_context_menu_end, {:time_entries => @time_entries, :can => @can, :back => @back }) %> |
|
27 | ||
|
28 | <li> | |
|
29 | <%= context_menu_link l(:button_delete), | |
|
30 | {:controller => 'timelog', :action => 'destroy', :ids => @time_entries.collect(&:id), :back_url => @back}, | |
|
31 | :method => :delete, :confirm => l(:text_time_entries_destroy_confirmation), :class => 'icon-del', :disabled => !@can[:delete] %> | |
|
32 | </li> | |
|
27 | 33 | </ul> |
@@ -894,6 +894,7 en: | |||
|
894 | 894 | text_status_changed_by_changeset: "Applied in changeset %{value}." |
|
895 | 895 | text_time_logged_by_changeset: "Applied in changeset %{value}." |
|
896 | 896 | text_issues_destroy_confirmation: 'Are you sure you want to delete the selected issue(s)?' |
|
897 | text_time_entries_destroy_confirmation: 'Are you sure you want to delete the selected time entr(y/ies)?' | |
|
897 | 898 | text_select_project_modules: 'Select modules to enable for this project:' |
|
898 | 899 | text_default_administrator_account_changed: Default administrator account changed |
|
899 | 900 | text_file_repository_writable: Attachments directory writable |
General Comments 0
You need to be logged in to leave comments.
Login now