messages, answered requests

- Created view for journal query so we can use the calculated fields in
a where clause
- Changed journal ordering from newest-first to oldest-first; that way,
clicking "prayed" at the top, one right after the other, will let the
user pray through their list with minimal distraction
- Answered requests now drop off the active journal (still need to write
the ability to review answered requests)
- All the activities now send messages to the user, so they have
confirmation that their action has completed
This commit is contained in:
Daniel J. Summers
2017-09-23 21:28:43 -05:00
parent 8cb58cc2d3
commit ec08bfbc74
7 changed files with 69 additions and 35 deletions

View File

@@ -4,7 +4,6 @@ article
p(v-if="isLoadingJournal") Loading your prayer journal...
template(v-if="!isLoadingJournal")
new-request
p journal has {{ journal.length }} entries
el-row
el-col(:span='4'): strong Actions
el-col(:span='16'): strong Request
@@ -38,6 +37,10 @@ export default {
},
async created () {
await this.$store.dispatch(actions.LOAD_JOURNAL, this.$Progress)
this.$message({
message: `Loaded ${this.journal.length} prayer requests`,
type: 'success'
})
}
}
</script>

View File

@@ -49,6 +49,17 @@ export default {
updateText: this.form.requestText,
status: this.form.status
})
if (this.form.status === 'Answered') {
this.$message({
message: 'Request updated and removed from active journal',
type: 'success'
})
} else {
this.$message({
message: 'Request updated',
type: 'success'
})
}
this.editVisible = false
}
}

View File

@@ -1,6 +1,6 @@
<template lang="pug">
div
el-button(@click='openDialog()') Add a New Request
el-button(icon='plus' @click='openDialog()') Add a New Request
el-dialog(title='Add a New Prayer Request' :visible.sync='showNewVisible')
el-form(:model='form' :label-position='top')
el-form-item(label='Prayer Request')
@@ -39,7 +39,11 @@ export default {
progress: this.$Progress,
requestText: this.form.requestText
})
this.showNewVisible = false
this.$message({
message: 'New prayer request added',
type: 'success'
})
this.closeDialog()
}
}
}

View File

@@ -4,7 +4,7 @@ el-row.journal-request
el-button(icon='check' @click='markPrayed()' title='Pray')
edit-request(:request='request')
full-request(:request='request')
el-col(:span='16'): p {{ request.text }}
el-col(:span='16'): p {{ text }}
el-col(:span='4'): p {{ asOf }}
</template>
@@ -33,11 +33,18 @@ export default {
status: 'Prayed',
updateText: ''
})
this.$message({
message: 'Request marked as prayed',
type: 'success'
})
}
},
computed: {
asOf () {
return moment(this.request.asOf).fromNow()
},
text () {
return this.request.text.split('\n').join('<br>')
}
}
}

View File

@@ -45,11 +45,11 @@ export default new Vuex.Store({
state.journal = journal
},
[mutations.REQUEST_ADDED] (state, newRequest) {
state.journal.unshift(newRequest)
state.journal.push(newRequest)
},
[mutations.REQUEST_UPDATED] (state, request) {
let jrnl = state.journal.filter(it => it.requestId !== request.requestId)
jrnl.unshift(request)
if (request.lastStatus !== 'Answered') jrnl.push(request)
state.journal = jrnl
},
[mutations.USER_LOGGED_OFF] (state) {