Initial commit
This commit is contained in:
37
src/pages/messages/messages.html
Normal file
37
src/pages/messages/messages.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<ion-header no-border>
|
||||
<ion-row>
|
||||
<ion-col text-center>
|
||||
<button ion-button clear small>
|
||||
Messages
|
||||
</button>
|
||||
</ion-col>
|
||||
<ion-col text-center>
|
||||
<button ion-button clear small>
|
||||
Taps
|
||||
</button>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-header>
|
||||
|
||||
<ion-content no-padding>
|
||||
<ion-list>
|
||||
<ion-item no-padding *ngFor="let profile of profiles">
|
||||
<ion-thumbnail item-start (tap)="profilePictureTapped($event, profile)">
|
||||
<img [src]="profile.details.pic.thumb">
|
||||
</ion-thumbnail>
|
||||
<ion-grid (tap)="interviewTapped($event, profile)">
|
||||
<ion-row nowrap justify-content-between>
|
||||
<ion-col>
|
||||
{{profile.details.name}}
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
23h ago
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row nowrap>
|
||||
<ion-col [innerHTML]="getLatestMessage(profile.messages)"></ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
</ion-content>
|
||||
3
src/pages/messages/messages.scss
Normal file
3
src/pages/messages/messages.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
page-messages {
|
||||
|
||||
}
|
||||
39
src/pages/messages/messages.ts
Normal file
39
src/pages/messages/messages.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { NavController } from 'ionic-angular';
|
||||
|
||||
import { ProfileService } from '../../services/profiles';
|
||||
import { ProfilePage } from '../profile/profile';
|
||||
import { ChatPage } from '../chat/chat';
|
||||
|
||||
@Component({
|
||||
selector: 'page-messages',
|
||||
templateUrl: 'messages.html',
|
||||
providers: [ ProfileService ]
|
||||
})
|
||||
export class MessagesPage {
|
||||
|
||||
profiles: any;
|
||||
|
||||
constructor(public navCtrl: NavController, public profileService: ProfileService) {
|
||||
profileService.load().then((data) => {
|
||||
this.profiles = data;
|
||||
});
|
||||
}
|
||||
|
||||
getLatestMessage(messages) {
|
||||
var latest = Math.max.apply(Math, messages.map(function(o){ return o.order; }));
|
||||
return messages[latest].text != '' ? messages[latest].text : '<em>Picture</em>';
|
||||
}
|
||||
|
||||
interviewTapped(event, profile) {
|
||||
this.navCtrl.push(ChatPage, {
|
||||
profile: profile
|
||||
});
|
||||
}
|
||||
|
||||
profilePictureTapped(event, profile) {
|
||||
this.navCtrl.push(ProfilePage, {
|
||||
profile: profile
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user