toast notifications for issue #6 and overflow for more actions
This commit is contained in:
parent
62fb31b68e
commit
4174ec3fc6
2 changed files with 38 additions and 10 deletions
|
@ -16,7 +16,7 @@
|
|||
</ion-header>
|
||||
|
||||
|
||||
<ion-content>
|
||||
<ion-content overflow-scroll=”true”>
|
||||
|
||||
<ion-refresher (ionRefresh)="fetchNewerPosts($event)">
|
||||
<ion-refresher-content></ion-refresher-content>
|
||||
|
@ -64,24 +64,29 @@
|
|||
<ion-icon name="quote"></ion-icon>
|
||||
</button>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<button ion-button icon-left clear small block (click)="bookmark(post.id, post.you_bookmarked)">
|
||||
<ion-icon name="star"></ion-icon>
|
||||
<div *ngIf="post.counts.bookmarks > 0">{{ post.counts.bookmarks }}</div>
|
||||
</button>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<button ion-button icon-left clear small block (click)="repost(post.id, post.you_reposted)">
|
||||
<ion-icon name="repeat"></ion-icon>
|
||||
<div *ngIf="post.counts.reposts > 0">{{ post.counts.reposts }}</div>
|
||||
</button>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<button ion-button icon-left clear small block (click)="bookmark(post.id, post.you_bookmarked)">
|
||||
<ion-icon name="star"></ion-icon>
|
||||
<div *ngIf="post.counts.bookmarks > 0">{{ post.counts.bookmarks }}</div>
|
||||
</button>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<button ion-button icon-left clear small block (click)="fetchThread(post.thread_id)">
|
||||
<ion-icon name="chatboxes"></ion-icon>
|
||||
<div *ngIf="post.counts.replies > 0">{{ post.counts.replies }}</div>
|
||||
</button>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<button ion-button icon-left clear small block>
|
||||
<ion-icon name="more"></ion-icon>
|
||||
</button>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-card>
|
||||
</ion-list>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, ViewChild, ChangeDetectorRef } from '@angular/core';
|
||||
import { ViewController, NavController, NavParams, ModalController, Content } from 'ionic-angular';
|
||||
import { ViewController, NavController, NavParams, ModalController, Content, ToastController } from 'ionic-angular';
|
||||
import { ThreadPage } from '../thread/thread';
|
||||
|
||||
import * as pnut from 'pnut-butter';
|
||||
|
@ -28,7 +28,7 @@ export class StreamPage {
|
|||
showScrollBtn: boolean = false;
|
||||
|
||||
constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController,
|
||||
private changeDetectorRef: ChangeDetectorRef) {
|
||||
private changeDetectorRef: ChangeDetectorRef, public toastCtrl: ToastController) {
|
||||
// console.log(JSON.stringify(navParams));
|
||||
|
||||
switch (navParams.data.stream) {
|
||||
|
@ -190,6 +190,7 @@ export class StreamPage {
|
|||
pnut.deleteBookmark(postid).then(res => {
|
||||
console.log(res);
|
||||
this.updatePost(res.data.id);
|
||||
this.presentToast("Bookmark updated.");
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
|
@ -197,6 +198,7 @@ export class StreamPage {
|
|||
pnut.bookmark(postid).then(res => {
|
||||
console.log(res);
|
||||
this.updatePost(res.data.id);
|
||||
this.presentToast("Bookmark updated.");
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
|
@ -208,6 +210,7 @@ export class StreamPage {
|
|||
pnut.deleteRepost(postid).then(res => {
|
||||
console.log(res);
|
||||
this.updatePost(res.data.id);
|
||||
this.presentToast("Repost updated.");
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
|
@ -215,6 +218,7 @@ export class StreamPage {
|
|||
pnut.repost(postid).then(res => {
|
||||
console.log(res);
|
||||
this.updatePost(res.data.id);
|
||||
this.presentToast("Repost updated.");
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
|
@ -250,6 +254,15 @@ export class StreamPage {
|
|||
newPostModal.present();
|
||||
}
|
||||
|
||||
presentToast(text) {
|
||||
let toast = this.toastCtrl.create({
|
||||
position: 'middle',
|
||||
message: text,
|
||||
duration: 2000
|
||||
});
|
||||
toast.present();
|
||||
}
|
||||
|
||||
scrollToTop() {
|
||||
this.content.scrollToTop();
|
||||
}
|
||||
|
@ -300,7 +313,7 @@ export class NewPostModal {
|
|||
options: Object;
|
||||
myUsername: string;
|
||||
|
||||
constructor(public navParams: NavParams, public viewCtrl: ViewController) {
|
||||
constructor(public navParams: NavParams, public viewCtrl: ViewController, public toastCtrl: ToastController) {
|
||||
console.log(this.navParams);
|
||||
this.myUsername = navParams.data.me;
|
||||
if (navParams.data.type === 'reply') {
|
||||
|
@ -329,12 +342,22 @@ export class NewPostModal {
|
|||
console.log(this.ptext);
|
||||
pnut.createPost(this.ptext, this.options).then(res => {
|
||||
console.log(res);
|
||||
this.presentToast("Status posted.");
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
this.viewCtrl.dismiss();
|
||||
}
|
||||
|
||||
presentToast(text) {
|
||||
let toast = this.toastCtrl.create({
|
||||
position: 'middle',
|
||||
message: text,
|
||||
duration: 2000
|
||||
});
|
||||
toast.present();
|
||||
}
|
||||
|
||||
parseMentions(mentions) {
|
||||
let mtext = ""
|
||||
for(var i = 0; i < mentions.length; i++) {
|
||||
|
|
Reference in a new issue