-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10465 from colinux/attestations-v2-prod
ETQ admin je peux activer la délivrance des attestations v2 (sous feature flag)
- Loading branch information
Showing
42 changed files
with
722 additions
and
256 deletions.
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
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,49 @@ | ||
@import "constants"; | ||
|
||
.fixed-footer { | ||
border-top: 2px solid var(--border-plain-blue-france); | ||
position: fixed; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
padding-top: $default-padding; | ||
background-color: var(--background-default-grey); | ||
z-index: 2; | ||
} | ||
|
||
@media (max-width: 62em) { | ||
.padded-fixed-footer { | ||
padding-top: 120px; | ||
} | ||
} | ||
|
||
@media (min-width: 62em) { | ||
.padded-fixed-footer { | ||
padding-top: 60px; | ||
} | ||
} | ||
|
||
[data-fr-theme="dark"] .fixed-footer { | ||
background-color: var(--background-action-low-blue-france); | ||
} | ||
|
||
.sticky-header { | ||
padding-top: $default-padding; | ||
padding-bottom: $default-padding; | ||
|
||
&-container { | ||
position: sticky; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
z-index: 800; | ||
} | ||
|
||
&-warning { | ||
background-color: var(--background-contrast-warning); | ||
} | ||
|
||
p { | ||
margin: 0; | ||
} | ||
} |
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 @@ | ||
# frozen_string_literal: true | ||
|
||
class AutosaveNoticeComponent < ApplicationComponent | ||
attr_reader :label_scope | ||
|
||
def initialize(success:, label_scope:) | ||
@success = success | ||
@label_scope = label_scope | ||
end | ||
|
||
def success? = @success | ||
|
||
def label | ||
success? ? t(".#{label_scope}.saved") : t(".#{label_scope}.error") | ||
end | ||
end |
8 changes: 8 additions & 0 deletions
8
app/components/autosave_notice_component/autosave_notice_component.en.yml
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,8 @@ | ||
--- | ||
en: | ||
form: | ||
saved: 'Form saved' | ||
error: 'Form in error' | ||
attestation: | ||
saved: 'Attestation saved' | ||
error: 'Attestation in error' |
8 changes: 8 additions & 0 deletions
8
app/components/autosave_notice_component/autosave_notice_component.fr.yml
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,8 @@ | ||
--- | ||
fr: | ||
form: | ||
saved: 'Formulaire enregistré' | ||
error: 'Formulaire en erreur' | ||
attestation: | ||
saved: 'Attestation enregistrée' | ||
error: 'Attestation en erreur' |
2 changes: 2 additions & 0 deletions
2
app/components/autosave_notice_component/autosave_notice_component.html.haml
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,2 @@ | ||
#autosave-notice.fr-badge.fr-badge--sm{ class: class_names("fr-badge--success" => success?, "fr-badge--error" => !success?) } | ||
= label |
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
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
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
2 changes: 1 addition & 1 deletion
2
app/components/procedure/card/attestation_component/attestation_component.html.haml
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
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
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
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
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,43 @@ | ||
import { ApplicationController } from './application_controller'; | ||
|
||
export class StickyTopController extends ApplicationController { | ||
// Ajusts top of sticky top components when there is a sticky header. | ||
|
||
connect(): void { | ||
const header = document.getElementById('sticky-header'); | ||
|
||
if (!header) { | ||
return; | ||
} | ||
|
||
this.adjustTop(header); | ||
|
||
window.addEventListener('resize', () => this.adjustTop(header)); | ||
|
||
this.listenHeaderMutations(header); | ||
} | ||
|
||
private listenHeaderMutations(header: HTMLElement) { | ||
const config = { childList: true, subtree: true }; | ||
|
||
const callback: MutationCallback = (mutationsList) => { | ||
for (const mutation of mutationsList) { | ||
if (mutation.type === 'childList') { | ||
this.adjustTop(header); | ||
break; | ||
} | ||
} | ||
}; | ||
|
||
const observer = new MutationObserver(callback); | ||
observer.observe(header, config); | ||
} | ||
|
||
private adjustTop(header: HTMLElement) { | ||
const headerHeight = header.clientHeight; | ||
|
||
if (headerHeight > 0) { | ||
(this.element as HTMLElement).style.top = `${headerHeight + 8}px`; | ||
} | ||
} | ||
} |
Oops, something went wrong.