From a5ff68794671fe77849a6fe38a989e3404a25ab3 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sun, 13 Aug 2017 07:07:15 -0700 Subject: [PATCH] Add overflow menu to the thread view, issue #39 --- src/pages/stream/stream.ts | 2 +- src/pages/thread/thread.html | 12 +++--------- src/pages/thread/thread.ts | 13 ++++++++++--- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/pages/stream/stream.ts b/src/pages/stream/stream.ts index 903ab5a..42c40d5 100644 --- a/src/pages/stream/stream.ts +++ b/src/pages/stream/stream.ts @@ -201,7 +201,7 @@ export class StreamPage { fetchThread(threadid) { 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 => { console.log(err); }); diff --git a/src/pages/thread/thread.html b/src/pages/thread/thread.html index 8ccb633..a16ebe7 100644 --- a/src/pages/thread/thread.html +++ b/src/pages/thread/thread.html @@ -69,17 +69,11 @@
{{ post.counts.reposts }}
- - + diff --git a/src/pages/thread/thread.ts b/src/pages/thread/thread.ts index 8969f02..c5fcb72 100644 --- a/src/pages/thread/thread.ts +++ b/src/pages/thread/thread.ts @@ -1,6 +1,6 @@ import { Component } from '@angular/core'; -import { NavController, NavParams, ModalController, ToastController } from 'ionic-angular'; -import { NewPostModal } from '../stream/stream'; +import { NavController, NavParams, ModalController, ToastController, PopoverController } from 'ionic-angular'; +import { NewPostModal, PostMenu } from '../stream/stream'; import * as pnut from 'pnut-butter'; @@ -18,10 +18,12 @@ export class ThreadPage { title: string; posts: Array = []; + myUsername: string; 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.myUsername = this.navParams.data.me; } 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) { let toast = this.toastCtrl.create({ position: 'top',