dossier: make the upload label a real label
This commit is contained in:
parent
1de3674e36
commit
f895570b00
4 changed files with 11 additions and 12 deletions
|
@ -16,6 +16,10 @@ class Champs::PieceJustificativeChamp < Champ
|
|||
"image/jpeg"
|
||||
]
|
||||
|
||||
def main_value_name
|
||||
:piece_justificative_file
|
||||
end
|
||||
|
||||
def search_terms
|
||||
# We don’t know how to search inside documents yet
|
||||
end
|
||||
|
@ -51,8 +55,4 @@ class Champs::PieceJustificativeChamp < Champ
|
|||
piece_justificative_file.service_url
|
||||
end
|
||||
end
|
||||
|
||||
def html_label?
|
||||
false
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<%= render_flash(timeout: 5000, sticky: true) %>
|
||||
<%= remove_element("#attachment_#{@attachment_id}") %>
|
||||
<%= show_element("#attachment_file_#{@attachment_id}") %>
|
||||
<%= remove_element(".attachment-actions-#{@attachment_id}") %>
|
||||
<%= show_element(".attachment-input-#{@attachment_id}") %>
|
||||
|
|
|
@ -13,17 +13,16 @@
|
|||
= link_to('le modèle suivant', url_for(template), target: '_blank', rel: 'noopener')
|
||||
|
||||
- if persisted
|
||||
.attachment-actions{ id: "attachment_#{attachment_id}" }
|
||||
.attachment-actions{ class: "attachment-actions-#{attachment_id}" }
|
||||
.attachment-action
|
||||
= render partial: "shared/attachment/show", locals: { attachment: attachment, user_can_upload: true }
|
||||
- if user_can_destroy
|
||||
.attachment-action
|
||||
= link_to 'Supprimer', attachment_url(attachment.id, { signed_id: attachment.blob.signed_id }), remote: true, method: :delete, class: 'button small danger'
|
||||
.attachment-action
|
||||
= button_tag 'Remplacer', type: 'button', class: 'button small', data: { 'toggle-target': "#attachment_file_#{attachment_id}" }
|
||||
= button_tag 'Remplacer', type: 'button', class: 'button small', data: { 'toggle-target': ".attachment-input-#{attachment_id}" }
|
||||
|
||||
= form.file_field attached_file.name,
|
||||
id: "attachment_file_#{attachment_id}",
|
||||
class: "attachment-input #{'hidden' if persisted}",
|
||||
class: "attachment-input attachment-input-#{attachment_id} #{'hidden' if persisted}",
|
||||
accept: accept,
|
||||
direct_upload: true
|
||||
|
|
|
@ -167,7 +167,7 @@ feature 'The user' do
|
|||
fill_individual
|
||||
|
||||
# Add an attachment
|
||||
find('.editable-champ-piece_justificative input[type=file]').attach_file(Rails.root + 'spec/fixtures/files/file.pdf')
|
||||
find_field('Pièce justificative').attach_file(Rails.root + 'spec/fixtures/files/file.pdf')
|
||||
click_on 'Enregistrer le brouillon'
|
||||
expect(page).to have_content('Votre brouillon a bien été sauvegardé')
|
||||
expect(page).to have_text('file.pdf')
|
||||
|
@ -182,7 +182,7 @@ feature 'The user' do
|
|||
|
||||
# Replace the attachment
|
||||
within('.attachment') { click_on 'Remplacer' }
|
||||
find('.editable-champ-piece_justificative input[type=file]').attach_file(Rails.root + 'spec/fixtures/files/RIB.pdf')
|
||||
find_field('Pièce justificative').attach_file(Rails.root + 'spec/fixtures/files/RIB.pdf')
|
||||
click_on 'Enregistrer le brouillon'
|
||||
expect(page).to have_no_text('file.pdf')
|
||||
expect(page).to have_text('RIB.pdf')
|
||||
|
|
Loading…
Reference in a new issue