From bf8e2a208f543acdf912b26f6cd3fc737bf47150 Mon Sep 17 00:00:00 2001 From: zmagod Date: Wed, 21 Sep 2016 08:34:32 +0200 Subject: [PATCH] fixes restore experiment error [fixes SCI-464] --- app/controllers/experiments_controller.rb | 8 ++++++++ config/locales/en.yml | 1 + 2 files changed, 9 insertions(+) diff --git a/app/controllers/experiments_controller.rb b/app/controllers/experiments_controller.rb index ed5b37785..3f6701199 100644 --- a/app/controllers/experiments_controller.rb +++ b/app/controllers/experiments_controller.rb @@ -76,16 +76,24 @@ class ExperimentsController < ApplicationController @experiment.touch(:workflowimg_updated_at) flash[:success] = t('experiments.update.success_flash', experiment: @experiment.name) + respond_to do |format| format.json do render json: {}, status: :ok end + format.html do + redirect_to project_path(@experiment.project) + end end else + flash[:alert] = t('experiments.archive.restore_flash') respond_to do |format| format.json do render json: @experiment.errors, status: :unprocessable_entity end + format.html do + redirect_to :back + end end end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 03781ac3d..70ec8ebc8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -631,6 +631,7 @@ en: success_flash: "Successfully archived experiment %{experiment}" error_flash: 'Could not archive the experiment.' label_title: 'Archive' + restore_flash: 'Something went wrong try to restore the experiment later' clone: modal_title: 'Clone experiment %{experiment}' label_title: 'Clone'