Skip to content
This repository was archived by the owner on Jul 6, 2020. It is now read-only.

Commit 90375cb

Browse files
committed
using_ngx-cookieconsent_module_for_adding_consent
1 parent ff16270 commit 90375cb

File tree

5 files changed

+30
-31
lines changed

5 files changed

+30
-31
lines changed

angular.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@
3333
"src/styles/base.scss",
3434
"./node_modules/froala-editor/css/froala_editor.pkgd.min.css",
3535
"./node_modules/froala-editor/css/froala_style.min.css",
36-
"./node_modules/ng-pick-datetime/assets/style/picker.min.css"
36+
"./node_modules/ng-pick-datetime/assets/style/picker.min.css",
37+
"./node_modules/cookieconsent/build/cookieconsent.min.css"
3738
],
3839
"scripts": [
39-
"./node_modules/froala-editor/js/froala_editor.pkgd.min.js"
40+
"./node_modules/froala-editor/js/froala_editor.pkgd.min.js",
41+
"./node_modules/cookieconsent/build/cookieconsent.min.js"
4042
]
4143
},
4244
"configurations": {

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@
3131
"@angular/router": "^7.2.15",
3232
"@types/moment-timezone": "^0.5.12",
3333
"angular-froala-wysiwyg": "^3.0.0-rc.2-1",
34+
"cookieconsent": "^3.1.1",
3435
"core-js": "^2.4.1",
35-
"materialize-css": "^0.97.8",
3636
"hammerjs": "^2.0.8",
37+
"materialize-css": "^0.97.8",
3738
"moment": "^2.24.0",
3839
"ng-pick-datetime": "^7.0.0",
40+
"ngx-cookieconsent": "^2.2.3",
3941
"ngx-textarea-autosize": "^2.0.3",
4042
"ngx-twitter-timeline": "^0.1.5",
4143
"normalize.css": "^8.0.0",

src/app/app.component.ts

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import { AuthService } from './services/auth.service';
66
import { Router, NavigationEnd, ActivatedRoute } from '@angular/router';
77
import { DOCUMENT } from '@angular/common';
88
import { Title } from '@angular/platform-browser';
9-
10-
9+
import { NgcCookieConsentService } from 'ngx-cookieconsent';
1110

1211

1312
@Component({
@@ -30,9 +29,6 @@ export class AppComponent implements OnInit, OnDestroy {
3029
globalEditPhaseModalSubscription: any;
3130
globalTermsAndConditionsModalSubscription: any;
3231
globalServiceSubscriptionScrollTop: any;
33-
cookieMessage = 'Our site uses cookies to ensure you get the best experience on our website';
34-
cookieDismiss = 'Cancel';
35-
cookieLinkText = 'Learn More';
3632

3733
/**
3834
* Constructor.
@@ -49,7 +45,8 @@ export class AppComponent implements OnInit, OnDestroy {
4945
public activatedRoute: ActivatedRoute,
5046
public titleService: Title,
5147
private globalService: GlobalService,
52-
private authService: AuthService
48+
private authService: AuthService,
49+
private ccService: NgcCookieConsentService
5350
) {
5451
}
5552

@@ -97,25 +94,6 @@ export class AppComponent implements OnInit, OnDestroy {
9794
setTimeout(() => {
9895
this.modalParams = params;
9996
}, 0);
100-
const cc = window as any;
101-
cc.cookieconsent.initialise({
102-
palette: {
103-
popup: {
104-
background: '#164969'
105-
},
106-
button: {
107-
background: '#ffe000',
108-
text: '#164969'
109-
}
110-
},
111-
theme: 'classic',
112-
content: {
113-
message: this.cookieMessage,
114-
dismiss: this.cookieDismiss,
115-
link: this.cookieLinkText,
116-
href: 'https://www.cookiesandyou.com'
117-
}
118-
});
11997
});
12098

12199
this.globalEditPhaseModalSubscription = this.globalService.editPhaseModalParams.subscribe(params => {

src/app/app.module.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { MatChipsModule } from '@angular/material/chips';
1111
import { MatMenuModule } from '@angular/material/menu';
1212
import { MatIconModule } from '@angular/material/icon';
1313
import { MatCheckboxModule } from '@angular/material';
14+
import {NgcCookieConsentModule, NgcCookieConsentConfig} from 'ngx-cookieconsent';
1415

1516
// Import serivces
1617
import { AuthService } from './services/auth.service';
@@ -88,6 +89,23 @@ import {PasswordMismatchValidatorDirective} from './Directives/password.validato
8889
import { ResetPasswordComponent } from './components/auth/reset-password/reset-password.component';
8990
import { EmailValidatorDirective } from './Directives/email.validator';
9091
import { ResetPasswordConfirmComponent } from './components/auth/reset-password-confirm/reset-password-confirm.component';
92+
93+
const cookieConfig: NgcCookieConsentConfig = {
94+
cookie: {
95+
domain: 'localhost' // or 'your.domain.com' // it is mandatory to set a domain, for cookies to work properly (see https://goo.gl/S2Hy2A)
96+
},
97+
palette: {
98+
popup: {
99+
background: '#000'
100+
},
101+
button: {
102+
background: '#f1d600'
103+
}
104+
},
105+
theme: 'edgeless',
106+
type: 'opt-out'
107+
};
108+
91109
@NgModule({
92110
declarations: [
93111
AppComponent,
@@ -166,7 +184,8 @@ import { ResetPasswordConfirmComponent } from './components/auth/reset-password-
166184
MatIconModule,
167185
MatTableModule,
168186
MatDividerModule,
169-
MatCheckboxModule
187+
MatCheckboxModule,
188+
NgcCookieConsentModule.forRoot(cookieConfig)
170189
],
171190
providers: [
172191
AuthService,

src/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
<meta property="og:description" content="EvalAI is an open-source web
2222
platform for organizing and participating in challenges to push the state
2323
of the art on AI tasks." />
24-
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.css" />
25-
<script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.js"></script>
2624
<link rel="icon" type="image/x-icon" href="favicon.ico">
2725
</head>
2826
<body>

0 commit comments

Comments
 (0)