forked from demarches-simplifiees/demarches-simplifiees.fr
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag '2023-11-16-01' into feature/import-2023-11-16
# Conflicts: # db/schema.rb
- Loading branch information
Showing
21 changed files
with
957 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
@font-face { | ||
font-family: "Marianne"; | ||
src: url("marianne-regular.ttf"); | ||
font-weight: normal; | ||
font-style: normal; | ||
} | ||
|
||
@font-face { | ||
font-family: "Marianne"; | ||
src: url("marianne-bold.ttf"); | ||
font-weight: bold; | ||
font-style: normal; | ||
} | ||
|
||
@font-face { | ||
font-family: "Marianne"; | ||
src: url("marianne-thin.ttf"); | ||
font-weight: 100; // weasy print n"accepte pas lighter | ||
font-style: normal; | ||
} | ||
|
||
@page { | ||
size: A4; | ||
margin: 17mm 17mm 34mm; // add margin at the bottom to add address | ||
|
||
@bottom-center { | ||
font-size: 8pt; | ||
content: counter(page) " / " counter(pages); | ||
margin-top: 17mm; | ||
} | ||
|
||
@bottom-left { | ||
content: element(footer); | ||
} | ||
} | ||
|
||
#attestation { | ||
@media screen { | ||
max-width: 21cm; | ||
padding: 17mm; | ||
margin: 0 auto; | ||
} | ||
|
||
font-family: Marianne; | ||
|
||
.header { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
.right { | ||
text-align: right; | ||
} | ||
|
||
.bloc-marque { | ||
margin-bottom: 14mm; | ||
} | ||
|
||
.marianne { | ||
height: 4.25mm; | ||
margin-bottom: 1mm; | ||
} | ||
|
||
.intitule { | ||
font-size: 12pt; | ||
font-weight: bold; | ||
margin: 0 0 1mm; | ||
} | ||
|
||
.devise { | ||
height: 8.5mm; | ||
margin: 0; | ||
} | ||
|
||
.issuer { | ||
font-size: 10pt; | ||
margin: 0 0 14mm; // pas sur, pour mettre une marge si issuer plus bas que date | ||
} | ||
|
||
.direction { | ||
font-size: 12pt; | ||
font-weight: bold; | ||
margin: 0 0 23.3mm; | ||
} | ||
|
||
.date { | ||
font-size: 8pt; | ||
margin: 0 0 14mm; | ||
} | ||
|
||
.title { | ||
font-size: 12pt; | ||
font-weight: bold; | ||
text-align: center; | ||
margin: 0 0 12.6mm; | ||
} | ||
|
||
.main { | ||
font-size: 10pt; | ||
} | ||
|
||
.notice { | ||
font-size: 10pt; | ||
font-style: italic; | ||
} | ||
|
||
.footer { | ||
position: running(footer); | ||
font-size: 7pt; | ||
font-weight: 100; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#attestation-edit { | ||
.mention { | ||
border: 1px solid var(--text-default-grey); | ||
padding: 8px; | ||
} | ||
|
||
.selected { | ||
border: 1px solid #000000; | ||
} | ||
|
||
.tiptap { | ||
padding: 8px; | ||
|
||
min-height: 300px; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
app/controllers/administrateurs/attestation_template_v2s_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
module Administrateurs | ||
class AttestationTemplateV2sController < AdministrateurController | ||
before_action :retrieve_procedure, :retrieve_attestation_template, :ensure_feature_active | ||
|
||
def show | ||
json_body = @attestation_template.json_body&.deep_symbolize_keys | ||
@body = TiptapService.to_html(json_body, {}) | ||
|
||
respond_to do |format| | ||
format.html do | ||
render layout: 'attestation' | ||
end | ||
|
||
format.pdf do | ||
html = render_to_string('/administrateurs/attestation_template_v2s/show', layout: 'attestation', formats: [:html]) | ||
|
||
result = Typhoeus.post(WEASYPRINT_URL, | ||
headers: { 'content-type': 'application/json' }, | ||
body: { html: html }.to_json) | ||
|
||
send_data(result.body, filename: 'attestation.pdf', type: 'application/pdf', disposition: 'inline') | ||
end | ||
end | ||
end | ||
|
||
def edit | ||
end | ||
|
||
def update | ||
@attestation_template | ||
.update(json_body: editor_params) | ||
end | ||
|
||
private | ||
|
||
def ensure_feature_active | ||
redirect_to root_path if !@procedure.feature_enabled?(:attestation_v2) | ||
end | ||
|
||
def retrieve_attestation_template | ||
@attestation_template = @procedure.attestation_template || @procedure.build_attestation_template | ||
end | ||
|
||
def editor_params | ||
params.permit(content: [:type, content: [:type, :text, attrs: [:id, :label]]]) | ||
end | ||
end | ||
end |
Oops, something went wrong.