mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-06 23:15:34 +08:00
Merge pull request #478 from Ducz0r/lm-sci-991-fix
Fix task restore action [SCI-991]
This commit is contained in:
commit
594a4f7950
2 changed files with 12 additions and 1 deletions
|
@ -138,6 +138,7 @@ class MyModulesController < ApplicationController
|
||||||
@my_module.last_modified_by = current_user
|
@my_module.last_modified_by = current_user
|
||||||
|
|
||||||
description_changed = @my_module.description_changed?
|
description_changed = @my_module.description_changed?
|
||||||
|
restored = false
|
||||||
|
|
||||||
if @my_module.archived_changed?(from: false, to: true)
|
if @my_module.archived_changed?(from: false, to: true)
|
||||||
saved = @my_module.archive(current_user)
|
saved = @my_module.archive(current_user)
|
||||||
|
@ -158,6 +159,7 @@ class MyModulesController < ApplicationController
|
||||||
elsif @my_module.archived_changed?(from: true, to: false)
|
elsif @my_module.archived_changed?(from: true, to: false)
|
||||||
saved = @my_module.restore(current_user)
|
saved = @my_module.restore(current_user)
|
||||||
if saved
|
if saved
|
||||||
|
restored = true
|
||||||
Activity.create(
|
Activity.create(
|
||||||
type_of: :restore_module,
|
type_of: :restore_module,
|
||||||
project: @my_module.experiment.project,
|
project: @my_module.experiment.project,
|
||||||
|
@ -189,7 +191,15 @@ class MyModulesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
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 {
|
format.json {
|
||||||
alerts = []
|
alerts = []
|
||||||
alerts << "alert-red" if @my_module.is_overdue?
|
alerts << "alert-red" if @my_module.is_overdue?
|
||||||
|
|
|
@ -451,6 +451,7 @@ en:
|
||||||
option_download: "Download"
|
option_download: "Download"
|
||||||
no_archived_results: "No archived results!"
|
no_archived_results: "No archived results!"
|
||||||
archive_timelabel: "archived on %{date}"
|
archive_timelabel: "archived on %{date}"
|
||||||
|
restored_flash: "Task %{module} restored successfully!"
|
||||||
module_header:
|
module_header:
|
||||||
start_date: "Start date:"
|
start_date: "Start date:"
|
||||||
due_date: "Due date:"
|
due_date: "Due date:"
|
||||||
|
|
Loading…
Reference in a new issue