diff --git a/app/controllers/users/dossiers/invites_controller.rb b/app/controllers/users/dossiers/invites_controller.rb index abdf89609..56ca6497d 100644 --- a/app/controllers/users/dossiers/invites_controller.rb +++ b/app/controllers/users/dossiers/invites_controller.rb @@ -8,7 +8,7 @@ class Users::Dossiers::InvitesController < UsersController end def show - @facade = InviteDossierFacades.new params[:id], current_user.email + @facade = InviteDossierFacades.new params[:id].to_i, current_user.email render 'users/recapitulatif/show' rescue ActiveRecord::RecordNotFound diff --git a/app/facades/invite_dossier_facades.rb b/app/facades/invite_dossier_facades.rb index cda91257e..3c2a8086f 100644 --- a/app/facades/invite_dossier_facades.rb +++ b/app/facades/invite_dossier_facades.rb @@ -1,7 +1,7 @@ class InviteDossierFacades < DossierFacades #TODO rechercher en fonction de la personne/email - def initialize dossier_id, email - @dossier = Invite.where(email: email, dossier_id: dossier_id).first!.dossier + def initialize id, email + @dossier = Invite.where(email: email, id: id).first!.dossier end end \ No newline at end of file diff --git a/app/views/backoffice/commentaires/_commentaire.html.haml b/app/views/dossiers/_commentaire.html.haml similarity index 100% rename from app/views/backoffice/commentaires/_commentaire.html.haml rename to app/views/dossiers/_commentaire.html.haml diff --git a/app/views/dossiers/_dossier_show.html.haml b/app/views/dossiers/_dossier_show.html.haml index 3c1da4f2f..e8681b45d 100644 --- a/app/views/dossiers/_dossier_show.html.haml +++ b/app/views/dossiers/_dossier_show.html.haml @@ -16,7 +16,7 @@ - unless @facade.commentaires.empty? %div.commentaires - @facade.commentaires.object.sort.each do |commentaire| - = render partial: commentaire + = render partial: 'dossiers/commentaire', locals: {commentaire: commentaire} .row .col-lg-12.col-md-12.col-sm-12.col-xs-12 %div.split-hr diff --git a/app/views/layouts/left_panels/_left_panel_users_dossiers_invitescontroller_show.html.haml b/app/views/layouts/left_panels/_left_panel_users_dossiers_invitescontroller_show.html.haml new file mode 100644 index 000000000..4b47b5093 --- /dev/null +++ b/app/views/layouts/left_panels/_left_panel_users_dossiers_invitescontroller_show.html.haml @@ -0,0 +1 @@ += render partial: 'layouts/left_panels/left_panel_users_recapitulatifcontroller_show' \ No newline at end of file diff --git a/app/views/layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.html.haml b/app/views/layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.html.haml index 23397d47d..e95e34455 100644 --- a/app/views/layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.html.haml +++ b/app/views/layouts/left_panels/_left_panel_users_recapitulatifcontroller_show.html.haml @@ -12,7 +12,6 @@ %div#menu-block %div#infos-block - - if user_signed_in? && current_user.email == @facade.dossier.user.email - %div.split-hr-left - %div.dossier-state= @facade.dossier.display_state - %div.split-hr-left + %div.split-hr-left + %div.dossier-state= @facade.dossier.display_state + %div.split-hr-left diff --git a/app/views/users/commentaires/_commentaire.html.haml b/app/views/users/commentaires/_commentaire.html.haml deleted file mode 100644 index c6eb31717..000000000 --- a/app/views/users/commentaires/_commentaire.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%div.commentaire - .row - %div.col-lg-12.col-md-12.col-sm-12.col-xs-12.comment-header - = commentaire.header - .row - %div.col-lg-12.col-md-12.col-sm-12.col-xs-12.content - = commentaire.body.html_safe - - if file = commentaire.piece_justificative - .row - %div.col-lg-12.col-md-12.col-sm-12.col-xs-12.file - = link_to file.content_url, class: 'link', target: '_blank' do - %span.fa.fa-file - %div - = file.original_filename diff --git a/spec/controllers/users/dossiers/invites_controller_spec.rb b/spec/controllers/users/dossiers/invites_controller_spec.rb index e2d71450a..f45c34326 100644 --- a/spec/controllers/users/dossiers/invites_controller_spec.rb +++ b/spec/controllers/users/dossiers/invites_controller_spec.rb @@ -21,7 +21,7 @@ describe Users::Dossiers::InvitesController, type: :controller do get :show, params: {id: invite.id} end - # it { expect(response.status).to eq 200 } + it { expect(response.status).to eq 200 } end end diff --git a/spec/factories/invite.rb b/spec/factories/invite.rb index 4cdd334af..5475b5984 100644 --- a/spec/factories/invite.rb +++ b/spec/factories/invite.rb @@ -6,6 +6,10 @@ FactoryGirl.define do if invite.dossier.nil? invite.dossier = create(:dossier) end + + unless invite.user.nil? + invite.email = invite.user.email + end end trait :with_user do