Add overflow menu to the thread view, issue #39

This commit is contained in:
Morgan McMillian 2017-08-13 07:07:15 -07:00
parent 83d1ff2555
commit a5ff687946
3 changed files with 14 additions and 13 deletions

View file

@ -201,7 +201,7 @@ export class StreamPage {
fetchThread(threadid) { fetchThread(threadid) {
pnut.thread(threadid, {include_deleted: 0, include_raw: 1, count: 140}).then(res => { pnut.thread(threadid, {include_deleted: 0, include_raw: 1, count: 140}).then(res => {
this.navCtrl.push(ThreadPage, {posts: res.data}); this.navCtrl.push(ThreadPage, {posts: res.data, me: this.myUsername});
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
}); });

View file

@ -69,17 +69,11 @@
<div *ngIf="post.counts.reposts > 0">{{ post.counts.reposts }}</div> <div *ngIf="post.counts.reposts > 0">{{ post.counts.reposts }}</div>
</button> </button>
</ion-col> </ion-col>
<!-- <ion-col> <ion-col>
<button ion-button icon-left clear small block> <button ion-button icon-left clear small block (click)="presentPostMenu($event, post)">
<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> <ion-icon name="more"></ion-icon>
</button> </button>
</ion-col> --> </ion-col>
</ion-row> </ion-row>
</ion-card> </ion-card>
</ion-list> </ion-list>

View file

@ -1,6 +1,6 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { NavController, NavParams, ModalController, ToastController } from 'ionic-angular'; import { NavController, NavParams, ModalController, ToastController, PopoverController } from 'ionic-angular';
import { NewPostModal } from '../stream/stream'; import { NewPostModal, PostMenu } from '../stream/stream';
import * as pnut from 'pnut-butter'; import * as pnut from 'pnut-butter';
@ -18,10 +18,12 @@ export class ThreadPage {
title: string; title: string;
posts: Array<Object> = []; posts: Array<Object> = [];
myUsername: string;
constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController, constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController,
public toastCtrl: ToastController) { public popoverCtrl: PopoverController, public toastCtrl: ToastController) {
this.posts = this.navParams.data.posts; this.posts = this.navParams.data.posts;
this.myUsername = this.navParams.data.me;
} }
showReplyPost(postData) { showReplyPost(postData) {
@ -88,6 +90,11 @@ export class ThreadPage {
}); });
} }
presentPostMenu(myEvent, postData) {
let popover = this.popoverCtrl.create(PostMenu, {post: postData, me: this.myUsername});
popover.present({ev: myEvent});
}
presentToast(text) { presentToast(text) {
let toast = this.toastCtrl.create({ let toast = this.toastCtrl.create({
position: 'top', position: 'top',