Skip to content

Commit

Permalink
Merge tag '2023-11-16-01' into feature/import-2023-11-16
Browse files Browse the repository at this point in the history
# Conflicts:
#	db/schema.rb
  • Loading branch information
maatinito committed Mar 7, 2024
2 parents 0697d28 + a6f4ae3 commit 08de5ef
Show file tree
Hide file tree
Showing 21 changed files with 957 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/assets/config/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
//= link administrate/application.css
//= link administrate/application.js
//= link manager.css
//= link attestation.css
Binary file added app/assets/fonts/marianne-bold.ttf
Binary file not shown.
Binary file added app/assets/fonts/marianne-regular.ttf
Binary file not shown.
Binary file added app/assets/fonts/marianne-thin.ttf
Binary file not shown.
1 change: 1 addition & 0 deletions app/assets/images/centered_marianne.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions app/assets/images/liberte2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
112 changes: 112 additions & 0 deletions app/assets/stylesheets/attestation.scss
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;
}
}
16 changes: 16 additions & 0 deletions app/assets/stylesheets/attestation_template_2_edit.scss
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;
}
}
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
Loading

0 comments on commit 08de5ef

Please sign in to comment.