diff --git a/app/controllers/my_modules_controller.rb b/app/controllers/my_modules_controller.rb index 38be3a7ae..4a5109a91 100644 --- a/app/controllers/my_modules_controller.rb +++ b/app/controllers/my_modules_controller.rb @@ -138,6 +138,7 @@ class MyModulesController < ApplicationController @my_module.last_modified_by = current_user description_changed = @my_module.description_changed? + restored = false if @my_module.archived_changed?(from: false, to: true) saved = @my_module.archive(current_user) @@ -158,6 +159,7 @@ class MyModulesController < ApplicationController elsif @my_module.archived_changed?(from: true, to: false) saved = @my_module.restore(current_user) if saved + restored = true Activity.create( type_of: :restore_module, project: @my_module.experiment.project, @@ -189,7 +191,15 @@ class MyModulesController < ApplicationController end respond_to do |format| - if saved + if restored + format.html do + flash[:success] = t( + 'my_modules.module_archive.restored_flash', + module: @my_module.name + ) + redirect_to module_archive_experiment_path(@my_module.experiment) + end + elsif saved format.json { alerts = [] alerts << "alert-red" if @my_module.is_overdue? diff --git a/config/locales/en.yml b/config/locales/en.yml index a587483b3..a5d7b7794 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -451,6 +451,7 @@ en: option_download: "Download" no_archived_results: "No archived results!" archive_timelabel: "archived on %{date}" + restored_flash: "Task %{module} restored successfully!" module_header: start_date: "Start date:" due_date: "Due date:"