From 6005dccc2ba242110d8f185d2bd1af32fac805b3 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Wed, 25 May 2016 14:08:02 +0200 Subject: [PATCH] Delete Archive feature for User on his Dossier --- app/controllers/users/dossiers_controller.rb | 12 -------- app/views/users/recapitulatif/show.html.haml | 13 -------- .../users/dossiers_controller_spec.rb | 30 ------------------- 3 files changed, 55 deletions(-) diff --git a/app/controllers/users/dossiers_controller.rb b/app/controllers/users/dossiers_controller.rb index 4dfe343fe..3faaad661 100644 --- a/app/controllers/users/dossiers_controller.rb +++ b/app/controllers/users/dossiers_controller.rb @@ -84,18 +84,6 @@ class Users::DossiersController < UsersController end end - def archive - dossier = current_user.dossiers.find(params[:dossier_id]) - dossier.update_attributes({archived: true}) - - flash.notice = 'Dossier archivé' - redirect_to users_dossiers_path - - rescue ActiveRecord::RecordNotFound - flash.alert = 'Dossier inéxistant' - redirect_to users_dossiers_path - end - def self.route_authorization { states: [:draft] diff --git a/app/views/users/recapitulatif/show.html.haml b/app/views/users/recapitulatif/show.html.haml index 723c254aa..6a998be36 100644 --- a/app/views/users/recapitulatif/show.html.haml +++ b/app/views/users/recapitulatif/show.html.haml @@ -3,19 +3,6 @@ .row .col-md-6.col-lg-6 %h2 Récapitulatif - .col-md-6.col-lg-6 - - if current_user.email == @facade.dossier.user.email - = form_tag "/users/dossiers/#{@facade.dossier.id}/archive", style:'margin-top:21px', action: :archive, method: :put do - %button#archive.btn.btn-sm.btn-default.text-info{type: :button} - %i.fa.fa-eraser - Archiver - #confirm - %button#cancel.btn.btn-sm.btn-danger{type: :button} - %i.fa.fa-remove - Annuler - %button#valid.btn.btn-sm.btn-success{type: :submit} - %i.fa.fa-check - Valider .col-md-5.col-lg-5 diff --git a/spec/controllers/users/dossiers_controller_spec.rb b/spec/controllers/users/dossiers_controller_spec.rb index 7630eb94c..f996114da 100644 --- a/spec/controllers/users/dossiers_controller_spec.rb +++ b/spec/controllers/users/dossiers_controller_spec.rb @@ -288,36 +288,6 @@ describe Users::DossiersController, type: :controller do end end - describe 'PUT #archive' do - let(:dossier) { create(:dossier, user: user) } - - context 'when user is the owner of the file' do - before do - sign_in user - put :archive, dossier_id: dossier.id - dossier.reload - end - - it { expect(dossier.archived).to be_truthy } - it { expect(response).to redirect_to :users_dossiers } - it { expect(flash[:notice]).to have_content 'Dossier archivé' } - end - - context 'when user is not the owner of the file' do - let(:user_2) { create(:user) } - - before do - sign_in user_2 - - put :archive, dossier_id: dossier.id - procedure.reload - end - - it { expect(response).to redirect_to :users_dossiers } - it { expect(flash[:alert]).to have_content 'Dossier inéxistant' } - end - end - describe 'GET #a_traiter' do context 'when user is connected' do before do