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

Added cookie consent #316

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
6 changes: 4 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@
"src/styles/base.scss",
"./node_modules/froala-editor/css/froala_editor.pkgd.min.css",
"./node_modules/froala-editor/css/froala_style.min.css",
"./node_modules/ng-pick-datetime/assets/style/picker.min.css"
"./node_modules/ng-pick-datetime/assets/style/picker.min.css",
"./node_modules/cookieconsent/build/cookieconsent.min.css"
],
"scripts": [
"./node_modules/froala-editor/js/froala_editor.pkgd.min.js"
"./node_modules/froala-editor/js/froala_editor.pkgd.min.js",
"./node_modules/cookieconsent/build/cookieconsent.min.js"
]
},
"configurations": {
Expand Down
6 changes: 5 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ module.exports = function (config) {
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
files: [
'./node_modules/cookieconsent/build/cookieconsent.min.js', // loading cookie service
'./node_modules/cookieconsent/build/cookieconsent.min.css' // cookie styles
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},

reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
"@angular/router": "^7.2.15",
"@types/moment-timezone": "^0.5.12",
"angular-froala-wysiwyg": "^3.0.0-rc.2-1",
"cookieconsent": "^3.1.1",
Kajol-Kumari marked this conversation as resolved.
Show resolved Hide resolved
"core-js": "^2.4.1",
"materialize-css": "^0.97.8",
"hammerjs": "^2.0.8",
"materialize-css": "^0.97.8",
"moment": "^2.24.0",
"ng-pick-datetime": "^7.0.0",
"ngx-cookieconsent": "^2.2.3",
"ngx-textarea-autosize": "^2.0.3",
"ngx-twitter-timeline": "^0.1.5",
"normalize.css": "^8.0.0",
Expand Down
11 changes: 10 additions & 1 deletion src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ import { LoadingComponent } from './components/utility/loading/loading.component
import { ConfirmComponent } from './components/utility/confirm/confirm.component';
import { ModalComponent } from './components/utility/modal/modal.component';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { NgcCookieConsentConfig, NgcCookieConsentModule } from 'ngx-cookieconsent';
import { environment } from '../environments/environment';

const cookieConfig: NgcCookieConsentConfig = {
cookie: {
domain: environment.domain // or 'your.domain.com'
}
};

describe('AppComponent', () => {

Expand All @@ -38,7 +46,8 @@ describe('AppComponent', () => {
],
imports: [
RouterTestingModule,
HttpClientModule
HttpClientModule,
NgcCookieConsentModule.forRoot(cookieConfig)
],
providers: [
GlobalService,
Expand Down
6 changes: 4 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { Router, NavigationEnd, ActivatedRoute } from '@angular/router';
import { DOCUMENT } from '@angular/common';
import { Title } from '@angular/platform-browser';


// service for initializing cookie
import { NgcCookieConsentService } from 'ngx-cookieconsent';


@Component({
Expand Down Expand Up @@ -46,7 +47,8 @@ export class AppComponent implements OnInit, OnDestroy {
public activatedRoute: ActivatedRoute,
public titleService: Title,
private globalService: GlobalService,
private authService: AuthService
private authService: AuthService,
private ccService: NgcCookieConsentService
) {
}

Expand Down
20 changes: 20 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg';
import { NgcCookieConsentModule, NgcCookieConsentConfig } from 'ngx-cookieconsent';

// Import services
import { WindowService } from './services/window.service';
import { ApiService } from './services/api.service';
import { GlobalService } from './services/global.service';
import { ChallengeService } from './services/challenge.service';
import { EndpointsService } from './services/endpoints.service';
import { environment } from '../environments/environment';


// Import Components
Expand All @@ -24,6 +26,23 @@ import { TermsAndConditionsModalComponent } from './components/challenge/challen
// import module
import { SharedModule } from './shared/shared.module';

// configuration of cookie consent
const cookieConfig: NgcCookieConsentConfig = {
cookie: {
domain: environment.domain // or 'your.domain.com'
},
palette: {
popup: {
background: '#000'
},
button: {
background: '#f1d600'
}
},
theme: 'edgeless',
type: 'opt-out'
};

@NgModule({
declarations: [
AppComponent,
Expand All @@ -40,6 +59,7 @@ import { SharedModule } from './shared/shared.module';
HttpClientModule,
FroalaEditorModule.forRoot(),
FroalaViewModule.forRoot(),
NgcCookieConsentModule.forRoot(cookieConfig)
],
providers: [
WindowService,
Expand Down
3 changes: 2 additions & 1 deletion src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
*/
export const environment = {
production: true,
api_endpoint: 'https://staging-evalai.cloudcv.org/api/'
api_endpoint: 'https://staging-evalai.cloudcv.org/api/',
domain: 'https://staging-evalai.cloudcv.org'
};
3 changes: 2 additions & 1 deletion src/environments/environment.staging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
*/
export const environment = {
production: true,
api_endpoint: 'http://staging-evalai.cloudcv.org/api/'
api_endpoint: 'http://staging-evalai.cloudcv.org/api/',
domain: 'http://staging-evalai.cloudcv.org'
};
3 changes: 2 additions & 1 deletion src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
*/
export const environment = {
production: false,
api_endpoint: 'http://localhost:8000/api/'
api_endpoint: 'http://localhost:8000/api/',
domain: 'localhost'
};