Fix invite to access a files
This commit is contained in:
parent
45042d0200
commit
99e6749c96
9 changed files with 13 additions and 23 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
= render partial: 'layouts/left_panels/left_panel_users_recapitulatifcontroller_show'
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue