Skip to content

Commit 0a87eb1

Browse files
committed
Updated show details logic for #111
1 parent 8a358d4 commit 0a87eb1

File tree

10 files changed

+81
-26
lines changed

10 files changed

+81
-26
lines changed

src/pages/base-page/base-page.ts

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ import { Person } from '../../models/person';
2424
})
2525
export class BasePage {
2626

27+
protected WIDTH_SMALL:number = 540;
28+
protected WIDTH_MEDIUM:number = 720;
29+
protected WIDTH_LARGE:number = 960;
30+
protected WIDTH_EXTRA_LARGE:number = 1140;
31+
2732
protected offline:boolean = false;
2833
protected tablet:boolean = false;
2934
protected mobile:boolean = false;

src/pages/checkin-details/checkin-details.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<ion-header>
22
<ion-navbar color="navbar">
3-
<button ion-button icon-only menuToggle color="primary">
4-
<ion-icon name="menu"></ion-icon>
5-
</button>
3+
<ion-buttons left *ngIf="modal == true">
4+
<button ion-button color="primary" (click)="closeModal($event)">Close</button>
5+
</ion-buttons>
66
<ion-title></ion-title>
7-
<ion-buttons right *ngIf="person">
7+
<ion-buttons right *ngIf="person && mobile">
88
<button #create ion-button icon-only color="primary" *ngIf="person.isOwner() || person.isAdmin() || person.isAuthor() || person.isViewer()" (click)="shareCheckin($event)">
99
<ion-icon ios="ios-share-outline" md="md-share"></ion-icon>
1010
</button>

src/pages/checkin-details/checkin-details.ts

+7
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export class CheckinDetailsPage extends BasePage {
3636

3737
person:Person = null;
3838

39+
modal:boolean = false;
40+
3941
loading:boolean = false;
4042

4143
constructor(
@@ -60,6 +62,7 @@ export class CheckinDetailsPage extends BasePage {
6062
this.organization = this.getParameter<Organization>("organization");
6163
this.checkin = this.getParameter<Checkin>("checkin");
6264
this.person = this.getParameter<Person>("person");
65+
this.modal = this.getParameter<boolean>("modal");
6366
this.loadUpdates(true);
6467
}
6568

@@ -193,6 +196,10 @@ export class CheckinDetailsPage extends BasePage {
193196
});
194197
}
195198

199+
private closeModal(event:any) {
200+
this.hideModal({});
201+
}
202+
196203
private shareCheckin(event:any) {
197204
let subject = this.checkin.message;
198205
let message = [];

src/pages/checkin-list/checkin-list.ts

+17-8
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ import { Notification } from '../../models/notification';
2828
})
2929
export class CheckinListPage extends BasePage {
3030

31-
LARGE_WIDTH:number = 992;
32-
3331
filter:string = "all";
3432
organization:Organization = null;
3533
checkins:Checkin[] = [];
@@ -418,12 +416,23 @@ export class CheckinListPage extends BasePage {
418416
}
419417

420418
private showCheckinDetails(checkin:Checkin, event:any=null) {
421-
this.showPage(CheckinDetailsPage, {
422-
organization: this.organization,
423-
person: this.person,
424-
checkin: checkin,
425-
checkin_id: checkin.id
426-
});
419+
if (this.platform.width() > this.WIDTH_LARGE) {
420+
this.showModal(CheckinDetailsPage, {
421+
organization: this.organization,
422+
person: this.person,
423+
checkin: checkin,
424+
checkin_id: checkin.id,
425+
modal: true
426+
});
427+
}
428+
else {
429+
this.showPage(CheckinDetailsPage, {
430+
organization: this.organization,
431+
person: this.person,
432+
checkin: checkin,
433+
checkin_id: checkin.id
434+
});
435+
}
427436
}
428437

429438
private sendReply(checkin:Checkin, event:any=null) {

src/pages/group-details/group-details.html

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<ion-header>
22
<ion-navbar color="navbar">
3+
<ion-buttons left *ngIf="modal == true">
4+
<button ion-button color="primary" (click)="hideModal($event)">
5+
Cancel
6+
</button>
7+
</ion-buttons>
38
<ion-title></ion-title>
49
<ion-buttons right *ngIf="person">
510
<button ion-button icon-only color="primary" *ngIf="person.isOwner() || person.isAdmin()" (click)="editGroup($event)">Edit</button>

src/pages/group-details/group-details.ts

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class GroupDetailsPage extends BasePage {
2828
group:Group = null;
2929
person:Person = null;
3030
loading:boolean = false;
31+
modal:boolean = false;
3132

3233
constructor(
3334
protected zone:NgZone,
@@ -50,6 +51,7 @@ export class GroupDetailsPage extends BasePage {
5051
this.organization = this.getParameter<Organization>("organization");
5152
this.person = this.getParameter<Person>("person");
5253
this.group = this.getParameter<Group>("group");
54+
this.modal = this.getParameter<boolean>("modal");
5355
let loading = this.showLoading("Loading...");
5456
this.loadGroup(true).then(loaded => {
5557
loading.dismiss();

src/pages/group-list/group-list.ts

+17-6
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,23 @@ export class GroupListPage extends BasePage {
238238

239239
private showGroup(group:Group) {
240240
this.logger.info(this, "showGroup", group);
241-
this.showPage(GroupDetailsPage, {
242-
organization: this.organization,
243-
person: this.person,
244-
group: group,
245-
group_id: group.id
246-
});
241+
if (this.platform.width() > this.WIDTH_LARGE) {
242+
this.showModal(GroupDetailsPage, {
243+
organization: this.organization,
244+
person: this.person,
245+
group: group,
246+
group_id: group.id,
247+
modal:true
248+
});
249+
}
250+
else {
251+
this.showPage(GroupDetailsPage, {
252+
organization: this.organization,
253+
person: this.person,
254+
group: group,
255+
group_id: group.id
256+
});
257+
}
247258
}
248259

249260
}

src/pages/person-details/person-details.html

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<ion-header>
22
<ion-navbar color="navbar">
3-
<ion-buttons left *ngIf="title">
4-
<button ion-button icon-only menuToggle color="primary">
3+
<ion-buttons left>
4+
<button ion-button icon-only menuToggle *ngIf="title" color="primary">
55
<ion-icon name="menu"></ion-icon>
66
</button>
7+
<button ion-button color="primary" *ngIf="modal == true" (click)="hideModal($event)">
8+
Cancel
9+
</button>
710
</ion-buttons>
811
<ion-title>{{title}}</ion-title>
912
<ion-buttons right *ngIf="user && person">

src/pages/person-details/person-details.ts

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export class PersonDetailsPage extends BasePage {
3333
checkins:Checkin[] = [];
3434
limit:number = 3;
3535
offset:number = 0;
36+
modal:boolean = false;
3637

3738
constructor(
3839
protected zone:NgZone,
@@ -57,6 +58,7 @@ export class PersonDetailsPage extends BasePage {
5758
this.person = this.getParameter<Person>("person");
5859
this.user = this.getParameter<Person>("user");
5960
this.title = this.getParameter<string>("title");
61+
this.modal = this.getParameter<boolean>("modal");
6062
let loading = this.showLoading("Loading...");
6163
this.loadUpdates(true).then((loaded:any) => {
6264
loading.dismiss();

src/pages/person-list/person-list.ts

+17-6
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,23 @@ export class PersonListPage extends BasePage {
290290

291291
private showPerson(person:Person, event:any=null) {
292292
this.logger.info(this, "showPerson");
293-
this.showPage(PersonDetailsPage, {
294-
organization: this.organization,
295-
person: person,
296-
user: this.person,
297-
person_id: person.id
298-
});
293+
if (this.platform.width() > this.WIDTH_LARGE) {
294+
this.showModal(PersonDetailsPage, {
295+
organization: this.organization,
296+
person: person,
297+
user: this.person,
298+
person_id: person.id,
299+
modal: true
300+
});
301+
}
302+
else {
303+
this.showPage(PersonDetailsPage, {
304+
organization: this.organization,
305+
person: person,
306+
user: this.person,
307+
person_id: person.id
308+
});
309+
}
299310
}
300311

301312
private removePerson(person:Person) {

0 commit comments

Comments
 (0)