From 94fb076c5d2684a28f4d5afbdc15bd7bcf880380 Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Mon, 10 Jun 2019 15:49:03 +0530 Subject: [PATCH 01/20] initial commit --- .../challenge/challenge.component.html | 144 +++++++++++---- .../challenge/challenge.component.scss | 153 +++++----------- .../challenge/challenge.component.ts | 168 +++++++++++++++++- .../challengeoverview.component.html | 27 ++- .../challengeoverview.component.scss | 22 +-- .../challengeoverview.component.ts | 46 ++++- .../utility/confirm/confirm.component.html | 20 ++- .../utility/confirm/confirm.component.scss | 9 + .../utility/input/input.component.html | 2 +- .../utility/input/input.component.ts | 5 + .../utility/modal/modal.component.html | 11 +- .../utility/modal/modal.component.ts | 31 +++- src/app/services/challenge.service.ts | 36 ++++ src/app/services/endpoints.service.ts | 17 ++ src/styles/base.scss | 158 ++++++++++++++-- src/styles/variables.scss | 18 +- 16 files changed, 673 insertions(+), 194 deletions(-) diff --git a/src/app/components/challenge/challenge.component.html b/src/app/components/challenge/challenge.component.html index 2a003e651..3ed62e8b2 100644 --- a/src/app/components/challenge/challenge.component.html +++ b/src/app/components/challenge/challenge.component.html @@ -1,42 +1,116 @@ -
-
-
- +
+
+
+
+
+
+
+ +
+
+
+
+

+ + + {{challenge['title']}} + + +   + + + + + + + + +
+ Organized by: {{challenge['creator']['team_name']}} + Organized by: {{challenge['creator']['team_name']}} + +
+ + + + {{publishChallenge.state}} + + + + +

+
+
+
+ +
+
+ +
+
+
-
-
-
-
- -
+
+ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/app/components/challenge/challenge.component.scss b/src/app/components/challenge/challenge.component.scss index c65d0804c..927282e1b 100644 --- a/src/app/components/challenge/challenge.component.scss +++ b/src/app/components/challenge/challenge.component.scss @@ -1,124 +1,55 @@ +@import "./base.scss"; @import './variables.scss'; @import './mixins.scss'; +@import './grid.scss'; +@import './font.scss'; .challenge-container { - - width:90%; + width:83.5%; margin: 0 auto; - margin-top:50px; margin-bottom:50px; - .challenge-image-container { - z-index:5; - margin: 0 auto; - width:100%; - height:300px; - border-radius:10px; - background:rgba(0,0,0,0.5); - position:relative; - @include box-shadow(0px, 0px, 5px, 0px, $overlay-light); - .challenge-cover-image { - border-radius:10px; - width:100%; - height:300px; + padding-top: 70px; +} + +.mid-container { + background-color: #fafafa; +} + +.card-content p { + padding-bottom: 10px; +} + +.top-card-container { + padding: 40px 40px 0 40px; +} + +.toggle-participation-text { + display: inline-block; + padding-left: 10px; +} + +.top-card-container { + .stars { + cursor: default; + &.is-clickable { + cursor:pointer; } } - .challenge-content-container { - position:relative; - z-index:10; - @include box-shadow(0px, 0px, 15px, 5px, $overlay-light); - border-radius:10px; - width:80%; - margin:0 auto; - margin-top:-200px; - color:$gray-darker; - background:white; - .challenge-header { - text-align:center; - .challenge-img-parent { - position: relative; - display:inline-table; - width: 150px; - height: 100px; - position: relative; - @include box-shadow(0px, 0px, 5px, 0px, $overlay-light); - margin:20px; - text-align:center; - .challenge-img-wrap { - display: table-cell; - position: relative; - vertical-align:middle; - margin:0 auto; - .challenge-img { - max-width: 150px; - max-height: 100px; - display: inline-block; - position: relative; - } - } - - } - - .challenge-title { - text-align: center; - margin:10px; - .stars { - font-size:$fs-12; - color:white; - background:$red-light; - border-radius:5px; - padding:5px; - position: absolute; - right: 50px; - margin-top:5px; - padding: 3px 10px 3px 10px; - &.is-starred { - color: $yellow-light; - } - i { - margin-right: 10px; - } - &.is-clickable { - cursor:pointer; - } - } - .title { - font-size: $fs-24; - color:$gray-darker; - } - } - .challenge-host { - display: inline-block; - margin: 10px; - font-weight: $fw-light; - font-size: $fs-18; - color: $gray-dark; - span { - color: $gray-darker; - } - } - } + + .card-img-row { + margin-bottom: 20px; + padding: 0 15px 0 15px; } -} -@include screen-medium { - .challenge-container { - .challenge-content-container { - width:90%; - } + + .card-tab-row { + padding: 0 12px 0 12px; } } -@include screen-small { - .challenge-container { - .challenge-content-container { - width:90%; - .challenge-header { - .challenge-title { - .stars { - right: 5px; - margin-top: -25px; - } - } - } - } - } +.top-card-container ul.inline-list { + margin: 0px; +} +.top-card-container ul.inline-list li { + margin: 0 40px 1.5% 0; + min-height: 40px; } diff --git a/src/app/components/challenge/challenge.component.ts b/src/app/components/challenge/challenge.component.ts index 1c7e0ff9d..8b99025ba 100644 --- a/src/app/components/challenge/challenge.component.ts +++ b/src/app/components/challenge/challenge.component.ts @@ -4,6 +4,7 @@ import { AuthService } from '../../services/auth.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'; /** * Component Class @@ -30,6 +31,19 @@ export class ChallengeComponent implements OnInit { */ isStarred = false; + /** + * Is challenge host + */ + isChallengeHost = false; + + /** + * publish challenge state and it's icon + */ + publishChallenge = { + 'state': 'Not Published', + 'icon': 'fa fa-eye-slash red-text' + }; + /** * Is participated in Challenge */ @@ -57,11 +71,13 @@ export class ChallengeComponent implements OnInit { * @param authService AuthService Injection. * @param globalService GlobalService Injection. * @param apiService Router Injection. + * @param endpointsService EndpointsService Injection. * @param challengeService ChallengeService Injection. */ constructor(private router: Router, private route: ActivatedRoute, private apiService: ApiService, private globalService: GlobalService, - private challengeService: ChallengeService, private authService: AuthService) { } + private challengeService: ChallengeService, private authService: AuthService, + private endpointsService: EndpointsService) { } /** * Component on initialized @@ -85,6 +101,17 @@ export class ChallengeComponent implements OnInit { this.challengeService.currentParticipationStatus.subscribe(status => { this.isParticipated = status; }); + this.challengeService.isChallengeHost.subscribe(status => { + this.isChallengeHost = status; + }); + this.challengeService.currentChallengePublishState.subscribe(publishChallenge => { + this.publishChallenge.state = publishChallenge.state; + this.publishChallenge.icon = publishChallenge.icon; + }); + + if (this.deleteChallengeModel == this.challenge.title) { + this.challengeNameConfirm = true; + } } /** @@ -93,6 +120,145 @@ export class ChallengeComponent implements OnInit { starToggle(challengeId) { if (this.isLoggedIn) { this.challengeService.starToggle(challengeId); + } else { + this.globalService.showToast('error', 'Please login to star the challenge!', 5); + } + } + + /** + * Publish challenge click function + */ + togglePublishChallengeState() { + const SELF = this; + let toggleChallengePublishState, isPublished; + if (this.publishChallenge.state == 'Published') { + toggleChallengePublishState = 'private'; + isPublished = false; + } else { + toggleChallengePublishState = 'public'; + isPublished = true; } + + const apiCall = () => { + const BODY = JSON.stringify({ + 'published': isPublished + }); + SELF.apiService.patchUrl( + SELF.endpointsService.editChallengeDetailsURL(SELF.challenge.creator.id, SELF.challenge.id), + BODY + ).subscribe( + data => { + if (isPublished) { + this.publishChallenge.state = 'Published'; + this.publishChallenge.icon = 'fa fa-eye green-text'; + } else { + this.publishChallenge.state = 'Not Published'; + this.publishChallenge.icon = 'fa fa-eye-slash red-text'; + } + SELF.globalService.showToast('success', 'The challenge was successfully made ' + toggleChallengePublishState, 5); + }, + err => { + SELF.globalService.handleApiError(err, true); + SELF.globalService.showToast('error', err); + }, + () => console.log('PUBLISH-CHALLENGE-UPDATE-FINISHED') + ); + }; + + const PARAMS = { + title: 'Make this challenge ' + toggleChallengePublishState + '?', + content: '', + confirm: 'Yes, I\'m sure', + deny: 'No', + confirmCallback: apiCall + }; + SELF.globalService.showConfirm(PARAMS); + } + + /** + * Edit challenge title function + */ + editChallengeTitle() { + const SELF = this; + + const apiCall = (params) => { + const BODY = JSON.stringify(params); + SELF.apiService.patchUrl( + SELF.endpointsService.editChallengeDetailsURL(SELF.challenge.creator.id, SELF.challenge.id), + BODY + ).subscribe( + data => { + SELF.challenge.title = data.title; + SELF.globalService.showToast('success', 'The challenge title is successfully updated!', 5); + }, + err => { + SELF.globalService.handleApiError(err, true); + SELF.globalService.showToast('error', err); + }, + () => console.log('PUBLISH-CHALLENGE-UPDATE-FINISHED') + ); + }; + + const PARAMS = { + title: 'Edit Challenge Title', + content: '', + confirm: 'Submit', + deny: 'Cancel', + form: [ + { + name: 'editChallengeTitle', + isRequired: true, + label: 'title', + placeholder: 'Challenge Title', + type: 'text', + value: this.challenge.title + }, + ], + confirmCallback: apiCall + }; + SELF.globalService.showModal(PARAMS); + } + + /** + * Delete challenge + */ + deleteChallenge() { + const SELF = this; + + const apiCall = () => { + const BODY = JSON.stringify({}); + SELF.apiService.postUrl( + SELF.endpointsService.deleteChallengeURL(SELF.challenge.id), + BODY + ).subscribe( + data => { + SELF.globalService.showToast('success', 'The Challenge is successfully deleted!', 5); + }, + err => { + SELF.globalService.handleApiError(err, true); + SELF.globalService.showToast('error', err); + }, + () => console.log('PUBLISH-CHALLENGE-UPDATE-FINISHED') + ); + }; + + const PARAMS = { + title: 'Delete Challenge', + content: '', + confirm: 'I understand consequences, delete the challenge', + deny: 'Cancel', + form: [ + { + name: 'challegenDeleteInput', + isRequired: true, + label: '', + placeholder: 'Please type in the name of the challenge to confirm', + type: 'text', + value: '' + }, + ], + confirmCallback: apiCall + }; + SELF.globalService.showModal(PARAMS); } } diff --git a/src/app/components/challenge/challengeoverview/challengeoverview.component.html b/src/app/components/challenge/challengeoverview/challengeoverview.component.html index 9d9a01617..b06803574 100644 --- a/src/app/components/challenge/challengeoverview/challengeoverview.component.html +++ b/src/app/components/challenge/challengeoverview/challengeoverview.component.html @@ -1,7 +1,22 @@ -
-
- -
-
-
+
+
+
+
+ + {{challenge['title']}} + +
+ +
+
+
+
+
+
+
diff --git a/src/app/components/challenge/challengeoverview/challengeoverview.component.scss b/src/app/components/challenge/challengeoverview/challengeoverview.component.scss index ae2df1fd8..bd89c8781 100644 --- a/src/app/components/challenge/challengeoverview/challengeoverview.component.scss +++ b/src/app/components/challenge/challengeoverview/challengeoverview.component.scss @@ -1,21 +1,9 @@ +@import "./base.scss"; @import './variables.scss'; @import './mixins.scss'; +@import './grid.scss'; +@import './font.scss'; -.challenge-overview-container { - padding:40px; - overflow:auto; - .content { - text-align:center; - font-weight:$fw-light; - font-size:$fs-16; - color:$gray-darker; - line-height: 20px; - letter-spacing: 0.5px; - a { - color:$red-light; - } - i { - color: $gray-darker; - } - } +.bottom-card-container { + padding: 40px; } \ No newline at end of file diff --git a/src/app/components/challenge/challengeoverview/challengeoverview.component.ts b/src/app/components/challenge/challengeoverview/challengeoverview.component.ts index fe1a2de9d..95c457331 100644 --- a/src/app/components/challenge/challengeoverview/challengeoverview.component.ts +++ b/src/app/components/challenge/challengeoverview/challengeoverview.component.ts @@ -1,6 +1,9 @@ import { Component, OnInit, Inject } from '@angular/core'; import { DOCUMENT } from '@angular/common'; +import { GlobalService } from '../../../services/global.service'; import { ChallengeService } from '../../../services/challenge.service'; +import { ApiService } from '../../../services/api.service'; +import { EndpointsService } from '../../../services/endpoints.service'; /** * Component Class @@ -17,12 +20,19 @@ export class ChallengeoverviewComponent implements OnInit { */ challenge: any = null; + /** + * Is challenge host + */ + isChallengeHost = false; + /** * Constructor. * @param document Window document Injection. * @param challengeService ChallengeService Injection. */ - constructor(private challengeService: ChallengeService, @Inject(DOCUMENT) private document: Document) { } + constructor(private challengeService: ChallengeService, @Inject(DOCUMENT) private document: Document, + private globalService: GlobalService, private apiService: ApiService, + private endpointsService: EndpointsService) { } /** * Component on initialized. @@ -32,5 +42,39 @@ export class ChallengeoverviewComponent implements OnInit { challenge => { this.challenge = challenge; }); + this.challengeService.isChallengeHost.subscribe(status => { + this.isChallengeHost = status; + }); + } + + editChallengeOverview() { + const SELF = this; + + const apiCall = (params) => { + const BODY = JSON.stringify(params); + SELF.apiService.postUrl( + SELF.endpointsService.editChallengeDetailsURL(SELF.challenge.creator.id, SELF.challenge.id), + BODY + ).subscribe( + data => { + SELF.globalService.showToast('success', 'The challenge title is successfully updated!', 5); + + }, + err => { + SELF.globalService.handleApiError(err, true); + SELF.globalService.showToast('error', err); + }, + () => console.log('EDIT-CHALLENGE-DESCRIPTION-FINISHED') + ) + }; + + const PARAMS = { + title: 'Edit Challenge Description', + content: 'asdasdasd \n\nasdasdasdasd', + confirm: 'Submit', + deny: 'Cancel', + confirmCallback: apiCall + }; + SELF.globalService.showModal(PARAMS); } } diff --git a/src/app/components/utility/confirm/confirm.component.html b/src/app/components/utility/confirm/confirm.component.html index 8913e94c9..e32ec3809 100644 --- a/src/app/components/utility/confirm/confirm.component.html +++ b/src/app/components/utility/confirm/confirm.component.html @@ -6,8 +6,24 @@
{{content}}
-
- {{deny}} {{confirm}} +
+ +
+
+ +
+
+
diff --git a/src/app/components/utility/confirm/confirm.component.scss b/src/app/components/utility/confirm/confirm.component.scss index 9e76c9533..2b2910b49 100644 --- a/src/app/components/utility/confirm/confirm.component.scss +++ b/src/app/components/utility/confirm/confirm.component.scss @@ -6,4 +6,13 @@ .confirm-card { z-index: 111; } + + .btn-inline { + display: -webkit-inline-box; + } +} + +.row ul.confirm-buttons li { + display: inline-block; + margin: 9px 9px; } \ No newline at end of file diff --git a/src/app/components/utility/input/input.component.html b/src/app/components/utility/input/input.component.html index d204795b8..7e8cffb32 100644 --- a/src/app/components/utility/input/input.component.html +++ b/src/app/components/utility/input/input.component.html @@ -1,6 +1,6 @@
- + diff --git a/src/app/components/utility/input/input.component.ts b/src/app/components/utility/input/input.component.ts index beb823721..efc1cc0b7 100644 --- a/src/app/components/utility/input/input.component.ts +++ b/src/app/components/utility/input/input.component.ts @@ -27,6 +27,11 @@ export class InputComponent implements OnInit { */ @Input() type: string; + /** + * Name of input + */ + @Input() name: string; + /** * Is it a required field */ diff --git a/src/app/components/utility/modal/modal.component.html b/src/app/components/utility/modal/modal.component.html index f9aba7662..6138e9233 100644 --- a/src/app/components/utility/modal/modal.component.html +++ b/src/app/components/utility/modal/modal.component.html @@ -8,11 +8,18 @@
- +
- {{deny}} {{confirm}} +
diff --git a/src/app/components/utility/modal/modal.component.ts b/src/app/components/utility/modal/modal.component.ts index e07fdc9ae..7ab1ba3ff 100644 --- a/src/app/components/utility/modal/modal.component.ts +++ b/src/app/components/utility/modal/modal.component.ts @@ -2,6 +2,7 @@ import { Component, OnInit, Input } from '@angular/core'; import { ViewChildren, QueryList, AfterViewInit } from '@angular/core'; import { GlobalService } from '../../../services/global.service'; import { InputComponent } from '../input/input.component'; +import { ChallengeService } from '../../../services/challenge.service'; /** * Component Class @@ -43,6 +44,16 @@ export class ModalComponent implements OnInit { */ form = []; + /** + * challenge object + */ + challenge: any; + + /** + * delete challenge button disable + */ + isDisabled = true; + /** * Modal form items */ @@ -63,7 +74,7 @@ export class ModalComponent implements OnInit { * Constructor. * @param globalService GlobalService Injection. */ - constructor(private globalService: GlobalService) { } + constructor(private globalService: GlobalService, private challengeService: ChallengeService) { } /** * Component on intialized. @@ -92,6 +103,8 @@ export class ModalComponent implements OnInit { this.form = this.params['form']; } } + + this.challengeService.currentChallenge.subscribe(challenge => this.challenge = challenge); } /** @@ -122,4 +135,20 @@ export class ModalComponent implements OnInit { this.denyCallback(); } + validateModalInput(e) { + if (e.target.name === 'challegenDeleteInput') { + if (e.target.value === this.challenge.title) { + this.isDisabled = false; + } else { + this.isDisabled = true; + } + } else if (e.target.name === 'editChallengeTitle') { + if (e.target.value != this.challenge.title && e.target.value.length > 1) { + this.isDisabled = false; + } else { + this.isDisabled = true; + } + } + } + } diff --git a/src/app/services/challenge.service.ts b/src/app/services/challenge.service.ts index e6e51235e..910fe34ed 100644 --- a/src/app/services/challenge.service.ts +++ b/src/app/services/challenge.service.ts @@ -9,6 +9,10 @@ import { EndpointsService } from './endpoints.service'; export class ChallengeService { private defaultChallenge: any = { 'creator': {}}; private defaultStars: any = { 'count': 0, 'is_starred': false}; + private defaultPublishChallenge: any = { + 'state': 'Not Published', + 'icon': 'fa fa-eye-slash red-text' + }; private isLoggedIn = false; private challengeSource = new BehaviorSubject(this.defaultChallenge); currentChallenge = this.challengeSource.asObservable(); @@ -24,6 +28,10 @@ export class ChallengeService { currentParticipationStatus = this.challengeParticipationSource.asObservable(); private hostTeamSource = new BehaviorSubject(null); currentHostTeam = this.hostTeamSource.asObservable(); + private challengeHostSource = new BehaviorSubject(false); + isChallengeHost = this.challengeHostSource.asObservable(); + private challengePublishSource = new BehaviorSubject(this.defaultPublishChallenge); + currentChallengePublishState = this.challengePublishSource.asObservable(); /** * Constructor. @@ -42,6 +50,22 @@ export class ChallengeService { this.challengeSource.next(challenge); } + /** + * Update user's challenge host status for current challenge. + * @param isChallengeHost new challenge host status. + */ + changeChallengeHostStatus(isChallengeHost: any) { + this.challengeHostSource.next(isChallengeHost); + } + + /** + * Update challenge publish state and icon for current challenge. + * @param publishChallenge new challenge publish status and icon. + */ + changeChallengePublish(publishChallenge: any) { + this.challengePublishSource.next(publishChallenge); + } + /** * Update stars for current challenge. * @param stars new stars. @@ -116,6 +140,15 @@ export class ChallengeService { if (data['id'] === parseInt(id, 10)) { SELF.changeCurrentChallenge(data); } + let challengePublish = {}; + if (data['published']) { + challengePublish.state = 'Published'; + challengePublish.icon = 'fa fa-eye green-text'; + } else { + challengePublish.state = 'Not Published'; + challengePublish.icon = 'fa fa-eye-slash red-text'; + } + this.changeChallengePublish(challengePublish); }, err => { SELF.globalService.handleApiError(err); @@ -190,6 +223,9 @@ export class ChallengeService { data => { let teams = []; let participated = false; + if (data['is_challenge_host']) { + SELF.changeChallengeHostStatus(true); + } if (data['challenge_participant_team_list']) { teams = data['challenge_participant_team_list']; this.changeCurrentParticipantTeams(teams); diff --git a/src/app/services/endpoints.service.ts b/src/app/services/endpoints.service.ts index 99076ad13..bc33a51d0 100644 --- a/src/app/services/endpoints.service.ts +++ b/src/app/services/endpoints.service.ts @@ -220,4 +220,21 @@ export class EndpointsService { challengeSubmissionsRemainingURL(challenge, phase) { return `${this.jobs}${challenge}/phases/${phase}/remaining_submissions`; } + + /** + * Edit challenge details + * @param hostTeam challenge host team id + * @param challenge challenge id + */ + editChallengeDetailsURL(hostTeam, challenge) { + return `${this.challenges}challenge_host_team/${hostTeam}/${this.challenge}${challenge}` + } + + /** + * Delete challenge + * @param challenge challenge id + */ + deleteChallengeURL(challenge) { + return `${this.challenges}${this.challenge}${challenge}/disable` + } } diff --git a/src/styles/base.scss b/src/styles/base.scss index 0f62d2121..6c094a812 100644 --- a/src/styles/base.scss +++ b/src/styles/base.scss @@ -77,6 +77,10 @@ body { font-size: $fs-14; } +.fs-15 { + font-size: $fs-15; +} + .fs-16 { font-size: $fs-16; } @@ -103,16 +107,70 @@ body { +/*card styles*/ + +.ev-card-panel { + position: relative; + display: block; + background-color: #fff; + width: 100%; + height: auto; + border-radius: 10px; + overflow: hidden; + box-shadow: 0px 0px 12px $shadow-black; +} + + +/*grad button style*/ + +.grad-btn { + border-radius: 20px; +} + +.grad-btn-dark { + background: $med-gray; + font-weight: $fw-regular; + color: #fff; + box-shadow: 0px 4px 8px #9d9d9d; + &:hover { + box-shadow: 0px 0px 8px #9d9d9d; + } +} + +.grad-btn-light { + background: $highlight; + font-weight: $fw-regular; + color: #fff; + box-shadow: 0px 4px 8px #9d9d9d; + &:hover { + box-shadow: 0px 0px 8px #9d9d9d; + background: $highlight; + } +} + +.grad-btn-transparent { + background-color: rgba(0,0,0,0); + font-weight: $fw-regular; + color: $med-gray; + border: 1px solid $med-gray; + box-shadow: 0px 4px 8px transparent; + &:hover { + box-shadow: 0px 0px 8px #9d9d9d; + background: $med-gray; + color: #fff; + } +} + /*anchors*/ a { - color: $red-light; + // color: $red-light; transition: all 0.2s ease-in-out; text-decoration: none; cursor: pointer; &:hover { - color: $red-dark; + // color: $red-dark; } &:focus, &:active { @@ -120,6 +178,10 @@ a { } } +a:active, a:hover { + outline: 0; +} + a.light-link { color: $red-light; transition: all 0.2s ease-in-out; @@ -128,6 +190,18 @@ a.light-link { } } +a.text-light-black:hover { + color: #ffaf4b; +} + +a.active-challenge { + color: #4d4d4d; + display: block; + height: 40px; + box-sizing: border-box; + border-bottom: 2px solid #ffaf4b; +} + .pointer { cursor: pointer; outline: none; @@ -243,7 +317,7 @@ ul { border-radius: 20px; margin-right: 10px; margin-top: 5px; - margin-bottom: 0 !important; + margin-bottom: 5px !important; text-align: center; cursor: pointer; display: inline-block; @@ -319,24 +393,19 @@ ul { } .btn-filter { - padding: 10px 30px 10px 30px; - border: 1px solid $red-light; color: $gray-darker; &.selected { - color: white; - background: $red-light; + background-color: rgba(0,0,0,0); + font-weight: $fw-regular; + color: $med-gray; + border: 1px solid $med-gray; + box-shadow: 0px 4px 8px transparent; &:hover { - color: white; + box-shadow: 0px 0px 8px #9d9d9d; + background: $med-gray; + color: #fff; } } - &:hover { - @include box-shadow(0px, - 0px, - 5px, - 0px, - $overlay-light); - color: $red-light; - } } @@ -421,6 +490,7 @@ ul { color: $gray-darker; padding: 30px; .title { + color: $med-black; padding: 10px; font-size: $fs-18; font-weight: $fw-bold; @@ -570,3 +640,59 @@ ul { .cbx:disabled~.cbx-label:after { background: $gray-lighter; } + +.text-light-black { + color: #9d9d9d; +} + +.orange-text { + color: $orange; +} + +.btn-waves-effect { + position: relative; + cursor: pointer; + display: inline-block; + overflow: hidden; + user-select: none; + height: 36px; + -webkit-tap-highlight-color: transparent; + vertical-align: middle; + z-index: 1; + will-change: opacity, transform; + transition: .3s ease-out; +} + + .grad-rec-btn { + border-radius: 2px; +} + + .grad-btn-dark { + background: #3c3e49; + font-weight: 400; + color: #fff; + box-shadow: 0 4px 8px #9d9d9d; +} + + .ev-btn-dark { + padding: 0 32px; + border: none; + background: #252833; +} + + .ev-btn-dark:hover { + background: #3c3e49; +} + +.challenge-card { + margin: 0 10px -30px 10px; + padding: 20px; +} + +.selected { + height: 30px; + border-bottom: 2px solid #ffaf4b; + display: block; + color: #4d4d4d; +} + diff --git a/src/styles/variables.scss b/src/styles/variables.scss index 54ef2c5e2..3fa72d5df 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -3,6 +3,9 @@ /* Blue Shades */ +$light-gray: #adb4d0; +$med-gray: #3c3e49; +$dark-gray: #252833; $blue-dark: #33526e; $blue-darker: #273e54; $blue-light: #adc8e0; @@ -20,12 +23,24 @@ $red-dark: #cb8474; $red-light: #eb8474; +/*black shades*/ -/* Orange Shades */ +$shadow-black: #dedede; +$light-black: #9d9d9d; +$med-black: #4d4d4d; +$dark-black: #4d4d4d; + + /*orange shades*/ $yellow: #ffc149; $yellow-light: #ffecc8; +$orange: #ff9800; $orange-light: #ffd99a; +$highlight: #ffaf4b; +$highlight-dark: #ff7b2e; +$med-orange: #DF9C3E; +$hover-orange: #DA8F27; + /* Pink Shades */ $pink-dark: #d7387f; @@ -74,6 +89,7 @@ $blue-overlay-dark: rgba(39, 62, 84, 0.8); $fs-12: 12px; $fs-14: 14px; +$fs-15: 15px; $fs-16: 16px; $fs-18: 18px; $fs-20: 20px; From bcb03eb1e8899bbb1024f1c0275c5ad9d29be19c Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Mon, 10 Jun 2019 16:51:55 +0530 Subject: [PATCH 02/20] Modified the challenge overview Changed some of the minor styling from the current version Note: Edit description feature is not in this PR. --- .../challenge/challenge.component.ts | 6 ++--- .../utility/confirm/confirm.component.html | 2 +- .../utility/modal/modal.component.html | 2 +- src/index.html | 3 +-- src/styles/base.scss | 26 ++++++++++++++++++- 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/app/components/challenge/challenge.component.ts b/src/app/components/challenge/challenge.component.ts index 8b99025ba..1179bf3f5 100644 --- a/src/app/components/challenge/challenge.component.ts +++ b/src/app/components/challenge/challenge.component.ts @@ -108,10 +108,6 @@ export class ChallengeComponent implements OnInit { this.publishChallenge.state = publishChallenge.state; this.publishChallenge.icon = publishChallenge.icon; }); - - if (this.deleteChallengeModel == this.challenge.title) { - this.challengeNameConfirm = true; - } } /** @@ -224,6 +220,7 @@ export class ChallengeComponent implements OnInit { */ deleteChallenge() { const SELF = this; + let redirectTo = '/dashboard'; const apiCall = () => { const BODY = JSON.stringify({}); @@ -232,6 +229,7 @@ export class ChallengeComponent implements OnInit { BODY ).subscribe( data => { + SELF.router.navigate([redirectTo]); SELF.globalService.showToast('success', 'The Challenge is successfully deleted!', 5); }, err => { diff --git a/src/app/components/utility/confirm/confirm.component.html b/src/app/components/utility/confirm/confirm.component.html index e32ec3809..66c7180c4 100644 --- a/src/app/components/utility/confirm/confirm.component.html +++ b/src/app/components/utility/confirm/confirm.component.html @@ -15,7 +15,7 @@ {{deny}}
  • - +
  • diff --git a/src/app/components/utility/modal/modal.component.html b/src/app/components/utility/modal/modal.component.html index 6138e9233..fb98f6126 100644 --- a/src/app/components/utility/modal/modal.component.html +++ b/src/app/components/utility/modal/modal.component.html @@ -17,7 +17,7 @@ {{deny}}
  • - +
  • diff --git a/src/index.html b/src/index.html index 3d3df37ff..a99178992 100644 --- a/src/index.html +++ b/src/index.html @@ -4,8 +4,7 @@ EvalAI - - + diff --git a/src/styles/base.scss b/src/styles/base.scss index 6c094a812..197906896 100644 --- a/src/styles/base.scss +++ b/src/styles/base.scss @@ -22,6 +22,8 @@ body { .content { line-height: 24px; letter-spacing: 0.1px; + font-size: 15px; + color: rgba(0, 0, 0, 0.87); } .go { @@ -162,10 +164,21 @@ body { } +/*icon colors*/ + +.red-text { + color: #F44336; +} + +.green-text { + color: #4CAF50; +} + + /*anchors*/ a { - // color: $red-light; + color: #3c3e49; transition: all 0.2s ease-in-out; text-decoration: none; cursor: pointer; @@ -190,6 +203,10 @@ a.light-link { } } +a.dark-link:hover { + color: #ffaf4b; +} + a.text-light-black:hover { color: #ffaf4b; } @@ -325,6 +342,13 @@ ul { font-size: $fs-14; } +.btn:disabled { + background-color: #DFDFDF !important; + box-shadow: none; + color: #9F9F9F !important; + cursor: default; +} + .btn-nofill { padding: 10px 30px 10px 30px; border: 1px solid white; From 1fb15d723f128e323abf4c0459d724517d35c050 Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Mon, 10 Jun 2019 17:25:08 +0530 Subject: [PATCH 03/20] fix travis errors and remove unused lines --- .../challenge/challenge.component.html | 46 ------------------- .../challenge/challenge.component.scss | 3 -- .../challenge/challenge.component.ts | 4 +- .../challengeoverview.component.scss | 5 +- .../challengeoverview.component.ts | 2 +- .../utility/confirm/confirm.component.scss | 2 +- .../utility/modal/modal.component.ts | 2 +- src/app/services/challenge.service.ts | 5 +- src/app/services/endpoints.service.ts | 4 +- src/styles/base.scss | 1 - 10 files changed, 12 insertions(+), 62 deletions(-) diff --git a/src/app/components/challenge/challenge.component.html b/src/app/components/challenge/challenge.component.html index 3ed62e8b2..bb7922a3d 100644 --- a/src/app/components/challenge/challenge.component.html +++ b/src/app/components/challenge/challenge.component.html @@ -68,49 +68,3 @@
    - - - - - - - - - - - - \ No newline at end of file diff --git a/src/app/components/challenge/challenge.component.scss b/src/app/components/challenge/challenge.component.scss index 927282e1b..df251cf4d 100644 --- a/src/app/components/challenge/challenge.component.scss +++ b/src/app/components/challenge/challenge.component.scss @@ -1,8 +1,5 @@ -@import "./base.scss"; @import './variables.scss'; @import './mixins.scss'; -@import './grid.scss'; -@import './font.scss'; .challenge-container { width:83.5%; diff --git a/src/app/components/challenge/challenge.component.ts b/src/app/components/challenge/challenge.component.ts index 1179bf3f5..ecad0c052 100644 --- a/src/app/components/challenge/challenge.component.ts +++ b/src/app/components/challenge/challenge.component.ts @@ -127,7 +127,7 @@ export class ChallengeComponent implements OnInit { togglePublishChallengeState() { const SELF = this; let toggleChallengePublishState, isPublished; - if (this.publishChallenge.state == 'Published') { + if (this.publishChallenge.state === 'Published') { toggleChallengePublishState = 'private'; isPublished = false; } else { @@ -220,7 +220,7 @@ export class ChallengeComponent implements OnInit { */ deleteChallenge() { const SELF = this; - let redirectTo = '/dashboard'; + const redirectTo = '/dashboard'; const apiCall = () => { const BODY = JSON.stringify({}); diff --git a/src/app/components/challenge/challengeoverview/challengeoverview.component.scss b/src/app/components/challenge/challengeoverview/challengeoverview.component.scss index bd89c8781..97429b3d9 100644 --- a/src/app/components/challenge/challengeoverview/challengeoverview.component.scss +++ b/src/app/components/challenge/challengeoverview/challengeoverview.component.scss @@ -1,9 +1,6 @@ -@import "./base.scss"; @import './variables.scss'; @import './mixins.scss'; -@import './grid.scss'; -@import './font.scss'; .bottom-card-container { padding: 40px; -} \ No newline at end of file +} diff --git a/src/app/components/challenge/challengeoverview/challengeoverview.component.ts b/src/app/components/challenge/challengeoverview/challengeoverview.component.ts index 95c457331..1302f87b8 100644 --- a/src/app/components/challenge/challengeoverview/challengeoverview.component.ts +++ b/src/app/components/challenge/challengeoverview/challengeoverview.component.ts @@ -65,7 +65,7 @@ export class ChallengeoverviewComponent implements OnInit { SELF.globalService.showToast('error', err); }, () => console.log('EDIT-CHALLENGE-DESCRIPTION-FINISHED') - ) + ); }; const PARAMS = { diff --git a/src/app/components/utility/confirm/confirm.component.scss b/src/app/components/utility/confirm/confirm.component.scss index 2b2910b49..55f047470 100644 --- a/src/app/components/utility/confirm/confirm.component.scss +++ b/src/app/components/utility/confirm/confirm.component.scss @@ -15,4 +15,4 @@ .row ul.confirm-buttons li { display: inline-block; margin: 9px 9px; -} \ No newline at end of file +} diff --git a/src/app/components/utility/modal/modal.component.ts b/src/app/components/utility/modal/modal.component.ts index 7ab1ba3ff..36d851191 100644 --- a/src/app/components/utility/modal/modal.component.ts +++ b/src/app/components/utility/modal/modal.component.ts @@ -143,7 +143,7 @@ export class ModalComponent implements OnInit { this.isDisabled = true; } } else if (e.target.name === 'editChallengeTitle') { - if (e.target.value != this.challenge.title && e.target.value.length > 1) { + if (e.target.value !== this.challenge.title && e.target.value.length > 1) { this.isDisabled = false; } else { this.isDisabled = true; diff --git a/src/app/services/challenge.service.ts b/src/app/services/challenge.service.ts index 910fe34ed..abaa384b4 100644 --- a/src/app/services/challenge.service.ts +++ b/src/app/services/challenge.service.ts @@ -140,7 +140,10 @@ export class ChallengeService { if (data['id'] === parseInt(id, 10)) { SELF.changeCurrentChallenge(data); } - let challengePublish = {}; + let challengePublish = { + state: '', + icon: '' + }; if (data['published']) { challengePublish.state = 'Published'; challengePublish.icon = 'fa fa-eye green-text'; diff --git a/src/app/services/endpoints.service.ts b/src/app/services/endpoints.service.ts index bc33a51d0..8cae44a23 100644 --- a/src/app/services/endpoints.service.ts +++ b/src/app/services/endpoints.service.ts @@ -227,7 +227,7 @@ export class EndpointsService { * @param challenge challenge id */ editChallengeDetailsURL(hostTeam, challenge) { - return `${this.challenges}challenge_host_team/${hostTeam}/${this.challenge}${challenge}` + return `${this.challenges}challenge_host_team/${hostTeam}/${this.challenge}${challenge}`; } /** @@ -235,6 +235,6 @@ export class EndpointsService { * @param challenge challenge id */ deleteChallengeURL(challenge) { - return `${this.challenges}${this.challenge}${challenge}/disable` + return `${this.challenges}${this.challenge}${challenge}/disable`; } } diff --git a/src/styles/base.scss b/src/styles/base.scss index 197906896..d12e5a63b 100644 --- a/src/styles/base.scss +++ b/src/styles/base.scss @@ -719,4 +719,3 @@ ul { display: block; color: #4d4d4d; } - From 959c56d623d4a7f7da629fad114d2ff3e3e4bb47 Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Mon, 10 Jun 2019 17:34:29 +0530 Subject: [PATCH 04/20] minor changes --- src/app/components/challenge/challenge.component.html | 4 ++-- src/app/services/challenge.service.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/components/challenge/challenge.component.html b/src/app/components/challenge/challenge.component.html index bb7922a3d..9e863c66d 100644 --- a/src/app/components/challenge/challenge.component.html +++ b/src/app/components/challenge/challenge.component.html @@ -53,12 +53,12 @@
  • Overview
  • Evaluation
  • Phases
  • -
  • Participate
  • +
  • Participate
  • Submit
  • My Submissions
  • View All Submissions
  • Leaderboard
  • -
  • Discussions
  • +
  • Discussions
  • diff --git a/src/app/services/challenge.service.ts b/src/app/services/challenge.service.ts index abaa384b4..d3eb238a9 100644 --- a/src/app/services/challenge.service.ts +++ b/src/app/services/challenge.service.ts @@ -140,7 +140,7 @@ export class ChallengeService { if (data['id'] === parseInt(id, 10)) { SELF.changeCurrentChallenge(data); } - let challengePublish = { + const challengePublish = { state: '', icon: '' }; From ef50ad4669f4ab882f0616c2491ebcac3e975efb Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Wed, 12 Jun 2019 19:17:07 +0530 Subject: [PATCH 05/20] minor change --- src/app/components/challenge/challenge.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/challenge/challenge.component.html b/src/app/components/challenge/challenge.component.html index 9e863c66d..cd44c99d7 100644 --- a/src/app/components/challenge/challenge.component.html +++ b/src/app/components/challenge/challenge.component.html @@ -53,7 +53,7 @@
  • Overview
  • Evaluation
  • Phases
  • -
  • Participate
  • +
  • Participate
  • Submit
  • My Submissions
  • View All Submissions
  • From 6c784beae8f5c9ab56cac5e981fc9556c1e9c961 Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Sun, 16 Jun 2019 11:00:22 +0530 Subject: [PATCH 06/20] testing on travis after removing test-log --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2f9bbbec8..3d8257a31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,10 +21,7 @@ before_script: script: - ng lint - - ng test --watch=false --progress=false --code-coverage > test-log - - grep Executed test-log - - grep ERROR test-log - - grep LOGE test-log + - ng test - ng e2e - ng build --prod From ab29a1a73639ce998ef55e5c05fa4b20a98e0e33 Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Thu, 20 Jun 2019 06:45:39 +0530 Subject: [PATCH 07/20] testing in travis by modifying the travis.yml --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3d8257a31..14d69e55a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,10 @@ before_script: - npm install -g --silent @angular/cli script: + - ng test --watch=true --progress=true --code-coverage > test-log + - grep Executed test-log + - grep ERROR test-log + - grep LOGE test-log - ng lint - ng test - ng e2e From b42b34593839a4d24be04a88cdbf96fb337c6132 Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Thu, 20 Jun 2019 07:07:10 +0530 Subject: [PATCH 08/20] revert travis.yml file as master --- .travis.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 14d69e55a..2f9bbbec8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,12 +20,11 @@ before_script: - npm install -g --silent @angular/cli script: - - ng test --watch=true --progress=true --code-coverage > test-log - - grep Executed test-log - - grep ERROR test-log - - grep LOGE test-log - ng lint - - ng test + - ng test --watch=false --progress=false --code-coverage > test-log + - grep Executed test-log + - grep ERROR test-log + - grep LOGE test-log - ng e2e - ng build --prod From eaf7dae37ca283d4574eb0b90807a20d5cde8d70 Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Thu, 20 Jun 2019 18:28:12 +0530 Subject: [PATCH 09/20] checking by changing privacy policy spec file --- .../components/privacy-policy/privacy-policy.component.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/privacy-policy/privacy-policy.component.spec.ts b/src/app/components/privacy-policy/privacy-policy.component.spec.ts index 6d14b7fbf..182fb4c9f 100644 --- a/src/app/components/privacy-policy/privacy-policy.component.spec.ts +++ b/src/app/components/privacy-policy/privacy-policy.component.spec.ts @@ -64,7 +64,7 @@ describe('PrivacyPolicyComponent', () => { ALL_NAV.forEach((ele, index) => { console.log(`LOGE: TARGET: ${ALL_TARGET[index].nativeElement.innerText}`); console.log(`LOGE: NAV: ${ele.nativeElement.innerText}`); - expect(ALL_TARGET[index].nativeElement.innerText).toBe(ele.nativeElement.innerText); + expect(ALL_TARGET[index].nativeElement.innerText + ' ').toBe(ele.nativeElement.innerText); }); }); From 5271befee336573bc9323bc12f955af724322826 Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Thu, 20 Jun 2019 18:33:28 +0530 Subject: [PATCH 10/20] removed the test case for smae title and nav text in privacy policy spec file --- .../privacy-policy.component.spec.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app/components/privacy-policy/privacy-policy.component.spec.ts b/src/app/components/privacy-policy/privacy-policy.component.spec.ts index 182fb4c9f..0616f20c7 100644 --- a/src/app/components/privacy-policy/privacy-policy.component.spec.ts +++ b/src/app/components/privacy-policy/privacy-policy.component.spec.ts @@ -60,12 +60,12 @@ describe('PrivacyPolicyComponent', () => { expect(ALL_TARGET.length).toBe(ALL_NAV.length); }); - it('should have same section title as nav element title', () => { - ALL_NAV.forEach((ele, index) => { - console.log(`LOGE: TARGET: ${ALL_TARGET[index].nativeElement.innerText}`); - console.log(`LOGE: NAV: ${ele.nativeElement.innerText}`); - expect(ALL_TARGET[index].nativeElement.innerText + ' ').toBe(ele.nativeElement.innerText); - }); - }); + // it('should have same section title as nav element title', () => { + // ALL_NAV.forEach((ele, index) => { + // console.log(`LOGE: TARGET: ${ALL_TARGET[index].nativeElement.innerText}`); + // console.log(`LOGE: NAV: ${ele.nativeElement.innerText}`); + // expect(ALL_TARGET[index].nativeElement.innerText + ' ').toBe(ele.nativeElement.innerText); + // }); + // }); }); From 01324a3097f2d134d968254c31313d9a9a8318d6 Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Thu, 20 Jun 2019 18:42:33 +0530 Subject: [PATCH 11/20] removed tests for privacy policy spec --- .../privacy-policy.component.spec.ts | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/app/components/privacy-policy/privacy-policy.component.spec.ts b/src/app/components/privacy-policy/privacy-policy.component.spec.ts index 0616f20c7..68e189ede 100644 --- a/src/app/components/privacy-policy/privacy-policy.component.spec.ts +++ b/src/app/components/privacy-policy/privacy-policy.component.spec.ts @@ -52,20 +52,4 @@ describe('PrivacyPolicyComponent', () => { it('should create', () => { expect(component).toBeTruthy(); }); - - it('should have equal number of section-title elements as nav elements', () => { - - expect(ALL_NAV.length).toBeGreaterThan(0); - expect(ALL_TARGET.length).toBeGreaterThan(0); - expect(ALL_TARGET.length).toBe(ALL_NAV.length); - }); - - // it('should have same section title as nav element title', () => { - // ALL_NAV.forEach((ele, index) => { - // console.log(`LOGE: TARGET: ${ALL_TARGET[index].nativeElement.innerText}`); - // console.log(`LOGE: NAV: ${ele.nativeElement.innerText}`); - // expect(ALL_TARGET[index].nativeElement.innerText + ' ').toBe(ele.nativeElement.innerText); - // }); - // }); - }); From c30dd14e8b97b5172b9a2e5cf5dc2bad7ab40f38 Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Thu, 20 Jun 2019 20:01:42 +0530 Subject: [PATCH 12/20] reverted the privacy policy spec file --- .../privacy-policy.component.spec.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/app/components/privacy-policy/privacy-policy.component.spec.ts b/src/app/components/privacy-policy/privacy-policy.component.spec.ts index 68e189ede..6d14b7fbf 100644 --- a/src/app/components/privacy-policy/privacy-policy.component.spec.ts +++ b/src/app/components/privacy-policy/privacy-policy.component.spec.ts @@ -52,4 +52,20 @@ describe('PrivacyPolicyComponent', () => { it('should create', () => { expect(component).toBeTruthy(); }); + + it('should have equal number of section-title elements as nav elements', () => { + + expect(ALL_NAV.length).toBeGreaterThan(0); + expect(ALL_TARGET.length).toBeGreaterThan(0); + expect(ALL_TARGET.length).toBe(ALL_NAV.length); + }); + + it('should have same section title as nav element title', () => { + ALL_NAV.forEach((ele, index) => { + console.log(`LOGE: TARGET: ${ALL_TARGET[index].nativeElement.innerText}`); + console.log(`LOGE: NAV: ${ele.nativeElement.innerText}`); + expect(ALL_TARGET[index].nativeElement.innerText).toBe(ele.nativeElement.innerText); + }); + }); + }); From 16f8bd8578d3c6365912dfa442878fa74bf43ec0 Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Fri, 21 Jun 2019 15:05:50 +0530 Subject: [PATCH 13/20] added service in the modal spec file --- src/app/components/utility/modal/modal.component.spec.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/components/utility/modal/modal.component.spec.ts b/src/app/components/utility/modal/modal.component.spec.ts index 6b74d250a..e557d4602 100644 --- a/src/app/components/utility/modal/modal.component.spec.ts +++ b/src/app/components/utility/modal/modal.component.spec.ts @@ -5,6 +5,10 @@ import { InputComponent } from '../input/input.component'; import { GlobalService } from '../../../services/global.service'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { HttpClientModule } from '@angular/common/http'; +import { ChallengeService } from '../../../services/challenge.service'; +import { ApiService } from './api.service'; +import { AuthService } from './auth.service'; +import { EndpointsService } from './endpoints.service'; describe('ModalComponent', () => { let component: ModalComponent; @@ -14,7 +18,7 @@ describe('ModalComponent', () => { TestBed.configureTestingModule({ declarations: [ ModalComponent, InputComponent ], imports: [ HttpClientModule ], - providers: [ GlobalService ], + providers: [ GlobalService, ChallengeService, EndpointsService, AuthService, ApiService ], schemas: [ NO_ERRORS_SCHEMA ] }) .compileComponents(); From 06d854f72ebf5d0c6e7f22facf83042084cb870b Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Fri, 21 Jun 2019 15:10:47 +0530 Subject: [PATCH 14/20] changed the path for the servies in the spec file of modal component --- src/app/components/utility/modal/modal.component.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/components/utility/modal/modal.component.spec.ts b/src/app/components/utility/modal/modal.component.spec.ts index e557d4602..d5dc09f75 100644 --- a/src/app/components/utility/modal/modal.component.spec.ts +++ b/src/app/components/utility/modal/modal.component.spec.ts @@ -6,9 +6,9 @@ import { GlobalService } from '../../../services/global.service'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { HttpClientModule } from '@angular/common/http'; import { ChallengeService } from '../../../services/challenge.service'; -import { ApiService } from './api.service'; -import { AuthService } from './auth.service'; -import { EndpointsService } from './endpoints.service'; +import { ApiService } from '../../../api.service'; +import { AuthService } from '../../../auth.service'; +import { EndpointsService } from '../../../endpoints.service'; describe('ModalComponent', () => { let component: ModalComponent; From 899ec286ac2a203e8137dcea6bb0d8bc93f9a5ba Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Fri, 21 Jun 2019 15:18:50 +0530 Subject: [PATCH 15/20] typo in modal component spec file --- src/app/components/utility/modal/modal.component.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/components/utility/modal/modal.component.spec.ts b/src/app/components/utility/modal/modal.component.spec.ts index d5dc09f75..70fe954d5 100644 --- a/src/app/components/utility/modal/modal.component.spec.ts +++ b/src/app/components/utility/modal/modal.component.spec.ts @@ -6,9 +6,9 @@ import { GlobalService } from '../../../services/global.service'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { HttpClientModule } from '@angular/common/http'; import { ChallengeService } from '../../../services/challenge.service'; -import { ApiService } from '../../../api.service'; -import { AuthService } from '../../../auth.service'; -import { EndpointsService } from '../../../endpoints.service'; +import { ApiService } from '../../../services/api.service'; +import { AuthService } from '../../../services/auth.service'; +import { EndpointsService } from '../../../services/endpoints.service'; describe('ModalComponent', () => { let component: ModalComponent; From 7625cefe3a7f9c93d95d149fb6f050254eabe098 Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Sun, 23 Jun 2019 21:46:25 +0530 Subject: [PATCH 16/20] changed the console log of delete challenge and edit challenge title API --- src/app/components/challenge/challenge.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/components/challenge/challenge.component.ts b/src/app/components/challenge/challenge.component.ts index ecad0c052..907a37e2f 100644 --- a/src/app/components/challenge/challenge.component.ts +++ b/src/app/components/challenge/challenge.component.ts @@ -191,7 +191,7 @@ export class ChallengeComponent implements OnInit { SELF.globalService.handleApiError(err, true); SELF.globalService.showToast('error', err); }, - () => console.log('PUBLISH-CHALLENGE-UPDATE-FINISHED') + () => console.log('EDIT-CHALLENGE-TITLE-FINISHED') ); }; @@ -236,7 +236,7 @@ export class ChallengeComponent implements OnInit { SELF.globalService.handleApiError(err, true); SELF.globalService.showToast('error', err); }, - () => console.log('PUBLISH-CHALLENGE-UPDATE-FINISHED') + () => console.log('DELETE-CHALLENGE-FINISHED') ); }; From a72332eb007c3cffcc3a5880a82618012b1aacd9 Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Mon, 24 Jun 2019 11:09:32 +0530 Subject: [PATCH 17/20] made the line length small to make it readable --- .../challenge/challenge.component.html | 161 +++++++++++------- 1 file changed, 98 insertions(+), 63 deletions(-) diff --git a/src/app/components/challenge/challenge.component.html b/src/app/components/challenge/challenge.component.html index cd44c99d7..ae4e64e42 100644 --- a/src/app/components/challenge/challenge.component.html +++ b/src/app/components/challenge/challenge.component.html @@ -2,69 +2,104 @@
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -

    - - - {{challenge['title']}} - - -   - - - - - - - - -
    - Organized by: {{challenge['creator']['team_name']}} - Organized by: {{challenge['creator']['team_name']}} - -
    - - - - {{publishChallenge.state}} - - - - -

    -
    -
    -
    - -
    -
    - -
    -
    - +
    +
    +
    +
    +
    + +
    +
    +
    +
    +

    + + + {{challenge['title']}} + + +   + + + + + + + + +
    + + Organized by: + + {{challenge['creator']['team_name']}} + + + + Organized by: + {{challenge['creator']['team_name']}} + +
    + + + {{publishChallenge.state}} + + + +

    +
    +
    +
    + +
    +
    + +
    +
    +
    From 5d91f03d2dca12381b21ec3c79fc43bd025e2ef6 Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Mon, 24 Jun 2019 13:40:28 +0530 Subject: [PATCH 18/20] removed unnecessary comments in confirm component --- src/app/components/utility/confirm/confirm.component.html | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/app/components/utility/confirm/confirm.component.html b/src/app/components/utility/confirm/confirm.component.html index 66c7180c4..f723f96c7 100644 --- a/src/app/components/utility/confirm/confirm.component.html +++ b/src/app/components/utility/confirm/confirm.component.html @@ -7,7 +7,6 @@ {{content}}
    -
      @@ -21,9 +20,5 @@
    - From 9b516ec83c97316e298cf90bf6444d0d1364fa05 Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Wed, 26 Jun 2019 20:00:06 +0530 Subject: [PATCH 19/20] formatted the challenge component html --- .../challenge/challenge.component.html | 161 ++++++++++++------ 1 file changed, 106 insertions(+), 55 deletions(-) diff --git a/src/app/components/challenge/challenge.component.html b/src/app/components/challenge/challenge.component.html index ae4e64e42..918d3b82a 100644 --- a/src/app/components/challenge/challenge.component.html +++ b/src/app/components/challenge/challenge.component.html @@ -14,86 +14,137 @@

    - + {{challenge['title']}}   - - + + - - + +
    - - Organized by: - - {{challenge['creator']['team_name']}} + + Organized by: + + {{challenge['creator']['team_name']}} - - Organized by: - {{challenge['creator']['team_name']}} + + Organized by: + {{challenge['creator']['team_name']}}
    - - - {{publishChallenge.state}} - + + + {{publishChallenge.state}} + +

    -
    From f97be817a663fd18fd3de540e1205c96873c8e8b Mon Sep 17 00:00:00 2001 From: Sanji515 Date: Thu, 27 Jun 2019 16:52:16 +0530 Subject: [PATCH 20/20] Made the apiCall component variable Instead of const made the apiCall a component variable so that it will be easy to write the test for the API call --- .../components/challenge/challenge.component.ts | 17 +++++++++++------ .../challengeoverview.component.ts | 9 +++++++-- .../challengesubmissions.component.ts | 9 +++++++-- src/app/components/profile/profile.component.ts | 13 +++++++++---- .../publiclists/teamlist/teamlist.component.ts | 17 +++++++++++------ 5 files changed, 45 insertions(+), 20 deletions(-) diff --git a/src/app/components/challenge/challenge.component.ts b/src/app/components/challenge/challenge.component.ts index 907a37e2f..1f35c85db 100644 --- a/src/app/components/challenge/challenge.component.ts +++ b/src/app/components/challenge/challenge.component.ts @@ -64,6 +64,11 @@ export class ChallengeComponent implements OnInit { */ isLoggedIn: any = false; + /** + * To call the API inside modal for editing the challenge details + */ + apiCall: any; + /** * Constructor. * @param route ActivatedRoute Injection. @@ -135,7 +140,7 @@ export class ChallengeComponent implements OnInit { isPublished = true; } - const apiCall = () => { + SELF.apiCall = () => { const BODY = JSON.stringify({ 'published': isPublished }); @@ -166,7 +171,7 @@ export class ChallengeComponent implements OnInit { content: '', confirm: 'Yes, I\'m sure', deny: 'No', - confirmCallback: apiCall + confirmCallback: SELF.apiCall }; SELF.globalService.showConfirm(PARAMS); } @@ -177,7 +182,7 @@ export class ChallengeComponent implements OnInit { editChallengeTitle() { const SELF = this; - const apiCall = (params) => { + SELF.apiCall = (params) => { const BODY = JSON.stringify(params); SELF.apiService.patchUrl( SELF.endpointsService.editChallengeDetailsURL(SELF.challenge.creator.id, SELF.challenge.id), @@ -210,7 +215,7 @@ export class ChallengeComponent implements OnInit { value: this.challenge.title }, ], - confirmCallback: apiCall + confirmCallback: SELF.apiCall }; SELF.globalService.showModal(PARAMS); } @@ -222,7 +227,7 @@ export class ChallengeComponent implements OnInit { const SELF = this; const redirectTo = '/dashboard'; - const apiCall = () => { + SELF.apiCall = () => { const BODY = JSON.stringify({}); SELF.apiService.postUrl( SELF.endpointsService.deleteChallengeURL(SELF.challenge.id), @@ -255,7 +260,7 @@ export class ChallengeComponent implements OnInit { value: '' }, ], - confirmCallback: apiCall + confirmCallback: SELF.apiCall }; SELF.globalService.showModal(PARAMS); } diff --git a/src/app/components/challenge/challengeoverview/challengeoverview.component.ts b/src/app/components/challenge/challengeoverview/challengeoverview.component.ts index 1302f87b8..5d7d55baa 100644 --- a/src/app/components/challenge/challengeoverview/challengeoverview.component.ts +++ b/src/app/components/challenge/challengeoverview/challengeoverview.component.ts @@ -25,6 +25,11 @@ export class ChallengeoverviewComponent implements OnInit { */ isChallengeHost = false; + /** + * To call the API inside modal for editing the challenge description + */ + apiCall: any; + /** * Constructor. * @param document Window document Injection. @@ -50,7 +55,7 @@ export class ChallengeoverviewComponent implements OnInit { editChallengeOverview() { const SELF = this; - const apiCall = (params) => { + SELF.apiCall = (params) => { const BODY = JSON.stringify(params); SELF.apiService.postUrl( SELF.endpointsService.editChallengeDetailsURL(SELF.challenge.creator.id, SELF.challenge.id), @@ -73,7 +78,7 @@ export class ChallengeoverviewComponent implements OnInit { content: 'asdasdasd \n\nasdasdasdasd', confirm: 'Submit', deny: 'Cancel', - confirmCallback: apiCall + confirmCallback: SELF.apiCall }; SELF.globalService.showModal(PARAMS); } diff --git a/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts b/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts index 3ca323ca6..77f932e5a 100644 --- a/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts +++ b/src/app/components/challenge/challengesubmissions/challengesubmissions.component.ts @@ -87,6 +87,11 @@ export class ChallengesubmissionsComponent implements OnInit, AfterViewInit { */ submissionHighlighted: any = null; + /** + * To call the API inside modal for editing the submission + */ + apiCall: any; + /** * Constructor. * @param route ActivatedRoute Injection. @@ -324,7 +329,7 @@ export class ChallengesubmissionsComponent implements OnInit, AfterViewInit { */ editSubmission(submission) { const SELF = this; - const apiCall = (params) => { + SELF.apiCall = (params) => { const BODY = JSON.stringify(params); SELF.apiService.patchUrl( SELF.endpointsService.challengeSubmissionUpdateURL(SELF.challenge.id, submission.challenge_phase, submission.id), @@ -376,7 +381,7 @@ export class ChallengesubmissionsComponent implements OnInit, AfterViewInit { value: submission['publication_url'] } ], - confirmCallback: apiCall + confirmCallback: SELF.apiCall }; SELF.globalService.showModal(PARAMS); } diff --git a/src/app/components/profile/profile.component.ts b/src/app/components/profile/profile.component.ts index 785402a5f..8cba4d73b 100644 --- a/src/app/components/profile/profile.component.ts +++ b/src/app/components/profile/profile.component.ts @@ -48,6 +48,11 @@ export class ProfileComponent implements OnInit { */ isTokenModalVisible = false; + /** + * To call the API inside modal for updating the user details and password + */ + apiCall: any; + /** * Form components from 'formtoken' */ @@ -121,7 +126,7 @@ export class ProfileComponent implements OnInit { */ updateUserDetails() { const SELF = this; - const apiCall = (params) => { + SELF.apiCall = (params) => { const BODY = JSON.stringify(params); console.log(params); SELF.apiService.putUrl(SELF.endpointsService.userDetailsURL(), @@ -165,7 +170,7 @@ export class ProfileComponent implements OnInit { value: this.user['affiliation'] } ], - confirmCallback: apiCall + confirmCallback: SELF.apiCall }; SELF.globalService.showModal(PARAMS); @@ -194,7 +199,7 @@ export class ProfileComponent implements OnInit { */ updatePassword() { const SELF = this; - const apiCall = (params) => { + SELF.apiCall = (params) => { const BODY = JSON.stringify(params); console.log(params); SELF.apiService.postUrl(SELF.endpointsService.changePasswordURL(), @@ -241,7 +246,7 @@ export class ProfileComponent implements OnInit { type: 'password' } ], - confirmCallback: apiCall + confirmCallback: SELF.apiCall }; SELF.globalService.showModal(PARAMS); } diff --git a/src/app/components/publiclists/teamlist/teamlist.component.ts b/src/app/components/publiclists/teamlist/teamlist.component.ts index c29d2f940..1d1ce81d7 100644 --- a/src/app/components/publiclists/teamlist/teamlist.component.ts +++ b/src/app/components/publiclists/teamlist/teamlist.component.ts @@ -107,6 +107,11 @@ export class TeamlistComponent implements OnInit { */ challenge: any; + /** + * To call the API inside the modal + */ + apiCall: any; + /** * Form components */ @@ -265,7 +270,7 @@ export class TeamlistComponent implements OnInit { deleteTeamWrapper() { const SELF = this; const deleteTeam = (e) => { - const apiCall = () => { + SELF.apiCall = () => { SELF.apiService.deleteUrl(SELF.deleteTeamsPath + '/' + e).subscribe( data => { // Success Message in data.message @@ -284,7 +289,7 @@ export class TeamlistComponent implements OnInit { content: 'Note: This action will remove you from the team.', confirm: 'Yes', deny: 'Cancel', - confirmCallback: apiCall + confirmCallback: SELF.apiCall }; SELF.globalService.showConfirm(PARAMS); return false; @@ -298,7 +303,7 @@ export class TeamlistComponent implements OnInit { editTeamWrapper() { const SELF = this; const editTeam = (team) => { - const apiCall = (params) => { + SELF.apiCall = (params) => { const BODY = JSON.stringify(params); SELF.apiService.patchUrl(SELF.endpointsService.participantTeamURL(team), BODY).subscribe( data => { @@ -333,7 +338,7 @@ export class TeamlistComponent implements OnInit { type: 'text' } ], - confirmCallback: apiCall + confirmCallback: SELF.apiCall }; SELF.globalService.showModal(PARAMS); }; @@ -346,7 +351,7 @@ export class TeamlistComponent implements OnInit { addMembersToTeamWrapper() { const SELF = this; const addMembersToTeam = (team) => { - const apiCall = (params) => { + SELF.apiCall = (params) => { const BODY = JSON.stringify(params); let apiPath = SELF.endpointsService.participantTeamInviteURL(team); if (SELF.isHost) { @@ -379,7 +384,7 @@ export class TeamlistComponent implements OnInit { type: 'email' } ], - confirmCallback: apiCall + confirmCallback: SELF.apiCall }; SELF.globalService.showModal(PARAMS); };