Merge branch 'master' into gp/bugfixes-p2

This commit is contained in:
Georgi Prodanov 2017-02-01 15:33:48 +02:00
Родитель d83bae2ab2 d708675408
Коммит f29da1b0fd
13 изменённых файлов: 137 добавлений и 61 удалений

Просмотреть файл

@ -87,6 +87,11 @@ ActivityIndicator {
vertical-align: middle;
}
.input-field.switch-field .label {
font-size: 16;
color: #000;
}
.btn {
margin: 0 6;
font-size: 20;
@ -146,3 +151,10 @@ ActivityIndicator {
.drawer .logo {
width: 140;
}
.list-separator {
border-width: 0;
border-bottom-width: 1;
border-color: #c8c7cc;
height: 1;
}

Просмотреть файл

@ -1,4 +1,23 @@
.cntnr {
height: 100%;
background-color: green;
height: 100%;
background-color: #fff;
}
.content {
padding: 20;
}
.info-label {
margin-bottom: 10;
font-size: 12;
color: #F4550F;
text-transform: uppercase;
}
.group-wrp {
margin-bottom: 30;
}
.no-voters {
padding: 10 0;
}

Просмотреть файл

@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { RouterExtensions } from 'nativescript-angular/router';
import { Page } from 'ui/page';
import { AlertService, PlatformService, UsersService, EventsService, EventRegistrationsService } from '../../services';
import { User, Event, EventRegistration } from '../../shared/models';
@ -28,7 +29,8 @@ export class EventParticipantsComponent implements OnInit {
private _eventsService: EventsService,
private _platform: PlatformService,
private _routerExtensions: RouterExtensions,
private _regsService: EventRegistrationsService
private _regsService: EventRegistrationsService,
private _page: Page
) {
this.isAndroid = this._platform.isAndroid;
}
@ -41,11 +43,15 @@ export class EventParticipantsComponent implements OnInit {
.then(p => this.participants = p);
let eventPrm = this._eventsService.getById(eventId)
.then(e => this.event = e);
.then(e => {
this.event = e;
this._page.actionBar.title = 'Participants for ' + this.event.Name;
});
let regsPrm = this._regsService.getForEvent(eventId)
.then(r => this.registrations = r);
Promise.all<any>([eventPrm, participantsPrm, regsPrm])
.then(() => {
this._groupParticipantsByDate();
@ -101,7 +107,7 @@ export class EventParticipantsComponent implements OnInit {
private _groupParticipantsByDate() {
let usersById: any = {};
this.participants.forEach(u => usersById[u.Id] = u);
this.registrations.forEach(reg => {
let user: User = usersById[reg.UserId];
reg.Choices.forEach((c: any) => {

Просмотреть файл

@ -1,28 +1,23 @@
<StackLayout class="cntnr">
<ActionBarExtension>
<NavigationButton *ngIf="isAndroid"android.systemIcon="ic_menu_back" (tap)="onBack()"></NavigationButton>
<ActionItem *ngIf="!isAndroid" ios.systemIcon="1" ios.position="left" (tap)="onBack()"></ActionItem>
<ActionItem>
<StackLayout class="actionbar-title-wrp">
<Label [text]="event && event.Name && ('Participants for ' + event.Name)" class="actionbar-title"></Label>
</StackLayout>
</ActionItem>
<NavigationButton *ngIf="isAndroid" icon="res://icon_back" (tap)="onBack()"></NavigationButton>
<ActionItem *ngIf="!isAndroid" ios.systemIcon="1" ios.position="left" (tap)="onBack()"></ActionItem>
<!--<ActionItem (tap)="onAdd()" *ngIf="canAdd"
ios.systemIcon="4" android.systemIcon="ic_menu_add"
ios.position="right">
</ActionItem>-->
</ActionBarExtension>
<StackLayout *ngIf="eventDates.length">
<StackLayout *ngFor="let date of eventDates">
<Label [text]="date | date:dateFormat" textWrap="true" textWrap="true"></Label>
<StackLayout *ngIf="eventDates.length" class="content">
<StackLayout *ngFor="let date of eventDates" class="group-wrp">
<Label class="info-label" [text]="date | date:dateFormat" textWrap="true" textWrap="true"></Label>
<user-list *ngIf="hasVoters(date)" [users]="getParticipants(date)"></user-list>
<Label *ngIf="!hasVoters(date)" text="Nobody voted for this date" textWrap="true"></Label>
<Label *ngIf="!hasVoters(date)" text="Nobody voted for this date" textWrap="true" class="no-voters"></Label>
</StackLayout>
<StackLayout *ngIf="hasOldDates()">
<Label text="Dates that were deprecated" textWrap="true"></Label>
<Label *ngFor="let date of getOldDates()" [text]="date | date:dateFormat" textWrap="true"></Label>
<Label class="info-label" text="Dates that were deprecated" textWrap="true"></Label>
<Label *ngFor="let date of getOldDates()" [text]="date | date:dateFormat" textWrap="true" class="no-voters"></Label>
</StackLayout>
</StackLayout>

Просмотреть файл

@ -1,4 +1,12 @@
.cntnr {
height: 100%;
background-color: green;
height: 100%;
background-color: #fff;
}
.content {
padding: 20;
}
.no-admin {
padding: 10 0;
}

Просмотреть файл

@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { RouterExtensions } from 'nativescript-angular/router';
import { Page } from 'ui/page';
import { GroupsService, AlertService, PlatformService, UsersService } from '../../services';
import { User, Group } from '../../shared/models';
@ -26,7 +27,8 @@ export class GroupMembersComponent implements OnInit {
private _groupsService: GroupsService,
private _usersService: UsersService,
private _platform: PlatformService,
private _routerExtensions: RouterExtensions
private _routerExtensions: RouterExtensions,
private _page: Page
) {
this.isAndroid = this._platform.isAndroid;
}
@ -35,10 +37,13 @@ export class GroupMembersComponent implements OnInit {
this._route.params.subscribe(p => {
this._groupId = p['id'];
let groupPrm = this._groupsService.getById(this._groupId)
.then(g => this.group = g);
.then(g => {
this.group = g;
this._page.actionBar.title = 'Members of ' + this.group.Name;
});
let membersPrm = this._groupsService.getGroupMembers(this._groupId)
.then(members => this.members = members);
Promise.all<any>([this._usersService.currentUser(), groupPrm, membersPrm])
.then((result) => {
let currentUser: User = result[0];

Просмотреть файл

@ -1,21 +1,16 @@
<StackLayout class="cntnr">
<ActionBarExtension>
<NavigationButton *ngIf="isAndroid"android.systemIcon="ic_menu_back" (tap)="onBack()"></NavigationButton>
<ActionItem *ngIf="!isAndroid" ios.systemIcon="1" ios.position="left" (tap)="onBack()"></ActionItem>
<ActionItem>
<StackLayout class="actionbar-title-wrp">
<Label [text]="group && group.Name && ('Members of ' + group.Name)" class="actionbar-title"></Label>
</StackLayout>
</ActionItem>
<NavigationButton *ngIf="isAndroid"android.systemIcon="ic_menu_back" (tap)="onBack()"></NavigationButton>
<ActionItem *ngIf="!isAndroid" ios.systemIcon="1" ios.position="left" (tap)="onBack()"></ActionItem>
<ActionItem (tap)="onAdd()" *ngIf="canAdd"
ios.systemIcon="4" android.systemIcon="ic_menu_add"
ios.position="right">
</ActionItem>
</ActionBarExtension>
<StackLayout *ngIf="members">
<StackLayout *ngIf="members" class="content">
<user-list *ngIf="members" [users]="members"></user-list>
<Label *ngIf="noAdmin" text="Group administrator is not a member."></Label>
<Label *ngIf="noAdmin" text="Group administrator is not a member." class="no-admin"></Label>
</StackLayout>
<ScrollView class="cntnr">

Просмотреть файл

@ -1,4 +1,16 @@
.cntnr {
height: 100%;
background-color: #fff;
height: 100%;
background-color: #fff;
}
.form {
padding: 20;
}
.input-field.switch-field {
padding: 0;
}
.btn {
margin: 20 0 0;
}

Просмотреть файл

@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { RouterExtensions } from 'nativescript-angular/router';
import { Page } from 'ui/page';
import { User } from '../../shared';
import { utilities } from '../../shared';
@ -12,13 +13,15 @@ import { UsersService, AlertService } from '../../services';
})
export class SettingsComponent implements OnInit {
user: User;
constructor(
private _usersService: UsersService,
private _alertsService: AlertService
private _alertsService: AlertService,
private _page: Page
) {}
ngOnInit() {
this._page.actionBar.title = 'Settings';
this._usersService.currentUser().then(user => this.user = user);
}

Просмотреть файл

@ -1,21 +1,16 @@
<StackLayout class="cntnr">
<ActionBarExtension>
<ActionItem>
<Label text="Settings"></Label>
</ActionItem>
</ActionBarExtension>
<StackLayout *ngIf="user">
<StackLayout orientation="horizontal">
<Switch [(ngModel)]="user.EmailNotificationsEnabled"></Switch>
<Label text="Receive email notifications" textWrap="true"></Label>
<StackLayout *ngIf="user" class="form">
<StackLayout orientation="horizontal" class="input-field switch-field">
<Switch class="switch" [(ngModel)]="user.EmailNotificationsEnabled"></Switch>
<Label class="label" text="Receive email notifications" textWrap="true"></Label>
</StackLayout>
<StackLayout orientation="horizontal">
<Switch [(ngModel)]="user.PushNotificationsEnabled"></Switch>
<Label text="Receive push notifications" textWrap="true"></Label>
<StackLayout orientation="horizontal" class="input-field switch-field">
<Switch class="switch" [(ngModel)]="user.PushNotificationsEnabled"></Switch>
<Label class="label" text="Receive push notifications" textWrap="true"></Label>
</StackLayout>
<Button (tap)="onSave()" text="Save Settings"></Button>
<Label class="btn btn-primary" (tap)="onSave()" text="Save Settings"></Label>
</StackLayout>
<ScrollView class="cntnr">

Просмотреть файл

@ -7,11 +7,12 @@
background-color: rgba(0, 0, 0, .35);
}
/* no image styles should go here, i guess */
.list-wrapper >>> .icon {
/*font-size: 22;
.user-image,
.user-name {
vertical-align: middle;
text-align: center;
color: rgba(255, 255, 255, .5);
background-color: rgba(0, 0, 0, .05);*/
}
.user-name {
margin-left: 5;
color: #000;
}

Просмотреть файл

@ -0,0 +1,22 @@
.item {
padding: 10 0;
}
.user-display,
.organizer {
vertical-align: middle;
}
.organizer {
margin-left: 5;
font-size: 12;
}
.user-display >>> Image,
.user-display >>> .no-image {
width: 30;
height: 30;
margin-right: 5;
border-radius: 15;
background-color: rgba(0, 0, 0, .35);
}

Просмотреть файл

@ -1,9 +1,12 @@
<StackLayout>
<ListView [items]="users" separatorColor="gray">
<ListView [items]="users" separatorColor="transparent">
<template let-user="item">
<StackLayout orientation="horizontal">
<user-display [users]="[user]" [showNames]="true"></user-display>
<Label *ngIf="user._label" [text]="getUserLabel(user)" textWrap="true"></Label>
<StackLayout>
<StackLayout orientation="horizontal" class="item">
<user-display class="user-display" [users]="[user]" [showNames]="true"></user-display>
<Label class="organizer" *ngIf="user._label" [text]="getUserLabel(user)" textWrap="true"></Label>
</StackLayout>
<Label class="list-separator" text=""></Label>
</StackLayout>
</template>
</ListView>