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 @@
article
page-title(:title='title')
- toast(ref='toast')
p(v-if='isLoadingJournal') Loading your prayer journal...
template(v-if='!isLoadingJournal')
new-request
br
- b-row
- request-list-item(v-if='journal.length > 0' v-for='request in journal' :request='request' :key='request.requestId')
+ request-list-item(v-if='journal.length > 0'
+ v-for='row in journalCardRows'
+ :row='row'
+ :events='eventBus'
+ :toast='toast'
+ :key='row[0].requestId')
p.text-center(v-if='journal.length === 0'): em No requests found; click the "Add a New Request" button to add one
+ edit-request(:events='eventBus' :toast='toast' )
+ full-request(:events='eventBus')
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 @@
span
- b-btn(@click='openDialog()' title='Edit' size='sm' variant='outline-secondary'): icon(name='pencil')
+ //- b-btn(@click='openDialog()' title='Edit' size='sm' variant='outline-secondary'): icon(name='pencil')
b-modal(title='Edit Prayer Request'
v-model='editVisible'
size='lg'
header-bg-variant='dark'
header-text-variant='light'
+ @edit='openDialog()'
@shows='focusRequestText')
b-form
b-form-group(label='Prayer Request' label-for='request_text')
@@ -19,7 +20,6 @@ span
b-btn(variant='primary' @click='saveRequest()') Save
|
b-btn(variant='outline-secondary' @click='closeDialog()') Cancel
- toast(ref='toast')
\ 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 @@
-b-col(xs='12' sm='6' md='4')
- b-card(border-variant='dark' no-body)
- div.card-body.p-0
- p.card-text.mb-1.px-3.pt-3
- | {{ text }}
- p.card-text.p-0.pr-1.text-right: small.text-muted: em
- = '(last activity '
- date-from-now(:value='request.asOf')
- | )
- //-
- edit-request(:request='request')
- full-request(:request='request')
- b-card-footer.text-center.py-1.
- #[b-btn(@click='markPrayed()' variant='outline-primary' title='Pray' size='sm'): icon(name='check')]
- #[b-btn(variant='outline-secondary' title='Edit' size='sm'): icon(name='pencil')]
- #[b-btn(variant='outline-secondary' title='Add Notes' size='sm'): icon(name='file-text-o')]
- #[b-btn(variant='outline-secondary' title='View Full Request' size='sm'): icon(name='search')]
+div
+ b-card-group.w-100(deck)
+ b-card(v-for='(request, idx) in row' border-variant='dark' no-body)
+ b-card-body.p-0
+ p.card-text.request-card-text.mb-1.px-3.pt-3
+ | {{ request.text }}
+ p.card-text.p-0.pr-1.text-right: small.text-muted: em
+ = '(last activity '
+ date-from-now(:value='request.asOf')
+ | )
+ b-card-footer.text-center.py-1.
+ #[b-btn(@click='markPrayed(idx)' variant='outline-primary' title='Pray' size='sm'): icon(name='check')]
+ #[b-btn(@click.stop='showEdit(request)' variant='outline-secondary' title='Edit' size='sm'): icon(name='pencil')]
+ #[b-btn(disabled variant='outline-secondary' title='Add Notes' size='sm'): icon(name='file-text-o')]
+ #[b-btn(@click.stop='showFull(idx)' variant='outline-secondary' title='View Full Request' size='sm'): icon(name='search')]
+ b-card(v-for='it in 3 - row.length')
br
- toast(ref='toast')
+
+