-
Notifications
You must be signed in to change notification settings - Fork 16
[ENG-8770] Add TOS Banner to angular-osf #365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
4026407
Update develop from main (#322)
bp-cos 52c5896
Feat(8653): Implement view tracking for registrations and preprints (…
opaduchak 6ff10ff
[ENG-8624] feat(registries): add context to registration submission +…
adlius 0fed748
[ENG-8504] Show Osf introduction video and Collections,Institutions, …
mkovalua 5bbf4b8
Fix/develop conflicts (#332)
nsemets c75d7b7
[ENG-8639] add <meta> tags to files detail (#324)
aaxelb bde80ff
Add TOS Banner to angular-osf
mkovalua 16bfc29
implement tos banner component
mkovalua 508832e
use accepted_terms_of_service for models
mkovalua 1692455
update tos component
mkovalua e7cbe50
get acceptedTermsOfService from db on component initialization
mkovalua 48582dd
Update acceptedTermsOfService on checkbox select and continue click
mkovalua 4cac855
fix(tos banner): updating component and updating acceptedTermsOfServi…
mkovalua be026c2
fix(tos banner): update terms of use
mkovalua 7ef46e1
fix(tos banner): use en.json for text
mkovalua fee9e8f
fix(tos banner): code updates
mkovalua 47bb32f
fix(tos banner): merge main into feature/ENG-8780 and resolve merge c…
mkovalua 38e064a
fix(tos-banner): merge main to ENG-8780
mkovalua 1f45526
fix(tos-banner): add tos banner to dashboard
mkovalua 6268e6f
fix(tos-banner): remove subscribe for updateUserProfile call
mkovalua a5207f5
fix(dashboard): fix CR comments
mkovalua b60bc7e
fix(tos-banner): fix CR comments
mkovalua 1d3b623
fix(banner): fixed banner
nsemets cbe41f4
Merge remote-tracking branch 'origin/main' into feature/ENG-8780
nsemets d519a1d
fix(tos-banner): update en.json
mkovalua 26e0fed
fix(tos-banner): Convert acceptedTermsOfService to accepted_terms_of_…
mkovalua f7c0ca7
fix(tos-banner): convert acceptedTermsOfService to accepted_terms_of_…
mkovalua File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 @@ | ||
export { TosConsentBannerComponent } from './tos-consent-banner/tos-consent-banner.component'; |
48 changes: 48 additions & 0 deletions
48
src/app/features/home/components/tos-consent-banner/tos-consent-banner.component.html
This file contains hidden or 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 @@ | ||
@if (!acceptedTermsOfServiceChange()) { | ||
<div class="p-4 bg-white"> | ||
<p-message styleClass="w-full" severity="warn"> | ||
<ng-template #container> | ||
<div class="flex flex-column w-full"> | ||
<div class="flex items-center gap-2"> | ||
<osf-icon iconClass="fas fa-triangle-exclamation"></osf-icon> | ||
|
||
<span class="font-medium"> | ||
{{ 'toast.tos-consent.message' | translate }} | ||
<a class="font-bold" [routerLink]="['/terms-of-use']" target="_blank"> | ||
{{ 'toast.tos-consent.termsOfUse' | translate }} | ||
</a> | ||
{{ 'toast.tos-consent.and' | translate }} | ||
<a class="font-bold" [routerLink]="['/privacy-policy']" target="_blank"> | ||
{{ 'toast.tos-consent.privacyPolicy' | translate }} | ||
</a> | ||
</span> | ||
</div> | ||
|
||
<div class="flex align-items-center justify-content-between mt-2"> | ||
<div class="flex align-items-center gap-2"> | ||
<p-checkbox | ||
[ngModel]="acceptedTermsOfService()" | ||
(ngModelChange)="acceptedTermsOfService.set($event)" | ||
binary="true" | ||
inputId="terms" | ||
> | ||
</p-checkbox> | ||
|
||
<label for="terms" class="m-0 cursor-pointer"> | ||
{{ 'toast.tos-consent.haveReadAndAgree' | translate }} | ||
</label> | ||
</div> | ||
|
||
<p-button | ||
link | ||
[label]="'toast.tos-consent.continue' | translate" | ||
[disabled]="!acceptedTermsOfService()" | ||
(onClick)="onContinue()" | ||
> | ||
</p-button> | ||
</div> | ||
</div> | ||
</ng-template> | ||
</p-message> | ||
</div> | ||
} |
Empty file.
22 changes: 22 additions & 0 deletions
22
src/app/features/home/components/tos-consent-banner/tos-consent-banner.component.spec.ts
This file contains hidden or 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,22 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { TosConsentBannerComponent } from './tos-consent-banner.component'; | ||
|
||
describe.skip('TosConsentBannerComponent', () => { | ||
let component: TosConsentBannerComponent; | ||
let fixture: ComponentFixture<TosConsentBannerComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [TosConsentBannerComponent], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(TosConsentBannerComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
45 changes: 45 additions & 0 deletions
45
src/app/features/home/components/tos-consent-banner/tos-consent-banner.component.ts
This file contains hidden or 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,45 @@ | ||
import { createDispatchMap, select } from '@ngxs/store'; | ||
|
||
import { TranslatePipe, TranslateService } from '@ngx-translate/core'; | ||
|
||
import { Button } from 'primeng/button'; | ||
import { Checkbox } from 'primeng/checkbox'; | ||
import { Message } from 'primeng/message'; | ||
|
||
import { Component, computed, inject, signal } from '@angular/core'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { RouterLink } from '@angular/router'; | ||
|
||
import { AcceptTermsOfServiceByUser, UserSelectors } from '@core/store/user'; | ||
import { IconComponent } from '@osf/shared/components'; | ||
import { ToastService } from '@osf/shared/services'; | ||
|
||
@Component({ | ||
selector: 'osf-tos-consent-banner', | ||
imports: [FormsModule, Checkbox, Button, Message, TranslatePipe, IconComponent, RouterLink], | ||
templateUrl: './tos-consent-banner.component.html', | ||
styleUrls: ['./tos-consent-banner.component.scss'], | ||
}) | ||
export class TosConsentBannerComponent { | ||
private readonly toastService = inject(ToastService); | ||
private readonly translateService = inject(TranslateService); | ||
|
||
readonly actions = createDispatchMap({ acceptTermsOfServiceByUser: AcceptTermsOfServiceByUser }); | ||
readonly currentUser = select(UserSelectors.getCurrentUser); | ||
|
||
acceptedTermsOfService = signal(false); | ||
errorMessage: string | null = null; | ||
|
||
acceptedTermsOfServiceChange = computed(() => this.currentUser()?.acceptedTermsOfService); | ||
|
||
onContinue() { | ||
if (!this.acceptedTermsOfService()) { | ||
this.errorMessage = this.translateService.instant('toast.tos-consent.error-message'); | ||
this.toastService.showError(this.errorMessage as string); | ||
return; | ||
} | ||
|
||
this.errorMessage = null; | ||
this.actions.acceptTermsOfServiceByUser(); | ||
} | ||
} |
This file contains hidden or 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 hidden or 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
Empty file.
This file contains hidden or 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
Empty file.
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.