diff options
| author | Teddy Wing | 2017-12-18 17:23:04 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2017-12-18 17:35:57 +0100 | 
| commit | 1b690a6dbd7175eb29e543246a057e4a868974cd (patch) | |
| tree | 31994add59c03612940eae78726e7a29b67034a7 | |
| parent | 5ecfe32c539527017ab03b96b4a14b1daccac54c (diff) | |
| download | chouette-core-1b690a6dbd7175eb29e543246a057e4a868974cd.tar.bz2 | |
Referentials#create: Add flash message on referential duplication
When a "duplicate referential" action is initiated, show a flash message
to let users know that it started and is in progress (and will take a
while since it's an asynchronous task).
Refs #5317
| -rw-r--r-- | app/controllers/referentials_controller.rb | 2 | ||||
| -rw-r--r-- | config/locales/referentials.en.yml | 1 | ||||
| -rw-r--r-- | config/locales/referentials.fr.yml | 1 | ||||
| -rw-r--r-- | spec/controllers/referentials_controller_spec.rb | 17 | 
4 files changed, 21 insertions, 0 deletions
| diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb index 773de04fd..40e8264ce 100644 --- a/app/controllers/referentials_controller.rb +++ b/app/controllers/referentials_controller.rb @@ -17,6 +17,8 @@ class ReferentialsController < ChouetteController        build_referenial        if !!@referential.created_from_id +        flash[:notice] = t('notice.referentials.duplicate') +          format.html { redirect_to workbench_path(@referential.workbench) }        end      end diff --git a/config/locales/referentials.en.yml b/config/locales/referentials.en.yml index f3a9cdfd1..f41e35446 100644 --- a/config/locales/referentials.en.yml +++ b/config/locales/referentials.en.yml @@ -125,6 +125,7 @@ en:    notice:      referentials:        deleted: "Datasets has been successfully destroyed" +      duplicate: "The duplication is in progress. Please wait and refresh the page in a few moments."        validate: "The validation is in progress. Please wait and refresh the page in a few moments."      referential:        archived: "The data space has been successfully archived" diff --git a/config/locales/referentials.fr.yml b/config/locales/referentials.fr.yml index 7f986ed93..9250a033c 100644 --- a/config/locales/referentials.fr.yml +++ b/config/locales/referentials.fr.yml @@ -123,6 +123,7 @@ fr:    notice:      referentials:        deleted: "Les jeux de données on été supprimés" +      duplicate: "La duplication est en cours, veuillez patienter. Actualiser votre page si vous voulez voir l'avancement de votre traitement."        validate: "La validation est en cours, veuillez patienter. Actualiser votre page si vous voulez voir l'avancement de votre traitement."      referential:        archived: "Le jeu de données a été correctement conservé" diff --git a/spec/controllers/referentials_controller_spec.rb b/spec/controllers/referentials_controller_spec.rb index dad2b3c8f..4050a8812 100644 --- a/spec/controllers/referentials_controller_spec.rb +++ b/spec/controllers/referentials_controller_spec.rb @@ -42,4 +42,21 @@ describe ReferentialsController, :type => :controller do        )      end    end + +  describe "POST #create" do +    context "when duplicating" do +      it "displays a flash message" do +        post :create, +          from: referential.id, +          current_workbench_id: referential.workbench_id, +          referential: { +            name: 'Duplicated' +          } + +        expect(controller).to set_flash[:notice].to( +          I18n.t('notice.referentials.duplicate') +        ) +      end +    end +  end  end | 
