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