Refactoring.
This commit is contained in:
Родитель
7ad1fd12e5
Коммит
b7462e22c8
87
README.md
87
README.md
|
@ -1 +1,88 @@
|
|||
# Team Spirit
|
||||
|
||||
## TODO:
|
||||
|
||||
Login/register with BS
|
||||
|
||||
Upcoming events
|
||||
- list of events
|
||||
- event name
|
||||
- group
|
||||
- date
|
||||
- days left
|
||||
|
||||
Single event
|
||||
- image
|
||||
- name
|
||||
- description
|
||||
- location
|
||||
- date and time (TBD) or November 1st, 2016 18:00
|
||||
- organizer
|
||||
- group
|
||||
- links to photos
|
||||
* registered participants
|
||||
* link to register
|
||||
* rating for the event
|
||||
|
||||
Past events
|
||||
- list of events in the past
|
||||
|
||||
User profile
|
||||
-
|
||||
|
||||
------------------
|
||||
|
||||
Create group
|
||||
- name Backend Services Team
|
||||
- description Only members of the Backend Services team can join this group.
|
||||
- image
|
||||
- approval
|
||||
- period for events
|
||||
* public
|
||||
|
||||
Join group
|
||||
- search group by name
|
||||
- when you click a group youcan see its name and description and number of users
|
||||
- you can then join or ask to join
|
||||
|
||||
|
||||
My groups
|
||||
- list of all groups you are member of
|
||||
|
||||
Single group
|
||||
- name
|
||||
- description
|
||||
- image
|
||||
- members
|
||||
- approval
|
||||
- period of events
|
||||
- invite users to this group
|
||||
- last event
|
||||
|
||||
- Server logic
|
||||
-
|
||||
|
||||
|
||||
|
||||
|
||||
-----------------------
|
||||
|
||||
Event/activity ideas
|
||||
- list of event ideas
|
||||
|
||||
Single event idea
|
||||
-
|
||||
|
||||
|
||||
|
||||
|
||||
Plan
|
||||
Lyubo
|
||||
- create data model in server
|
||||
- server logic
|
||||
Georgi 1 i 2
|
||||
- NativeScript app
|
||||
- repo
|
||||
Kateto
|
||||
- Wireframes
|
||||
-
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { Component, OnInit, ViewChild } from "@angular/core";
|
||||
import { EverliveProvider, UsersService, EventsService, EventRegistrationsService } from './services';
|
||||
import { RouterExtensions } from 'nativescript-angular/router'
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { RadSideDrawerComponent } from 'nativescript-telerik-ui/sidedrawer/angular'
|
||||
|
||||
@Component({
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Label {
|
||||
background-color: white;
|
||||
color: white;
|
||||
}
|
|
@ -4,10 +4,12 @@ import * as utils from 'utils/utils';
|
|||
|
||||
import { EventsService, UsersService } from '../../services';
|
||||
import { Event, User } from '../../shared/models';
|
||||
import { utilities } from '../../shared';
|
||||
|
||||
@Component({
|
||||
selector: 'event-details',
|
||||
templateUrl: 'events/event-details/event-details.template.html'
|
||||
templateUrl: 'events/event-details/event-details.template.html',
|
||||
styleUrls: [ 'events/event-details/event-details.component.css' ]
|
||||
})
|
||||
export class EventDetailsComponent implements OnInit {
|
||||
event: Event;
|
||||
|
@ -35,11 +37,18 @@ export class EventDetailsComponent implements OnInit {
|
|||
})
|
||||
.then(currentUser => {
|
||||
this.alreadyRegistered = this.registeredUsers.filter(u => u.Id === currentUser.Id).length > 0;
|
||||
})
|
||||
.catch(e => {
|
||||
alert('An error occured: ' + JSON.stringify(e));
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
getResizedImageUrl(rawUrl: string): string {
|
||||
return utilities.getAsResizeUrl(rawUrl);
|
||||
}
|
||||
|
||||
getRegisterBtnText() {
|
||||
if (this.alreadyRegistered) {
|
||||
return 'Already Registered';
|
||||
|
@ -49,6 +58,7 @@ export class EventDetailsComponent implements OnInit {
|
|||
}
|
||||
|
||||
getRating() {
|
||||
// TODO
|
||||
return `Rating: 4.98 out of 5`;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<StackLayout>
|
||||
<StackLayout *ngIf="event">
|
||||
<Image *ngIf="event.Image" src="{{event.ImageUrl}}"></Image>
|
||||
<Image *ngIf="event.Image" src="{{getResizedImageUrl(event.ImageUrl)}}"></Image>
|
||||
<Label [text]="getRating()"></Label>
|
||||
|
||||
<Button [text]="getRegisterBtnText()" (tap)="register()" [disabled]="alreadyRegistered"></Button>
|
||||
|
|
|
@ -4,6 +4,7 @@ import { Page } from 'ui/page';
|
|||
|
||||
import { EventsService } from '../../services';
|
||||
import { Event } from '../../shared/models';
|
||||
import { utilities } from '../../shared';
|
||||
|
||||
@Component({
|
||||
selector: 'upcoming-events',
|
||||
|
@ -26,7 +27,6 @@ export class UpcomingEventsComponent implements OnInit {
|
|||
this._eventsService.getUpcoming()
|
||||
.then(events => {
|
||||
this.events = events;
|
||||
// this.handleError(events);
|
||||
}, this.handleError);
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,10 @@ export class UpcomingEventsComponent implements OnInit {
|
|||
return date;
|
||||
}
|
||||
|
||||
getResizedImageUrl(rawUrl: string): string {
|
||||
return utilities.getAsResizeUrl(rawUrl);
|
||||
}
|
||||
|
||||
getRemainingTime(event: Event) {
|
||||
let oneDay = 24 * 60 * 60 * 1000;
|
||||
let eventDate = this.getEventDate(event);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<Label *ngIf="getEventDate(event)" [text]="getEventDate(event) | date:dateFormat | uppercase" col="0" class="event-date"></Label>
|
||||
<Label [text]="getRemainingTime(event)" col="1" class="event-remaining-time"></Label>
|
||||
</GridLayout>
|
||||
<Image *ngIf="event.Image" src="{{event.ImageUrl}}"></Image>
|
||||
<Image *ngIf="event.Image" src="{{getResizedImageUrl(event.ImageUrl)}}"></Image>
|
||||
<Label [text]="event.Description" textWrap="true" class="event-description"></Label>
|
||||
<StackLayout orientation="horizontal" class="event-organiser">
|
||||
<Label [text]="event.Organizer.DisplayName + ' | '"></Label>
|
||||
|
|
|
@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core'
|
|||
import { RouterExtensions } from 'nativescript-angular/router'
|
||||
import { Page } from 'ui/page'
|
||||
import { UsersService } from '../services'
|
||||
import { User } from '../shared'
|
||||
|
||||
@Component({
|
||||
selector: 'login',
|
||||
|
@ -35,11 +34,11 @@ export class LoginComponent implements OnInit {
|
|||
login() {
|
||||
this._usersService.login(this.user.username, this.user.password)
|
||||
.then(() => {
|
||||
console.log('LOGGED IN')
|
||||
console.log('LOGGED IN');
|
||||
this._routerExtensions.navigate(['events/upcoming']);
|
||||
})
|
||||
.catch((e: Error) => {
|
||||
console.error(e.message)
|
||||
console.error(e.message);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Data } from '../../node_modules/everlive-sdk/dist/declarations/everlive/types/Data';
|
||||
import { Query } from '../../node_modules/everlive-sdk/dist/declarations/everlive/query/Query';
|
||||
|
||||
import { EverliveProvider } from './everlive-provider.service';
|
||||
import { EventRegistration } from '../shared/models';
|
||||
|
@ -22,7 +21,7 @@ export class EventRegistrationsService {
|
|||
};
|
||||
|
||||
constructor(private _elProvider: EverliveProvider) {
|
||||
this._data = this._elProvider.get.data('EventRegistrations');
|
||||
this._data = this._elProvider.get.data<EventRegistration>('EventRegistrations');
|
||||
}
|
||||
|
||||
getParticipants(eventId: string): any {
|
||||
|
|
|
@ -21,16 +21,17 @@ export class EventsService {
|
|||
ReturnAs: 'Organizer'
|
||||
},
|
||||
Image: {
|
||||
'ReturnAs': 'ImageUrl',
|
||||
'SingleField': 'Uri'
|
||||
ReturnAs: 'ImageUrl',
|
||||
SingleField: 'Uri'
|
||||
}
|
||||
};
|
||||
|
||||
constructor(
|
||||
private _elProvider: EverliveProvider,
|
||||
private _registrationsService: EventRegistrationsService,
|
||||
private _usersService: UsersService) {
|
||||
this._data = this._elProvider.get.data('Events');
|
||||
private _usersService: UsersService
|
||||
) {
|
||||
this._data = this._elProvider.get.data<Event>('Events');
|
||||
}
|
||||
|
||||
getAll() {
|
||||
|
@ -38,7 +39,9 @@ export class EventsService {
|
|||
}
|
||||
|
||||
getById(eventId: string) {
|
||||
return this._data.expand(this._eventExpandExpression).getById(eventId).then(r => r.result);
|
||||
return this._data.expand(this._eventExpandExpression)
|
||||
.getById(eventId)
|
||||
.then(r => r.result);
|
||||
}
|
||||
|
||||
getUpcoming() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Everlive from 'everlive-sdk'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { constants } from '../shared'
|
||||
import Everlive from 'everlive-sdk';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { constants } from '../shared';
|
||||
|
||||
@Injectable()
|
||||
export class EverliveProvider {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export const constants = {
|
||||
appId: '35ylfmbdmpzbqn0c',
|
||||
emptyImage: 'https://x1.xingassets.com/assets/frontend_minified/img/users/nobody_m.original.jpg'
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
export * from './constants'
|
||||
export * from './models'
|
||||
export * from './constants';
|
||||
export * from './models';
|
||||
|
||||
import * as utils from './utilities';
|
||||
export const utilities = utils;
|
||||
|
|
|
@ -2,7 +2,7 @@ import { ItemModel } from './item.model';
|
|||
|
||||
export class Event extends ItemModel {
|
||||
Name: string;
|
||||
EventDate?: Date;
|
||||
EventDateChoices?: Date[];
|
||||
EventDate?: string;
|
||||
EventDateChoices?: string[];
|
||||
LocationURL: string;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
export function getAsResizeUrl (rawUrl: string, opts = { width: 300, height: 200 }) {
|
||||
return `https://bs1.cdn.telerik.com/image/v1/35ylfmbdmpzbqn0c/resize=w:${opts.width},h:${opts.height},fill:cover/${rawUrl}`;
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
"nativescript": {
|
||||
"id": "org.nativescript.teamspirit",
|
||||
"tns-android": {
|
||||
"version": "2.3.0"
|
||||
"version": "2.4.1"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -21,7 +21,8 @@
|
|||
"nativescript-angular": "1.1.0",
|
||||
"nativescript-telerik-ui": "^1.4.1",
|
||||
"reflect-metadata": "~0.1.8",
|
||||
"tns-core-modules": "2.3.0"
|
||||
"tns-core-modules": "2.4.4",
|
||||
"rxjs": "5.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-traverse": "6.18.0",
|
||||
|
|
Загрузка…
Ссылка в новой задаче