diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 7f7e05b..2c1ff15 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -68,6 +68,11 @@ import { AssessmentComponent } from './assessment/assessment.component';
import { AdminAssessmentsListComponent } from './admin/assessments/list.component';
import { CreateMicroProjectAssessmentComponent } from './assessment/micro-project/create.component';
import { FormComponent as ContributionsFormComponent } from './contributions/form.component';
+import { StackOverflowComponent } from './contributions/stack-overflow.component';
+import { PublicActivityComponent } from './contributions/public-activity.component';
+import { SideProjectComponent } from './contributions/side-project.component';
+import { OpenSourceComponent } from './contributions/open-source.component';
+import { StatusComponent } from './contributions/status.component';
@NgModule({
@@ -109,7 +114,12 @@ import { FormComponent as ContributionsFormComponent } from './contributions/for
AssessmentComponent,
AdminAssessmentsListComponent,
CreateMicroProjectAssessmentComponent,
- ContributionsFormComponent
+ ContributionsFormComponent,
+ StackOverflowComponent,
+ PublicActivityComponent,
+ SideProjectComponent,
+ OpenSourceComponent,
+ StatusComponent
],
imports: [
BrowserModule,
diff --git a/src/app/contributions/contributions.component.ts b/src/app/contributions/contributions.component.ts
index 1c2b65a..6523006 100644
--- a/src/app/contributions/contributions.component.ts
+++ b/src/app/contributions/contributions.component.ts
@@ -1,8 +1,4 @@
import { Component, OnInit } from '@angular/core';
-import {FormBuilder, FormGroup} from '@angular/forms';
-
-import {AuthService} from '../services/auth.service';
-import {User} from '../classes/user';
@Component({
selector: 'xp-contributions',
@@ -10,122 +6,21 @@ import {User} from '../classes/user';
Greetings, friend
Here you could fill out some interesting information about yourself and earn some experience points while you're at it!
Each column below represents something that we value highly. Feel free to fill them in and gain some points after the admin validates. :)
-
-
-
Stack overflow account
-
Try to earn some points by giving your stack overflow account
-
- Click here
-
-
-
-
-
-
Public activity
-
Some public activity info
-
- Click here
-
-
-
-
-
-
Side Project
-
Please share your side projects with us info
-
- Click here
-
-
-
-
-
-
Open source contributions
-
You've contributed to a project? Please share it with us
-
- Click here
-
-
-
-
+
+
+
+
+
`,
styles: []
})
export class ContributionsComponent implements OnInit {
- private selectedForm: string = null;
- private form: FormGroup;
- private loggedUser: User;
- constructor(
- private formBuilder: FormBuilder,
- private authService: AuthService,
- ) {}
+ constructor() {}
ngOnInit() {
- this.loggedUser = this.authService.getLoggedUser();
-
- this.form = this.formBuilder.group({
- stack_overflow_account: this.loggedUser.attributes.stack_overflow_account
- });
- }
-
- showForm(value) {
- switch (value) {
- case 'stackOverflow':
- this.form = this.formBuilder.group({
- stack_overflow_account: this.loggedUser.attributes.stack_overflow_account
- });
- break;
- case 'publicActivity':
- this.form = this.formBuilder.group({
- public_activity: this.loggedUser.attributes.public_activity
- });
- break;
- case 'sideProject':
- this.form = this.formBuilder.group({
- side_project: this.loggedUser.attributes.side_project
- });
- break;
- case 'openSource':
- this.form = this.formBuilder.group({
- open_source_contributions: this.loggedUser.attributes.open_source_contributions
- });
- break;
- }
- this.selectedForm = value;
- }
-
- handleCancel() {
- this.selectedForm = null;
- }
-
- changeUser(value) {
- this.loggedUser = value;
+ //
}
}
diff --git a/src/app/contributions/open-source.component.ts b/src/app/contributions/open-source.component.ts
new file mode 100644
index 0000000..fe3e967
--- /dev/null
+++ b/src/app/contributions/open-source.component.ts
@@ -0,0 +1,70 @@
+import {Component, OnInit} from '@angular/core';
+import {User} from "../classes/user";
+import {FormGroup, FormBuilder} from "@angular/forms";
+import {AuthService} from "../services/auth.service";
+
+@Component({
+ selector: 'xp-open-source',
+ template: `
+
+
Open source contributions
+
+
+
+
You've contributed to a project? Please share it with us
+
+ Click here
+
+
+
+
+
+ `,
+ styles: []
+})
+export class OpenSourceComponent implements OnInit {
+ private isVisible: boolean = false;
+ private loggedUser: User = null;
+ private form: FormGroup;
+
+ constructor(
+ private formBuilder: FormBuilder,
+ private authService: AuthService,
+ ) { }
+
+ ngOnInit() {
+ this.loggedUser = this.authService.getLoggedUser();
+ }
+
+ handleCancel() {
+ this.isVisible = false;
+ }
+
+ changeUser(value) {
+ this.loggedUser = value;
+ }
+
+ showForm() {
+ this.form = this.formBuilder.group({
+ open_source_contributions: this.loggedUser.attributes.open_source_contributions
+ });
+ this.isVisible = true;
+ }
+
+ shouldSeeForm() {
+ return typeof(this.loggedUser.bonus_points['open_source_contributions']) === 'undefined';
+ }
+
+ shouldSeeStatus() {
+ return typeof(this.loggedUser.bonus_points['open_source_contributions']) !== 'undefined'
+ }
+
+}
diff --git a/src/app/contributions/public-activity.component.ts b/src/app/contributions/public-activity.component.ts
new file mode 100644
index 0000000..c560e88
--- /dev/null
+++ b/src/app/contributions/public-activity.component.ts
@@ -0,0 +1,70 @@
+import {Component, OnInit} from '@angular/core';
+import {User} from "../classes/user";
+import {FormGroup, FormBuilder} from "@angular/forms";
+import {AuthService} from "../services/auth.service";
+
+@Component({
+ selector: 'xp-public-activity',
+ template: `
+
+
Public activity
+
+
+
+
Some public activity info
+
+ Click here
+
+
+
+
+
+ `,
+ styles: []
+})
+export class PublicActivityComponent implements OnInit {
+ private loggedUser: User = null;
+ private form: FormGroup;
+ private isVisible: boolean = false;
+
+ constructor(
+ private formBuilder: FormBuilder,
+ private authService: AuthService,
+ ) { }
+
+ ngOnInit() {
+ this.loggedUser = this.authService.getLoggedUser();
+ }
+
+ handleCancel() {
+ this.isVisible = false;
+ }
+
+ changeUser(value) {
+ this.loggedUser = value;
+ }
+
+ showForm() {
+ this.form = this.formBuilder.group({
+ public_activity: this.loggedUser.attributes.public_activity
+ });
+ this.isVisible = true;
+ }
+
+ shouldSeeForm() {
+ return typeof(this.loggedUser.bonus_points['public_activity']) === 'undefined';
+ }
+
+ shouldSeeStatus() {
+ return typeof(this.loggedUser.bonus_points['public_activity']) !== 'undefined'
+ }
+
+}
diff --git a/src/app/contributions/side-project.component.ts b/src/app/contributions/side-project.component.ts
new file mode 100644
index 0000000..f977291
--- /dev/null
+++ b/src/app/contributions/side-project.component.ts
@@ -0,0 +1,69 @@
+import {Component, OnInit} from '@angular/core';
+import {User} from "../classes/user";
+import {FormGroup, FormBuilder} from "@angular/forms";
+import {AuthService} from "../services/auth.service";
+
+@Component({
+ selector: 'xp-side-project',
+ template: `
+
+
Side Project
+
+
+
+
Please share your side projects with us info
+
+ Click here
+
+
+
+
+
+ `,
+ styles: []
+})
+export class SideProjectComponent implements OnInit {
+ private loggedUser: User = null;
+ private form: FormGroup;
+ private isVisible: boolean = false;
+
+ constructor(
+ private formBuilder: FormBuilder,
+ private authService: AuthService,
+ ) { }
+
+ ngOnInit() {
+ this.loggedUser = this.authService.getLoggedUser();
+ }
+
+ handleCancel() {
+ this.isVisible = false;
+ }
+
+ changeUser(value) {
+ this.loggedUser = value;
+ }
+
+ showForm() {
+ this.form = this.formBuilder.group({
+ side_project: this.loggedUser.attributes.side_project
+ });
+ this.isVisible = true;
+ }
+
+ shouldSeeForm() {
+ return typeof(this.loggedUser.bonus_points['side_project']) === 'undefined';
+ }
+
+ shouldSeeStatus() {
+ return typeof(this.loggedUser.bonus_points['side_project']) !== 'undefined'
+ }
+}
diff --git a/src/app/contributions/stack-overflow.component.ts b/src/app/contributions/stack-overflow.component.ts
new file mode 100644
index 0000000..a2d6e4c
--- /dev/null
+++ b/src/app/contributions/stack-overflow.component.ts
@@ -0,0 +1,70 @@
+import {Component, OnInit} from '@angular/core';
+import {FormGroup, FormBuilder} from "@angular/forms";
+
+import {User} from "../classes/user";
+import {AuthService} from "../services/auth.service";
+
+@Component({
+ selector: 'xp-stack-overflow',
+ template: `
+
+
Stack overflow account
+
+
+
+
Try to earn some points by giving your stack overflow account
+
+ Click here
+
+
+
+
+
+ `,
+ styles: []
+})
+export class StackOverflowComponent implements OnInit {
+ private isVisible: boolean = false;
+ private loggedUser: User = null;
+ private form: FormGroup;
+
+ constructor(
+ private formBuilder: FormBuilder,
+ private authService: AuthService,
+ ) { }
+
+ ngOnInit() {
+ this.loggedUser = this.authService.getLoggedUser();
+ }
+
+ handleCancel() {
+ this.isVisible = false;
+ }
+
+ changeUser(value) {
+ this.loggedUser = value;
+ }
+
+ showForm() {
+ this.form = this.formBuilder.group({
+ stack_overflow_account: this.loggedUser.attributes.stack_overflow_account
+ });
+ this.isVisible = true;
+ }
+
+ shouldSeeForm() {
+ return typeof(this.loggedUser.bonus_points['stack_overflow_account']) === 'undefined';
+ }
+
+ shouldSeeStatus() {
+ return typeof(this.loggedUser.bonus_points['stack_overflow_account']) !== 'undefined'
+ }
+}
diff --git a/src/app/contributions/status.component.ts b/src/app/contributions/status.component.ts
new file mode 100644
index 0000000..f32f35e
--- /dev/null
+++ b/src/app/contributions/status.component.ts
@@ -0,0 +1,24 @@
+import {Component, OnInit, Input} from '@angular/core';
+
+@Component({
+ selector: 'xp-contributions-status',
+ template: `
+
+ Awarded!
+
+
+
Points earned: {{ points }}
+
+ `,
+ styles: []
+})
+export class StatusComponent implements OnInit {
+ @Input() points: number;
+
+ constructor() { }
+
+ ngOnInit() {
+ //
+ }
+
+}