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

Commit

Permalink
Admin Checklist and HC2019 Bug Fixes/Tweaks (#25)
Browse files Browse the repository at this point in the history
* Feature commit
* New favicons, resized logo and fixed typo
* Added sponsors schedule and fixed a favicon bug
* Fixed bug where Product Demo header showed even when the sponsor didn't have one
* Fixed bug where an empty blank mentor broke page rendering
* Fixed empty array bug when adding/removing people, and added clarification about the start time to the sponsors' schedule
  • Loading branch information
Harri Bell-Thomas authored Jan 15, 2019
1 parent 1a083aa commit 4d74856
Show file tree
Hide file tree
Showing 38 changed files with 414 additions and 154 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ src/environments/firebase.ts
# Firebase
.firebaserc
functions/*
.firebase/*
12 changes: 10 additions & 2 deletions src/app/admin/admin.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<h1 rows="1">Admin Interface</h1>
<h3 rows="1">Registered sponsors</h3>
<a rel="next" rows="0.5" *ngFor="let sponsor of sponsors" [routerLink]="[ '/', sponsor.id ]">{{ sponsor.name }}</a>
<br>
<div *ngFor="let sponsor of sponsors">
<p style="margin: 20px 0;"><a style="font-weight: 700;font-size: large;" rel="next" [routerLink]="[ '/', sponsor.id ]">{{ sponsor.name }}</a></p>
<ul>
<li *ngFor="let note of sponsor.notes"><a href="{{ note.link }}">{{ note.text }}</a></li>
</ul>
<hr style="border: 0.5px solid red;margin-top: 20px;">
</div>

<div rows="0.5">
<button [routerLink]="[ '/admin/new' ]">Add Sponsor &rarr;</button>
<button [routerLink]="[ '/admin/new' ]">Add Sponsor &rarr;</button>
</div>
150 changes: 147 additions & 3 deletions src/app/admin/admin.component.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,164 @@
import { SponsorIndexModel } from 'app/admin/sponsor-index.model';
import { SponsorNoteModel } from 'app/admin/sponsor-note.model';
import { AdminService } from 'app/admin/admin.service';
import { BenefitsService } from 'app/benefits/benefits.service';
import { EventsService } from 'app/events/events.service';
import { PeopleService } from 'app/people/people.service';
import { PresentationService } from 'app/presentation/presentation.service';
import { SponsorsService } from 'app/sponsors/sponsors.service';
import { TechService } from 'app/tech/tech.service';
import { WorkshopService } from 'app/workshops/workshop.service';
import { Component } from '@angular/core';
import { LayoutService } from 'app/layout.service';
import { SponsorshipBenefitModel } from 'app/benefits/sponsorship-benefit.model';
import { first } from 'rxjs/operators';

@Component({
selector: 'section[component="admin"][grid="rows"]',
selector: 'section[component="admin"]',
templateUrl: './admin.component.html'
})
export class AdminComponent {
sponsors: SponsorIndexModel[];

constructor(private adminService: AdminService,
private layoutService: LayoutService) {
private layoutService: LayoutService,
private benefitsService: BenefitsService,
private workshopService: WorkshopService,
private eventsService: EventsService,
private peopleService: PeopleService,
private techService: TechService,
private presentationService: PresentationService) {
adminService.getSponsors().subscribe(
sponsors => this.sponsors = (sponsors ? sponsors.sort((a, b) => a.name.localeCompare(b.name)) : [])
sponsors => {
this.sponsors = (sponsors ? sponsors.sort((a, b) => a.name.localeCompare(b.name)) : []);
for (let sponsor of this.sponsors) {
this.benefitsService.getSponsorBenefitDescriptions(sponsor.id).pipe(first()).subscribe(
benefits => sponsor.notes = this.generateSponsorNotes(sponsor.id, benefits)
);
}
}
);
this.layoutService.setLayoutMode('a4');
}

private generateSponsorNotes(guid: string, benefits: SponsorshipBenefitModel[]): SponsorNoteModel[] {
var sponsorNotes: SponsorNoteModel[] = []

if(this.benefitsService.hasProductDemoSlot(benefits)) {
this.workshopService.getDoingProductDemo(guid).pipe(first()).subscribe(
doingProductDemo => {
if(doingProductDemo == null) {
sponsorNotes.push({
text: "No Product Demo Information Submitted",
link: guid + "/workshops"
});
}
}
);
}

if(this.benefitsService.hasWorkshopSlot(benefits)) {
this.workshopService.getDoingWorkshop(guid).pipe(first()).subscribe(
doingWorkshop => {
if(doingWorkshop == null) {
sponsorNotes.push({
text: "No Workshop Information Submitted",
link: guid + "/workshops"
});
}
}
);
}


if (this.benefitsService.canRunCompetitionAndEvents(benefits)) {
this.eventsService.getCompetitions(guid).pipe(first()).subscribe(
competitions => {
var hardwareAPIComp = competitions == null ?
false :
competitions["doingHardwareApiCompetition"] !== undefined;

var sideEventFlag = competitions == null ?
false :
competitions["doingSideEvent"] !== undefined;

var themedComp = competitions == null ?
false :
competitions["doingThemedCompetition"] !== undefined;

if(!hardwareAPIComp) {
sponsorNotes.push({
text: "No Hardware/API Competition Information Submitted",
link: guid + "/events"
});
}
if(!sideEventFlag) {
sponsorNotes.push({
text: "No Side Event Information Submitted",
link: guid + "/events"
});
}
if(!themedComp) {
sponsorNotes.push({
text: "No Themed Competition Information Submitted",
link: guid + "/events"
});
}
}
);
}

if (this.benefitsService.canRunOpeningCeremonyPresentation(benefits)) {
this.presentationService.getUploadedPresentation(guid).pipe(first()).subscribe(
presentation => {
if(presentation != null) {
sponsorNotes.push({
text: "No Opening Ceremony Presentation Submitted",
link: guid + "/presentation"
});
}
}
);
}

this.peopleService.getMentors(guid).pipe(first()).subscribe(
mentors => {
var numMentors = mentors == null ? 0 : mentors.length;
sponsorNotes.push({
text: "Mentors: " + numMentors,
link: guid + "/people"
});
}
);

this.benefitsService.getMaxNumberOfRecruiters(guid).subscribe(
limit => {
if(limit > 0) {
this.peopleService.getRecruiters(guid).pipe(first()).subscribe(
recruiters => {
var numRecruiters = recruiters == null ? 0 : recruiters.length;
sponsorNotes.push({
text: "Recruiters: " + numRecruiters,
link: guid + "/people"
});
}
);
}
}
);

if (this.benefitsService.canListHardwareAndApis(benefits)) {
this.techService.getTechList(guid).pipe(first()).subscribe(
tech => {
var numTech = tech == null ? 0 : tech.length;
sponsorNotes.push({
text: "Items of Tech: " + numTech,
link: guid + "/tech"
});
}
);
}

return sponsorNotes;
}
}
4 changes: 2 additions & 2 deletions src/app/admin/admin.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { throwError as observableThrowError, Observable, defer, of, concat } from 'rxjs';
import { Injectable } from '@angular/core';
import { AngularFireObject, AngularFireDatabase, AngularFireList } from '@angular/fire/database';
Expand Down Expand Up @@ -97,7 +96,8 @@ export class AdminService {
private addSponsorIndex(guid: string, name: string): Observable<void> {
const index: SponsorIndexModel = {
id: guid,
name: name
name: name,
notes: []
};

const indexObjects = this.getSponsorIndexObjects();
Expand Down
3 changes: 3 additions & 0 deletions src/app/admin/sponsor-index.model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { SponsorNoteModel } from 'app/admin/sponsor-note.model';

export class SponsorIndexModel {
id: string;
name: string;
notes: SponsorNoteModel[] = [];
}
4 changes: 4 additions & 0 deletions src/app/admin/sponsor-note.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export class SponsorNoteModel {
text: string;
link: string;
}
8 changes: 4 additions & 4 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<header [attr.layout]=gridLayout grid="grid" rows="2.0">
<header [attr.layout]=gridLayout grid="grid" rows="1.5">
<img columns="2.5" draggable="false" src="/assets/images/logo.svg" alt="Hack Cambridge Logo"/>
<div columns="5.5">
<h1 id="wordmark">Hack Cambridge<br><span class="pixel">Sponsors' Portal</span></h1>
Expand All @@ -14,13 +14,13 @@ <h3 columns="8.0">Hi {{ companyName }}!</h3>
<div>
<ul>
<li>
<a rel="next" href="/terms-and-conditions">Terms and Conditions</a>
<a rel="next" target="_blank" href="https://hackcambridge.com/terms-and-conditions">Terms and Conditions</a>
</li>
<li>
<a rel="next" href="/privacy-policy">Privacy Policy</a>
<a rel="next" target="_blank" href="https://hackcambridge.com/privacy-policy">Privacy Policy</a>
</li>
<li>
<a rel="next" href="/faqs">FAQs</a>
<a rel="next" target="_blank" href="https://hackcambridge.com/faqs">FAQs</a>
</li>
<li>
<a rel="next" href="https://static.mlh.io/docs/mlh-code-of-conduct.pdf">MLH Code of Conduct</a>
Expand Down
6 changes: 4 additions & 2 deletions src/app/people/people.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ export class PeopleComponent extends BaseComponent implements OnInit {
);

this.peopleService.getMentors(guid).pipe(first()).subscribe(
mentors => this.mentors = mentors ? mentors : []
mentors => this.mentors = mentors ? mentors.filter(n => n) : []
);

this.peopleService.getRecruiters(guid).pipe(first()).subscribe(
recruiters => this.recruiters = recruiters ? recruiters : []
recruiters => this.recruiters = recruiters.filter(n => n) ? recruiters : []
);
}
);
Expand All @@ -69,6 +69,7 @@ export class PeopleComponent extends BaseComponent implements OnInit {
deleteMentor(index: number): void {
if (this.mentors[index]) {
this.mentors.splice(index, 1);
this.mentors = this.mentors.filter(n => n);
}

this.onMentorChanges();
Expand All @@ -94,6 +95,7 @@ export class PeopleComponent extends BaseComponent implements OnInit {
deleteRecruiter(index: number): void {
if (this.recruiters[index]) {
this.recruiters.splice(index, 1);
this.recruiters = this.recruiters.filter(n => n);
}

this.onRecruiterChanges();
Expand Down
2 changes: 1 addition & 1 deletion src/app/portal/portal.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h2 rows="1.0">Checklist</h2>
<div rows="3.5" columns="4.5" grid="rows">
<h2 rows="1.0">Key Info</h2>
<h3 rows="2.5">
<time datetime="2018-01-20">Saturday and Sunday<br>20/01/18–21/01/18</time><br>
<time datetime="2018-01-20">Saturday and Sunday<br>19/01/19–20/01/19</time><br>
<address>2 Wheeler St<br>Cambridge<br>CB2 3QB</address>
</h3>
</div>
Expand Down
44 changes: 24 additions & 20 deletions src/app/portal/portal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,27 +83,31 @@ export class PortalComponent extends BaseComponent implements OnInit {
if (this.benefitsService.canRunWorkshopLikeEvent(benefits)) {
this.portalLinks.push({ pageUrl: 'workshops', text: 'Submit your workshops' });

this.workshopService.getDoingProductDemo(guid).pipe(first()).subscribe(
doingProductDemo => {
this.todoLinks.push({
pageUrl: 'workshops',
text: 'Submit product demo information',
checked: doingProductDemo !== null,
care: true
});
}
);
if(this.benefitsService.hasProductDemoSlot(benefits)) {
this.workshopService.getDoingProductDemo(guid).pipe(first()).subscribe(
doingProductDemo => {
this.todoLinks.push({
pageUrl: 'workshops',
text: 'Submit product demo information',
checked: doingProductDemo !== null,
care: true
});
}
);
}

this.workshopService.getDoingWorkshop(guid).pipe(first()).subscribe(
doingWorkshop => {
this.todoLinks.push({
pageUrl: 'workshops',
text: 'Submit workshop information',
checked: doingWorkshop !== null,
care: true
});
}
);
if(this.benefitsService.hasWorkshopSlot(benefits)) {
this.workshopService.getDoingWorkshop(guid).pipe(first()).subscribe(
doingWorkshop => {
this.todoLinks.push({
pageUrl: 'workshops',
text: 'Submit workshop information',
checked: doingWorkshop !== null,
care: true
});
}
);
}
}

// This year we will not be asking for swag details via this, as we have
Expand Down
Loading

0 comments on commit 4d74856

Please sign in to comment.