From 834eaf241603c1f2488a4c7de4f0a785b8575a1a Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Sat, 30 Sep 2017 12:36:57 -0500 Subject: [PATCH] Conversion to cards (bootstrap) complete Also: - Multi-line requests now preserve line breaks (#7) - Have one instance of vue-toast; access via $parent for main page components, pass to child components --- src/app/src/App.vue | 9 ++ src/app/src/components/Journal.vue | 37 ++++++--- src/app/src/components/common/DateFromNow.vue | 3 +- .../src/components/request/EditRequest.vue | 33 ++++---- .../src/components/request/FullRequest.vue | 9 +- .../components/request/RequestListItem.vue | 83 ++++++++----------- 6 files changed, 94 insertions(+), 80 deletions(-) diff --git a/src/app/src/App.vue b/src/app/src/App.vue index 48f2f9f..a097fd6 100644 --- a/src/app/src/App.vue +++ b/src/app/src/App.vue @@ -4,6 +4,7 @@ #content.container router-view vue-progress-bar + toast(ref='toast') footer p.text-right: i myPrayerJournal v0.8.1 @@ -17,6 +18,14 @@ export default { name: 'app', components: { Navigation + }, + mounted () { + this.$refs.toast.setOptions({ position: 'bottom right' }) + }, + computed: { + toast () { + return this.$refs.toast + } } } diff --git a/src/app/src/components/Journal.vue b/src/app/src/components/Journal.vue index 4dc9b67..046835d 100644 --- a/src/app/src/components/Journal.vue +++ b/src/app/src/components/Journal.vue @@ -1,21 +1,30 @@ diff --git a/src/app/src/components/common/DateFromNow.vue b/src/app/src/components/common/DateFromNow.vue index 9b4b172..a0bdf91 100644 --- a/src/app/src/components/common/DateFromNow.vue +++ b/src/app/src/components/common/DateFromNow.vue @@ -22,7 +22,6 @@ export default { data () { const dt = moment(this.value) return { - dt, fromNow: dt.fromNow(), actual: dt.format('LLLL'), intervalId: null @@ -37,7 +36,7 @@ export default { }, methods: { updateFromNow () { - let newFromNow = this.dt.fromNow() + let newFromNow = moment(this.value).fromNow() if (newFromNow !== this.fromNow) this.fromNow = newFromNow } }, diff --git a/src/app/src/components/request/EditRequest.vue b/src/app/src/components/request/EditRequest.vue index 530ac6c..24b9640 100644 --- a/src/app/src/components/request/EditRequest.vue +++ b/src/app/src/components/request/EditRequest.vue @@ -1,11 +1,12 @@ \ No newline at end of file + diff --git a/src/app/src/components/request/FullRequest.vue b/src/app/src/components/request/FullRequest.vue index 869fe2a..53fd488 100644 --- a/src/app/src/components/request/FullRequest.vue +++ b/src/app/src/components/request/FullRequest.vue @@ -23,7 +23,7 @@ import api from '@/api' export default { name: 'full-request', props: { - request: { required: true } + events: { required: true } }, data () { return { @@ -31,6 +31,9 @@ export default { full: null } }, + created () { + this.events.$on('full', this.openDialog) + }, components: { FullRequestHistory }, @@ -39,10 +42,10 @@ export default { this.full = null this.historyVisible = false }, - async openDialog () { + async openDialog (requestId) { this.historyVisible = true this.$Progress.start() - const req = await api.getFullRequest(this.request.requestId) + const req = await api.getFullRequest(requestId) this.full = req.data this.$Progress.finish() } diff --git a/src/app/src/components/request/RequestListItem.vue b/src/app/src/components/request/RequestListItem.vue index 0ec0f00..e2c5a44 100644 --- a/src/app/src/components/request/RequestListItem.vue +++ b/src/app/src/components/request/RequestListItem.vue @@ -1,74 +1,57 @@ + +