Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56dee71377 | ||
|
|
3c3f0a7981 | ||
|
|
a1ce40ee83 | ||
|
|
b8f1708012 | ||
|
|
69811cbf54 | ||
|
|
b6d72d691b | ||
|
|
6f49a61822 | ||
|
|
4db6d98011 | ||
|
|
3acec3dc25 | ||
|
|
8055c34f7c | ||
|
|
e0d27a708d | ||
|
|
834eaf2416 | ||
|
|
ef88964cd0 | ||
|
|
1e1afa9d89 |
@@ -4,4 +4,4 @@ Journaling has a long history; it helps people remember what happened, and the a
|
|||||||
|
|
||||||
This is borne of out of a personal desire I had to have something that would help me with my prayer life. When it's time to pray, it's not really time to use an app, so the design goal here is to keep it simple and unobtrusive. It will also help eliminate some of the downsides to a paper prayer journal, like not remembering whether you've prayed for a request, or running out of room to write another update on one.
|
This is borne of out of a personal desire I had to have something that would help me with my prayer life. When it's time to pray, it's not really time to use an app, so the design goal here is to keep it simple and unobtrusive. It will also help eliminate some of the downsides to a paper prayer journal, like not remembering whether you've prayed for a request, or running out of room to write another update on one.
|
||||||
|
|
||||||
It is still a work-in-progress (WIP). It will eventually be hosted at <https://prayerjournal.me>, and will be available for public use.
|
It is still a work-in-progress (WIP), but is available for public preview at <https://prayerjournal.me>.
|
||||||
|
|||||||
@@ -1,34 +1,45 @@
|
|||||||
# Caveats
|
# Documentation
|
||||||
|
|
||||||
_myPrayerJournal is currently alpha software. There likely will be errors, the way things work may change, and parts of the application are unfinished or need polish. I **will** do my best to not lose any data, though; it is backed up the way other DJS Consulting sites have their data backed up. Throughout this document, current gotchas will be called out with italic text, like this notice._
|
## Caveats
|
||||||
|
|
||||||
# Finding the Site
|
_myPrayerJournal is currently alpha software. There likely will be errors, the way things work may change, and parts of the application are unfinished or need polish. I **will** do my best to not lose any data, though; it is backed up the way other Bit Badger Solutions sites have their data backed up. Throughout this document, current gotchas will be called out with italic text, like this notice._
|
||||||
|
|
||||||
|
## Finding the Site
|
||||||
|
|
||||||
The application is at <https://prayerjournal.me>.
|
The application is at <https://prayerjournal.me>.
|
||||||
|
|
||||||
# Signing Up
|
## Signing Up
|
||||||
|
|
||||||
myPrayerJournal uses login services using Google or Microsoft accounts. The only information the application stores in its database is your user Id token it receives from these services, so there are no permissions you should have to accept from these provider other than establishing that you can log on with that account. Because of this, you'll want to pick the same one each time; the tokens between the two accounts are different, even if you use the same e-mail address to log on to both.
|
myPrayerJournal uses login services using Google or Microsoft accounts. The only information the application stores in its database is your user Id token it receives from these services, so there are no permissions you should have to accept from these provider other than establishing that you can log on with that account. Because of this, you'll want to pick the same one each time; the tokens between the two accounts are different, even if you use the same e-mail address to log on to both.
|
||||||
|
|
||||||
# Adding a Request
|
## Your Prayer Journal
|
||||||
|
|
||||||
To add a request, click the "Add a New Request" button in your "Journal". Then, enter the text of the request as you see fit; there is no right or wrong way, and you are the only person who will see the text you enter. When you save the request, it will go to the bottom of the list of requests.
|
Your current requests will be presented in three columns (or one, if you're using a mobile phone). Each request is in its own card, and the buttons at the bottom of each card apply to that request. The last line of each request also tells you how long it has been since anything has been done on that request. Any time you see something like "a few minutes ago," you can hover over that to see the actual date/time the action was taken.
|
||||||
|
|
||||||
# Praying for Requests
|
## Adding a Request
|
||||||
|
|
||||||
The first button for each request has a checkmark icon; clicking this button will mark the request as "Prayed" and move it to the bottom of the list. This allows you, if you're praying through your requests, to start at the top (with the request that it's been the longest since you've prayed) and click the button as you pray; when the request goes to the bottom of the list, the next will move up to the top.
|
To add a request, click the "Add a New Request" button at the top of your journal. Then, enter the text of the request as you see fit; there is no right or wrong way, and you are the only person who will see the text you enter. When you save the request, it will go to the bottom of the list of requests.
|
||||||
|
|
||||||
# Editing Requests
|
## Praying for Requests
|
||||||
|
|
||||||
The second button for each request has a pencil icon. This allows you to edit the text of the request, pretty much the same way you entered it; it starts with the current text, and you can add to it, modify it, or completely replace it. By default, updates will go in with an "Updated" status; you have the option to also mark this update as "Prayed" or "Answered." Answered requests will drop off the journal list. _(There is currently no way to see answered requests once they have been answered; this functionality is planned soon.)_
|
The first button for each request has a checkmark icon; clicking this button will mark the request as "Prayed" and move it to the bottom of the list. This allows you, if you're praying through your requests, to start at the top left (with the request that it's been the longest since you've prayed) and click the button as you pray; when the request goes to the bottom of the list, the next-least-recently-prayed request will take the top spot.
|
||||||
|
|
||||||
# Viewing a Request and Its History
|
## Editing Requests
|
||||||
|
|
||||||
myPrayerJournal tracks all of the actions related to a request; the third button, with the document icon, will show you the entire history, including the text as it changed, and all the times "Prayed" was recorded.
|
The second button for each request has a pencil icon. This allows you to edit the text of the request, pretty much the same way you entered it; it starts with the current text, and you can add to it, modify it, or completely replace it. By default, updates will go in with an "Updated" status; you have the option to also mark this update as "Prayed" or "Answered." Answered requests will drop off the journal list.
|
||||||
|
|
||||||
# Known Issues
|
## Adding Notes
|
||||||
|
|
||||||
|
The third button for each request has an icon that looks like a piece of paper with writing; this lets you record notes about the request. If there is something you want to record that doesn't change the text of the request, this is the place to do it. For example, you may be praying for a long-term health issue, and that person tells you that their status is the same; or, you may want to record something God said to you while you were praying for that request.
|
||||||
|
|
||||||
|
## Viewing a Request and Its History
|
||||||
|
|
||||||
|
myPrayerJournal tracks all of the actions related to a request; the fourth button, with the magnifying glass icon, will show you the entire history, including the text as it changed, and all the times "Prayed" was recorded.
|
||||||
|
|
||||||
|
## Answered Requests
|
||||||
|
|
||||||
|
Next to "Journal" on the top navigation is the word "Answered." This page lists all answered requests, from most recent to least recent, along with the text of the request at the time it was marked as answered. It will also show you when it was marked answered. The button at the bottom of each request, with the magnifying glass and the words "Show Full Request", link to a page that shows that request's complete history and notes, along with a few statistics about that request. The history and notes are listed from most recent to least recent; if you want to read it chronologically, just press the "End" key on your keyboard and read it from the bottom up.
|
||||||
|
|
||||||
|
## Known Issues
|
||||||
|
|
||||||
See [the GitHub issues list](https://github.com/danieljsummers/myPrayerJournal/issues) for the most up-to-date list.
|
See [the GitHub issues list](https://github.com/danieljsummers/myPrayerJournal/issues) for the most up-to-date list.
|
||||||
|
|
||||||
- _There is no way to view "Answered" requests; the absence of this functionality is a big reason this is still considered alpha. Going back through requests to see how God has answered them is an encouraging benefit of taking the time to journal._
|
|
||||||
- _If you try to do something an get an error notification instead of a green checkmark, try logging off and logging back on again. The site currently doesn't check to see if your session has expired, but the server with which it's communicating does._
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "my-prayer-journal-api",
|
"name": "my-prayer-journal-api",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.8.1",
|
"version": "0.8.5",
|
||||||
"description": "Server API for myPrayerJournal",
|
"description": "Server API for myPrayerJournal",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"author": "Daniel J. Summers <daniel@djs-consulting.com>",
|
"author": "Daniel J. Summers <daniel@bitbadger.solutions>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chalk": "^2.1.0",
|
"chalk": "^2.1.0",
|
||||||
|
|||||||
@@ -46,6 +46,17 @@ const ddl = [
|
|||||||
PRIMARY KEY ("requestId", "asOf"));
|
PRIMARY KEY ("requestId", "asOf"));
|
||||||
COMMENT ON TABLE mpj.history IS 'Request update history'`
|
COMMENT ON TABLE mpj.history IS 'Request update history'`
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'note Table',
|
||||||
|
check: tableSql('note'),
|
||||||
|
fix: `
|
||||||
|
CREATE TABLE mpj.note (
|
||||||
|
"requestId" varchar(25) NOT NULL REFERENCES mpj.request,
|
||||||
|
"asOf" bigint NOT NULL,
|
||||||
|
"notes" text NOT NULL,
|
||||||
|
PRIMARY KEY ("requestId", "asOf"));
|
||||||
|
COMMENT ON TABLE mpj.note IS 'Notes regarding a request'`
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'request.userId Index',
|
name: 'request.userId Index',
|
||||||
check: indexSql('request', 'idx_request_userId'),
|
check: indexSql('request', 'idx_request_userId'),
|
||||||
|
|||||||
@@ -18,21 +18,41 @@ const requestNotFound = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function (pool) {
|
export default function (pool) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve basic information about a single request
|
||||||
|
* @param {string} requestId The Id of the request to retrieve
|
||||||
|
* @param {string} userId The Id of the user to whom the request belongs
|
||||||
|
*/
|
||||||
|
let retrieveRequest = (requestId, userId) =>
|
||||||
|
pool.query(`
|
||||||
|
SELECT "requestId", "enteredOn"
|
||||||
|
FROM mpj.request
|
||||||
|
WHERE "requestId" = $1
|
||||||
|
AND "userId" = $2`,
|
||||||
|
[ requestId, userId ])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
* Add a history entry for this request
|
* Add a history entry for this request
|
||||||
* @param {string} requestId The Id of the request
|
* @param {string} userId The Id of the user to whom this request belongs
|
||||||
|
* @param {string} requestId The Id of the request to which the update applies
|
||||||
* @param {string} status The status for this history entry
|
* @param {string} status The status for this history entry
|
||||||
* @param {string} updateText The updated text for the request (pass blank if no update)
|
* @param {string} updateText The updated text for the request (pass blank if no update)
|
||||||
|
* @return {number} 404 if the request is not found or does not belong to the given user, 204 if successful
|
||||||
*/
|
*/
|
||||||
addHistory: async (requestId, status, updateText) => {
|
addHistory: async (userId, requestId, status, updateText) => {
|
||||||
const asOf = Date.now()
|
const req = retrieveRequest(requestId, userId)
|
||||||
|
if (req.rowCount === 0) {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
await pool.query(`
|
await pool.query(`
|
||||||
INSERT INTO mpj.history
|
INSERT INTO mpj.history
|
||||||
("requestId", "asOf", "status", "text")
|
("requestId", "asOf", "status", "text")
|
||||||
VALUES
|
VALUES
|
||||||
($1, $2, $3, NULLIF($4, ''))`,
|
($1, $2, $3, NULLIF($4, ''))`,
|
||||||
[ requestId, asOf, status, updateText ])
|
[ requestId, Date.now(), status, updateText ])
|
||||||
|
return 204
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,6 +88,39 @@ export default function (pool) {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a note about a prayer request
|
||||||
|
* @param {string} userId The Id of the user to whom the request belongs
|
||||||
|
* @param {string} requestId The Id of the request to which the note applies
|
||||||
|
* @param {string} note The notes to add
|
||||||
|
* @return {number} 404 if the request is not found or does not belong to the given user, 204 if successful
|
||||||
|
*/
|
||||||
|
addNote: async (userId, requestId, note) => {
|
||||||
|
const req = retrieveRequest(requestId, userId)
|
||||||
|
if (req.rowCount === 0) {
|
||||||
|
return 404
|
||||||
|
}
|
||||||
|
await pool.query(`
|
||||||
|
INSERT INTO mpj.note
|
||||||
|
("requestId", "asOf", "notes")
|
||||||
|
VALUES
|
||||||
|
($1, $2, $3)`,
|
||||||
|
[ requestId, Date.now(), note ])
|
||||||
|
return 204
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all answered requests with their text as of the "Answered" status
|
||||||
|
* @param {string} userId The Id of the user for whom requests should be retrieved
|
||||||
|
* @return All requests
|
||||||
|
*/
|
||||||
|
answered: async (userId) =>
|
||||||
|
(await pool.query(`${currentRequestSql}
|
||||||
|
WHERE "userId" = $1
|
||||||
|
AND "lastStatus" = 'Answered'
|
||||||
|
ORDER BY "asOf" DESC`,
|
||||||
|
[ userId ])).rows,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the "current" version of a request by its Id
|
* Get the "current" version of a request by its Id
|
||||||
* @param {string} requestId The Id of the request to retrieve
|
* @param {string} requestId The Id of the request to retrieve
|
||||||
@@ -89,12 +142,7 @@ export default function (pool) {
|
|||||||
* @return The request, or a request-like object indicating that the request was not found
|
* @return The request, or a request-like object indicating that the request was not found
|
||||||
*/
|
*/
|
||||||
fullById: async (userId, requestId) => {
|
fullById: async (userId, requestId) => {
|
||||||
const reqResults = await pool.query(`
|
const reqResults = await retrieveRequest(requestId, userId)
|
||||||
SELECT "requestId", "enteredOn"
|
|
||||||
FROM mpj.request
|
|
||||||
WHERE "requestId" = $1
|
|
||||||
AND "userId" = $2`,
|
|
||||||
[ requestId, userId ])
|
|
||||||
if (0 === reqResults.rowCount) {
|
if (0 === reqResults.rowCount) {
|
||||||
return requestNotFound
|
return requestNotFound
|
||||||
}
|
}
|
||||||
@@ -114,7 +162,27 @@ export default function (pool) {
|
|||||||
* @param {string} userId The Id of the user
|
* @param {string} userId The Id of the user
|
||||||
* @return The requests that make up the current journal
|
* @return The requests that make up the current journal
|
||||||
*/
|
*/
|
||||||
journal: async userId => (await pool.query(`${journalSql} ORDER BY "asOf"`, [ userId ])).rows
|
journal: async userId => (await pool.query(`${journalSql} ORDER BY "asOf"`, [ userId ])).rows,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the notes for a request, most recent first
|
||||||
|
* @param {string} userId The Id of the user to whom the request belongs
|
||||||
|
* @param {string} requestId The Id of the request whose notes should be retrieved
|
||||||
|
* @return The notes for the request
|
||||||
|
*/
|
||||||
|
notesById: async (userId, requestId) => {
|
||||||
|
const reqResults = await retrieveRequest(requestId, userId)
|
||||||
|
if (0 === reqResults.rowCount) {
|
||||||
|
return requestNotFound
|
||||||
|
}
|
||||||
|
const notes = await pool.query(`
|
||||||
|
SELECT "asOf", "notes"
|
||||||
|
FROM mpj.note
|
||||||
|
WHERE "requestId" = $1
|
||||||
|
ORDER BY "asOf" DESC`,
|
||||||
|
[ requestId ])
|
||||||
|
return notes.rows
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,13 @@ export default function (checkJwt) {
|
|||||||
// Add a request history entry (prayed, updated, answered, etc.)
|
// Add a request history entry (prayed, updated, answered, etc.)
|
||||||
.post('/:id/history', checkJwt, async (ctx, next) => {
|
.post('/:id/history', checkJwt, async (ctx, next) => {
|
||||||
const body = ctx.request.body
|
const body = ctx.request.body
|
||||||
await db.request.addHistory(ctx.params.id, body.status, body.updateText)
|
ctx.response.status = await db.request.addHistory(ctx.state.user.sub, ctx.params.id, body.status, body.updateText)
|
||||||
ctx.response.status = 204
|
await next()
|
||||||
|
})
|
||||||
|
// Add a note to a request
|
||||||
|
.post('/:id/note', checkJwt, async (ctx, next) => {
|
||||||
|
const body = ctx.request.body
|
||||||
|
ctx.response.status = await db.request.addNote(ctx.state.user.sub, ctx.params.id, body.notes)
|
||||||
await next()
|
await next()
|
||||||
})
|
})
|
||||||
// Get a journal-style request by its Id
|
// Get a journal-style request by its Id
|
||||||
@@ -40,12 +45,35 @@ export default function (checkJwt) {
|
|||||||
}
|
}
|
||||||
await next()
|
await next()
|
||||||
})
|
})
|
||||||
// Get the least-recently-updated request (used for the "pray through the journal" feature)
|
// Get the notes for a request
|
||||||
.get('/:id/oldest', checkJwt, async (ctx, next) => {
|
.get('/:id/notes', checkJwt, async (ctx, next) => {
|
||||||
ctx.body = await db.request.oldest(ctx.state.user.sub)
|
const notes = await db.request.notesById(ctx.state.user.sub, ctx.params.id)
|
||||||
|
if (notes.text && 'Not Found' === notes.text) {
|
||||||
|
ctx.response.status = 404
|
||||||
|
} else {
|
||||||
|
ctx.body = notes
|
||||||
|
ctx.response.status = 200
|
||||||
|
}
|
||||||
|
await next()
|
||||||
|
})
|
||||||
|
// Get a complete request; equivalent to full + notes
|
||||||
|
.get('/:id/complete', checkJwt, async (ctx, next) => {
|
||||||
|
const req = await db.request.fullById(ctx.state.user.sub, ctx.params.id)
|
||||||
|
if ('Not Found' === req.text) {
|
||||||
|
ctx.response.status = 404
|
||||||
|
} else {
|
||||||
|
ctx.response.status = 200
|
||||||
|
req.notes = await db.request.notesById(ctx.state.user.sub, ctx.params.id)
|
||||||
|
ctx.body = req
|
||||||
|
}
|
||||||
|
await next()
|
||||||
|
})
|
||||||
|
// Get all answered requests
|
||||||
|
.get('/answered', checkJwt, async (ctx, next) => {
|
||||||
|
ctx.body = await db.request.answered(ctx.state.user.sub)
|
||||||
|
ctx.response.status = 200
|
||||||
await next()
|
await next()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
return router
|
return router
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "my-prayer-journal",
|
"name": "my-prayer-journal",
|
||||||
"version": "0.8.1",
|
"version": "0.8.5",
|
||||||
"description": "myPrayerJournal - Front End",
|
"description": "myPrayerJournal - Front End",
|
||||||
"author": "Daniel J. Summers <daniel@djs-consulting.com>",
|
"author": "Daniel J. Summers <daniel@bitbadger.solutions>",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node build/dev-server.js",
|
"dev": "node build/dev-server.js",
|
||||||
@@ -16,12 +16,14 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"auth0-js": "^8.10.1",
|
"auth0-js": "^8.10.1",
|
||||||
"axios": "^0.16.2",
|
"axios": "^0.16.2",
|
||||||
"element-ui": "^1.4.4",
|
"bootstrap-vue": "^1.0.0-beta.9",
|
||||||
"moment": "^2.18.1",
|
"moment": "^2.18.1",
|
||||||
"pug": "^2.0.0-rc.4",
|
"pug": "^2.0.0-rc.4",
|
||||||
"vue": "^2.4.4",
|
"vue": "^2.4.4",
|
||||||
|
"vue-awesome": "^2.3.3",
|
||||||
"vue-progressbar": "^0.7.3",
|
"vue-progressbar": "^0.7.3",
|
||||||
"vue-router": "^2.6.0",
|
"vue-router": "^2.6.0",
|
||||||
|
"vue-toast": "^3.1.0",
|
||||||
"vuex": "^2.4.0"
|
"vuex": "^2.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -4,8 +4,12 @@
|
|||||||
#content.container
|
#content.container
|
||||||
router-view
|
router-view
|
||||||
vue-progress-bar
|
vue-progress-bar
|
||||||
|
toast(ref='toast')
|
||||||
footer
|
footer
|
||||||
p.text-right: i myPrayerJournal v0.8.1
|
p.text-right.text-muted: i.
|
||||||
|
myPrayerJournal v{{ version }} •
|
||||||
|
#[a(href='https://github.com/danieljsummers/myprayerjournal') Developed] and hosted by
|
||||||
|
#[a(href='https://bitbadger.solutions') Bit Badger Solutions]
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -13,53 +17,52 @@
|
|||||||
|
|
||||||
import Navigation from './components/Navigation.vue'
|
import Navigation from './components/Navigation.vue'
|
||||||
|
|
||||||
|
import { version } from '../package.json'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'app',
|
name: 'app',
|
||||||
components: {
|
components: {
|
||||||
Navigation
|
Navigation
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return { version }
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
this.$refs.toast.setOptions({ position: 'bottom right' })
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
toast () {
|
||||||
|
return this.$refs.toast
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@import url('../node_modules/element-ui/lib/theme-default/index.css');
|
html, body {
|
||||||
body {
|
background-color: whitesmoke;
|
||||||
font-family: -apple-system,system-ui,BlinkMacSystemFont,"Segoe UI","Roboto","Helvetica Neue", Arial, sans-serif;
|
|
||||||
padding-top: 60px;
|
|
||||||
margin: 0;
|
|
||||||
}
|
}
|
||||||
#content {
|
body {
|
||||||
padding: 0 10px;
|
padding-top: 60px;
|
||||||
}
|
}
|
||||||
footer {
|
footer {
|
||||||
border-top: solid 1px lightgray;
|
border-top: solid 1px lightgray;
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
padding: 0 1rem;
|
padding: 0 1rem;
|
||||||
|
|
||||||
}
|
}
|
||||||
footer p {
|
footer p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
.text-right {
|
a:link, a:visited {
|
||||||
text-align: right;
|
color: #050;
|
||||||
}
|
}
|
||||||
.material-icons.md-18 {
|
.mpj-request-text {
|
||||||
font-size: 18px;
|
white-space: pre-line;
|
||||||
}
|
}
|
||||||
.material-icons.md-24 {
|
.bg-mpj {
|
||||||
font-size: 24px;
|
background-image: -webkit-gradient(linear, left top, left bottom, from(#050), to(whitesmoke));
|
||||||
}
|
background-image: -webkit-linear-gradient(top, #050, whitesmoke);
|
||||||
.material-icons.md-36 {
|
background-image: -moz-linear-gradient(top, #050, whitesmoke);
|
||||||
font-size: 36px;
|
background-image: linear-gradient(to bottom, #050, whitesmoke);
|
||||||
}
|
|
||||||
.material-icons.md-48 {
|
|
||||||
font-size: 48px;
|
|
||||||
}
|
|
||||||
.material-icons {
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
.mpj-page-title {
|
|
||||||
border-bottom: solid 1px lightgray;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
const http = axios.create({
|
const http = axios.create({
|
||||||
baseURL: 'http://localhost:3000/api/'
|
baseURL: `${location.protocol}//${location.host}/api/`
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,9 +21,11 @@ export default {
|
|||||||
removeBearer: () => delete http.defaults.headers.common['authorization'],
|
removeBearer: () => delete http.defaults.headers.common['authorization'],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all prayer requests and their most recent updates
|
* Add a note for a prayer request
|
||||||
|
* @param {string} requestId The Id of the request to which the note applies
|
||||||
|
* @param {string} notes The notes to be added
|
||||||
*/
|
*/
|
||||||
journal: () => http.get('journal/'),
|
addNote: (requestId, notes) => http.post(`request/${requestId}/note`, { notes }),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new prayer request
|
* Add a new prayer request
|
||||||
@@ -32,13 +34,21 @@ export default {
|
|||||||
addRequest: requestText => http.post('request/', { requestText }),
|
addRequest: requestText => http.post('request/', { requestText }),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a prayer request
|
* Get all answered requests, along with the text they had when it was answered
|
||||||
* @param request The request (should have requestId, status, and updateText properties)
|
|
||||||
*/
|
*/
|
||||||
updateRequest: request => http.post(`request/${request.requestId}/history`, {
|
getAnsweredRequests: () => http.get('request/answered'),
|
||||||
status: request.status,
|
|
||||||
updateText: request.updateText
|
/**
|
||||||
}),
|
* Get a prayer request (full; includes all history)
|
||||||
|
* @param {string} requestId The Id of the request to retrieve
|
||||||
|
*/
|
||||||
|
getFullRequest: requestId => http.get(`request/${requestId}/full`),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get past notes for a prayer request
|
||||||
|
* @param {string} requestId The Id of the request for which notes should be retrieved
|
||||||
|
*/
|
||||||
|
getNotes: requestId => http.get(`request/${requestId}/notes`),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a prayer request (journal-style; only latest update)
|
* Get a prayer request (journal-style; only latest update)
|
||||||
@@ -47,9 +57,22 @@ export default {
|
|||||||
getRequest: requestId => http.get(`request/${requestId}`),
|
getRequest: requestId => http.get(`request/${requestId}`),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a prayer request (full; includes all history)
|
* Get a complete request; equivalent of "full" and "notes" combined
|
||||||
* @param {string} requestId The Id of the request to retrieve
|
|
||||||
*/
|
*/
|
||||||
getFullRequest: requestId => http.get(`request/${requestId}/full`)
|
getRequestComplete: requestId => http.get(`request/${requestId}/complete`),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all prayer requests and their most recent updates
|
||||||
|
*/
|
||||||
|
journal: () => http.get('journal/'),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a prayer request
|
||||||
|
* @param request The request (should have requestId, status, and updateText properties)
|
||||||
|
*/
|
||||||
|
updateRequest: request => http.post(`request/${request.requestId}/history`, {
|
||||||
|
status: request.status,
|
||||||
|
updateText: request.updateText
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import auth0 from 'auth0-js'
|
|||||||
import AUTH_CONFIG from './auth0-variables'
|
import AUTH_CONFIG from './auth0-variables'
|
||||||
import mutations from '@/store/mutation-types'
|
import mutations from '@/store/mutation-types'
|
||||||
|
|
||||||
|
var tokenRenewalTimeout
|
||||||
|
|
||||||
export default class AuthService {
|
export default class AuthService {
|
||||||
|
|
||||||
constructor () {
|
constructor () {
|
||||||
@@ -17,7 +19,7 @@ export default class AuthService {
|
|||||||
auth0 = new auth0.WebAuth({
|
auth0 = new auth0.WebAuth({
|
||||||
domain: AUTH_CONFIG.domain,
|
domain: AUTH_CONFIG.domain,
|
||||||
clientID: AUTH_CONFIG.clientId,
|
clientID: AUTH_CONFIG.clientId,
|
||||||
redirectUri: AUTH_CONFIG.callbackUrl,
|
redirectUri: AUTH_CONFIG.appDomain + AUTH_CONFIG.callbackUrl,
|
||||||
audience: `https://${AUTH_CONFIG.domain}/userinfo`,
|
audience: `https://${AUTH_CONFIG.domain}/userinfo`,
|
||||||
responseType: 'token id_token',
|
responseType: 'token id_token',
|
||||||
scope: 'openid profile email'
|
scope: 'openid profile email'
|
||||||
@@ -78,6 +80,16 @@ export default class AuthService {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scheduleRenewal () {
|
||||||
|
let expiresAt = JSON.parse(localStorage.getItem('expires_at'))
|
||||||
|
let delay = expiresAt - Date.now()
|
||||||
|
if (delay > 0) {
|
||||||
|
tokenRenewalTimeout = setTimeout(() => {
|
||||||
|
this.renewToken()
|
||||||
|
}, delay)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setSession (authResult) {
|
setSession (authResult) {
|
||||||
// Set the time that the access token will expire at
|
// Set the time that the access token will expire at
|
||||||
let expiresAt = JSON.stringify(
|
let expiresAt = JSON.stringify(
|
||||||
@@ -86,10 +98,30 @@ export default class AuthService {
|
|||||||
localStorage.setItem('access_token', authResult.accessToken)
|
localStorage.setItem('access_token', authResult.accessToken)
|
||||||
localStorage.setItem('id_token', authResult.idToken)
|
localStorage.setItem('id_token', authResult.idToken)
|
||||||
localStorage.setItem('expires_at', expiresAt)
|
localStorage.setItem('expires_at', expiresAt)
|
||||||
|
this.scheduleRenewal()
|
||||||
|
}
|
||||||
|
|
||||||
|
renewToken () {
|
||||||
|
console.log('attempting renewal...')
|
||||||
|
this.auth0.renewAuth(
|
||||||
|
{
|
||||||
|
audience: `https://${AUTH_CONFIG.domain}/userinfo`,
|
||||||
|
redirectUri: `${AUTH_CONFIG.appDomain}/static/silent.html`,
|
||||||
|
usePostMessage: true
|
||||||
|
},
|
||||||
|
(err, result) => {
|
||||||
|
if (err) {
|
||||||
|
console.log(err)
|
||||||
|
} else {
|
||||||
|
this.setSession(result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
logout (store, router) {
|
logout (store, router) {
|
||||||
// Clear access token and ID token from local storage
|
// Clear access token and ID token from local storage
|
||||||
|
clearTimeout(tokenRenewalTimeout)
|
||||||
localStorage.removeItem('access_token')
|
localStorage.removeItem('access_token')
|
||||||
localStorage.removeItem('id_token')
|
localStorage.removeItem('id_token')
|
||||||
localStorage.removeItem('expires_at')
|
localStorage.removeItem('expires_at')
|
||||||
|
|||||||
61
src/app/src/components/Answered.vue
Normal file
61
src/app/src/components/Answered.vue
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<template lang="pug">
|
||||||
|
article
|
||||||
|
page-title(title='Answered Requests')
|
||||||
|
p(v-if='!loaded') Loading answered requests...
|
||||||
|
div(v-if='loaded').mpj-answered-list
|
||||||
|
p.mpj-request-text(v-for='req in requests' :key='req.requestId')
|
||||||
|
| {{ req.text }}
|
||||||
|
br
|
||||||
|
br
|
||||||
|
b-btn(:to='{ name: "AnsweredDetail", params: { id: req.requestId }}'
|
||||||
|
size='sm'
|
||||||
|
variant='outline-secondary')
|
||||||
|
icon(name='search')
|
||||||
|
= ' View Full Request'
|
||||||
|
small.text-muted: em.
|
||||||
|
Answered #[date-from-now(:value='req.asOf')]
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
'use static'
|
||||||
|
|
||||||
|
import api from '@/api'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'answered',
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
requests: [],
|
||||||
|
loaded: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
toast () {
|
||||||
|
return this.$parent.$refs.toast
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async mounted () {
|
||||||
|
this.$Progress.start()
|
||||||
|
try {
|
||||||
|
const reqs = await api.getAnsweredRequests()
|
||||||
|
this.requests = reqs.data
|
||||||
|
this.$Progress.finish()
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
this.toast.showToast('Error loading requests; check console for details', { theme: 'danger' })
|
||||||
|
this.$Progress.fail()
|
||||||
|
} finally {
|
||||||
|
this.loaded = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.mpj-answered-list p {
|
||||||
|
border-top: solid 1px lightgray;
|
||||||
|
}
|
||||||
|
.mpj-answered-list p:first-child {
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
81
src/app/src/components/AnsweredDetail.vue
Normal file
81
src/app/src/components/AnsweredDetail.vue
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
<template lang="pug">
|
||||||
|
article
|
||||||
|
page-title(title='Answered Request')
|
||||||
|
p(v-if='!request') Loading request...
|
||||||
|
template(v-if='request')
|
||||||
|
p.
|
||||||
|
Answered {{ formatDate(answered) }} (#[date-from-now(:value='answered')])
|
||||||
|
#[small: em.text-muted prayed {{ prayedCount }} times, open {{ openDays }} days]
|
||||||
|
p.mpj-request-text {{ lastText }}
|
||||||
|
b-table(small hover :fields='fields' :items='log')
|
||||||
|
template(slot='action' scope='data') {{ data.item.status }} on {{ formatDate(data.item.asOf) }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
import moment from 'moment'
|
||||||
|
|
||||||
|
import api from '@/api'
|
||||||
|
|
||||||
|
const asOfDesc = (a, b) => b.asOf - a.asOf
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'answer-detail',
|
||||||
|
props: {
|
||||||
|
id: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
request: null,
|
||||||
|
fields: [
|
||||||
|
{ key: 'action', label: 'Action' },
|
||||||
|
{ key: 'text', label: 'Update / Notes' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
answered () {
|
||||||
|
return this.request.history.find(hist => hist.status === 'Answered').asOf
|
||||||
|
},
|
||||||
|
lastText () {
|
||||||
|
return this.request.history
|
||||||
|
.filter(hist => hist.text > '')
|
||||||
|
.sort(asOfDesc)[0].text
|
||||||
|
},
|
||||||
|
log () {
|
||||||
|
return this.request.notes
|
||||||
|
.map(note => ({ asOf: note.asOf, text: note.notes, status: 'Notes' }))
|
||||||
|
.concat(this.request.history)
|
||||||
|
.sort(asOfDesc)
|
||||||
|
.slice(1)
|
||||||
|
},
|
||||||
|
openDays () {
|
||||||
|
return Math.floor(
|
||||||
|
(this.answered - this.request.history.find(hist => hist.status === 'Created').asOf) / 1000 / 60 / 60 / 24)
|
||||||
|
},
|
||||||
|
prayedCount () {
|
||||||
|
return this.request.history.filter(hist => hist.status === 'Prayed').length
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async mounted () {
|
||||||
|
this.$Progress.start()
|
||||||
|
try {
|
||||||
|
const req = await api.getRequestComplete(this.id)
|
||||||
|
this.request = req.data
|
||||||
|
this.$Progress.finish()
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
this.$Progress.fail()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
formatDate (asOf) {
|
||||||
|
return moment(asOf).format('LL')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
article
|
article
|
||||||
page-title(title='Welcome!' hideOnPage='true')
|
page-title(title='Welcome!'
|
||||||
|
hideOnPage='true')
|
||||||
p
|
p
|
||||||
p.
|
p.
|
||||||
myPrayerJournal is a place where individuals can record their prayer requests, record that they prayed for them,
|
myPrayerJournal is a place where individuals can record their prayer requests, record that they prayed for them,
|
||||||
@@ -15,12 +16,7 @@ article
|
|||||||
<script>
|
<script>
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
import PageTitle from './common/PageTitle.vue'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'home',
|
name: 'home'
|
||||||
components: {
|
|
||||||
PageTitle
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -4,21 +4,32 @@ article
|
|||||||
p(v-if='isLoadingJournal') Loading your prayer journal...
|
p(v-if='isLoadingJournal') Loading your prayer journal...
|
||||||
template(v-if='!isLoadingJournal')
|
template(v-if='!isLoadingJournal')
|
||||||
new-request
|
new-request
|
||||||
el-row
|
br
|
||||||
el-col(:span='4'): strong Actions
|
request-list-item(v-if='journal.length > 0'
|
||||||
el-col(:span='16'): strong Request
|
v-for='row in journalCardRows'
|
||||||
el-col(:span='4'): strong As Of
|
:row='row'
|
||||||
request-list-item(v-if='journal.length > 0' v-for='request in journal' :request='request' :key='request.requestId')
|
: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
|
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')
|
||||||
|
notes-edit(:events='eventBus'
|
||||||
|
:toast='toast')
|
||||||
|
full-request(:events='eventBus')
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
|
import Vue from 'vue'
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
|
import chunk from 'lodash/chunk'
|
||||||
|
|
||||||
import PageTitle from './common/PageTitle'
|
import EditRequest from './request/EditRequest'
|
||||||
|
import FullRequest from './request/FullRequest'
|
||||||
import NewRequest from './request/NewRequest'
|
import NewRequest from './request/NewRequest'
|
||||||
|
import NotesEdit from './request/NotesEdit'
|
||||||
import RequestListItem from './request/RequestListItem'
|
import RequestListItem from './request/RequestListItem'
|
||||||
|
|
||||||
import actions from '@/store/action-types'
|
import actions from '@/store/action-types'
|
||||||
@@ -26,22 +37,32 @@ import actions from '@/store/action-types'
|
|||||||
export default {
|
export default {
|
||||||
name: 'journal',
|
name: 'journal',
|
||||||
components: {
|
components: {
|
||||||
PageTitle,
|
EditRequest,
|
||||||
|
FullRequest,
|
||||||
NewRequest,
|
NewRequest,
|
||||||
|
NotesEdit,
|
||||||
RequestListItem
|
RequestListItem
|
||||||
},
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
eventBus: new Vue()
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
title () {
|
title () {
|
||||||
return `${this.user.given_name}'s Prayer Journal`
|
return `${this.user.given_name}'s Prayer Journal`
|
||||||
},
|
},
|
||||||
|
journalCardRows () {
|
||||||
|
return chunk(this.journal, 3)
|
||||||
|
},
|
||||||
|
toast () {
|
||||||
|
return this.$parent.$refs.toast
|
||||||
|
},
|
||||||
...mapState(['user', 'journal', 'isLoadingJournal'])
|
...mapState(['user', 'journal', 'isLoadingJournal'])
|
||||||
},
|
},
|
||||||
async created () {
|
async created () {
|
||||||
await this.$store.dispatch(actions.LOAD_JOURNAL, this.$Progress)
|
await this.$store.dispatch(actions.LOAD_JOURNAL, this.$Progress)
|
||||||
this.$message({
|
this.toast.showToast(`Loaded ${this.journal.length} prayer requests`, { theme: 'success' })
|
||||||
message: `Loaded ${this.journal.length} prayer requests`,
|
|
||||||
type: 'success'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,13 +1,24 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
el-menu(theme='dark' mode='horizontal' class='mpj-top-nav' router='true')
|
b-navbar(toggleable='sm'
|
||||||
el-menu-item(index='/')
|
type='dark'
|
||||||
|
variant='mpj'
|
||||||
|
fixed='top')
|
||||||
|
b-nav-toggle(target='nav_collapse')
|
||||||
|
b-navbar-brand(to='/')
|
||||||
span(style='font-weight:100;') my
|
span(style='font-weight:100;') my
|
||||||
span(style='font-weight:600;') Prayer
|
span(style='font-weight:600;') Prayer
|
||||||
span(style='font-weight:700;') Journal
|
span(style='font-weight:700;') Journal
|
||||||
el-menu-item(v-if='isAuthenticated' index='/journal') Journal
|
b-collapse#nav_collapse(is-nav)
|
||||||
el-menu-item(v-if='isAuthenticated' index='3'): a(@click.stop='logOff()') Log Off
|
b-nav(is-nav-bar)
|
||||||
el-menu-item(v-if='!isAuthenticated' index='4'): a(@click.stop='logOn()') Log On
|
b-nav-item(v-if='isAuthenticated'
|
||||||
el-menu-item(index='5'): a(href='https://danieljsummers.github.io/myPrayerJournal/' target='_blank' @click.stop='') Docs
|
to='/journal') Journal
|
||||||
|
b-nav-item(v-if='isAuthenticated'
|
||||||
|
to='/answered') Answered
|
||||||
|
b-nav-item(v-if='isAuthenticated'): a(@click.stop='logOff()') Log Off
|
||||||
|
b-nav-item(v-if='!isAuthenticated'): a(@click.stop='logOn()') Log On
|
||||||
|
b-nav-item(href='https://danieljsummers.github.io/myPrayerJournal/'
|
||||||
|
target='_blank'
|
||||||
|
@click.stop='') Docs
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -23,6 +34,9 @@ export default {
|
|||||||
auth0: new AuthService()
|
auth0: new AuthService()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState([ 'isAuthenticated' ])
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
logOn () {
|
logOn () {
|
||||||
this.auth0.login()
|
this.auth0.login()
|
||||||
@@ -30,21 +44,6 @@ export default {
|
|||||||
logOff () {
|
logOff () {
|
||||||
this.auth0.logout(this.$store, this.$router)
|
this.auth0.logout(this.$store, this.$router)
|
||||||
}
|
}
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
...mapState([ 'isAuthenticated' ])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
|
||||||
.mpj-top-nav {
|
|
||||||
position: fixed;
|
|
||||||
top: 0px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.mpj-top-nav a:link,
|
|
||||||
.mpj-top-nav a:visited {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -20,8 +20,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
const dt = moment(this.value)
|
||||||
return {
|
return {
|
||||||
fromNow: moment(this.value).fromNow(),
|
fromNow: dt.fromNow(),
|
||||||
|
actual: dt.format('LLLL'),
|
||||||
intervalId: null
|
intervalId: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -39,7 +41,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
render (createElement) {
|
render (createElement) {
|
||||||
return createElement(this.tag, this.fromNow)
|
return createElement(this.tag, {
|
||||||
|
domProps: {
|
||||||
|
title: this.actual,
|
||||||
|
innerText: this.fromNow
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
h2.mpj-page-title(v-if='!hideOnPage' v-html='title')
|
h2.mpj-page-title(v-if='!hideOnPage'
|
||||||
|
v-html='title')
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -15,13 +16,20 @@ export default {
|
|||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
|
||||||
document.title = `${this.title} « myPrayerJournal`
|
|
||||||
},
|
|
||||||
watch: {
|
watch: {
|
||||||
title () {
|
title () {
|
||||||
document.title = `${this.title} « myPrayerJournal`
|
document.title = `${this.title} « myPrayerJournal`
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
created () {
|
||||||
|
document.title = `${this.title} « myPrayerJournal`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.mpj-page-title {
|
||||||
|
border-bottom: solid 1px lightgray;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -1,18 +1,30 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
span
|
b-modal(v-model='editVisible'
|
||||||
el-button(icon='edit' @click='openDialog()' title='Edit')
|
header-bg-variant='mpj'
|
||||||
el-dialog(title='Edit Prayer Request' :visible.sync='editVisible')
|
header-text-variant='light'
|
||||||
el-form(:model='form' :label-position='top')
|
size='lg'
|
||||||
el-form-item(label='Prayer Request')
|
title='Edit Prayer Request'
|
||||||
el-input(type='textarea' v-model='form.requestText' :rows='10' @blur="trimText()")
|
@edit='openDialog()'
|
||||||
el-form-item(label='Also Mark As')
|
@shows='focusRequestText')
|
||||||
el-radio-group(v-model='form.status')
|
b-form
|
||||||
el-radio-button(label='Updated') Updated
|
b-form-group(label='Prayer Request'
|
||||||
el-radio-button(label='Prayed') Prayed
|
label-for='request_text')
|
||||||
el-radio-button(label='Answered') Answered
|
b-textarea#request_text(ref='toFocus'
|
||||||
span.dialog-footer(slot='footer')
|
v-model='form.requestText'
|
||||||
el-button(@click='closeDialog()') Cancel
|
:rows='10'
|
||||||
el-button(type='primary' @click='saveRequest()') Save
|
@blur='trimText()')
|
||||||
|
b-form-group(label='Also Mark As')
|
||||||
|
b-radio-group(v-model='form.status'
|
||||||
|
buttons)
|
||||||
|
b-radio(value='Updated') Updated
|
||||||
|
b-radio(value='Prayed') Prayed
|
||||||
|
b-radio(value='Answered') Answered
|
||||||
|
div.w-100.text-right(slot='modal-footer')
|
||||||
|
b-btn(variant='primary'
|
||||||
|
@click='saveRequest()') Save
|
||||||
|
|
|
||||||
|
b-btn(variant='outline-secondary'
|
||||||
|
@click='closeDialog()') Cancel
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -22,25 +34,38 @@ import actions from '@/store/action-types'
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'edit-request',
|
name: 'edit-request',
|
||||||
props: [ 'request' ],
|
props: {
|
||||||
|
toast: { required: true },
|
||||||
|
events: { required: true }
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
editVisible: false,
|
editVisible: false,
|
||||||
form: {
|
form: {
|
||||||
requestText: this.request.text,
|
requestId: '',
|
||||||
|
requestText: '',
|
||||||
status: 'Updated'
|
status: 'Updated'
|
||||||
},
|
}
|
||||||
formLabelWidth: '120px'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created () {
|
||||||
|
this.events.$on('edit', this.openDialog)
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
closeDialog () {
|
closeDialog () {
|
||||||
|
this.form.requestId = ''
|
||||||
this.form.requestText = ''
|
this.form.requestText = ''
|
||||||
this.form.status = 'Updated'
|
this.form.status = 'Updated'
|
||||||
this.editVisible = false
|
this.editVisible = false
|
||||||
},
|
},
|
||||||
openDialog () {
|
focusRequestText (e) {
|
||||||
|
this.$refs.toFocus.focus()
|
||||||
|
},
|
||||||
|
openDialog (request) {
|
||||||
|
this.form.requestId = request.requestId
|
||||||
|
this.form.requestText = request.text
|
||||||
this.editVisible = true
|
this.editVisible = true
|
||||||
|
this.focusRequestText(null)
|
||||||
},
|
},
|
||||||
trimText () {
|
trimText () {
|
||||||
this.form.requestText = this.form.requestText.trim()
|
this.form.requestText = this.form.requestText.trim()
|
||||||
@@ -48,22 +73,16 @@ export default {
|
|||||||
async saveRequest () {
|
async saveRequest () {
|
||||||
await this.$store.dispatch(actions.UPDATE_REQUEST, {
|
await this.$store.dispatch(actions.UPDATE_REQUEST, {
|
||||||
progress: this.$Progress,
|
progress: this.$Progress,
|
||||||
requestId: this.request.requestId,
|
requestId: this.form.requestId,
|
||||||
updateText: this.form.requestText,
|
updateText: this.form.requestText,
|
||||||
status: this.form.status
|
status: this.form.status
|
||||||
})
|
})
|
||||||
if (this.form.status === 'Answered') {
|
if (this.form.status === 'Answered') {
|
||||||
this.$message({
|
this.toast.showToast('Request updated and removed from active journal', { theme: 'success' })
|
||||||
message: 'Request updated and removed from active journal',
|
|
||||||
type: 'success'
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
this.$message({
|
this.toast.showToast('Request updated', { theme: 'success' })
|
||||||
message: 'Request updated',
|
|
||||||
type: 'success'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
this.editVisible = false
|
this.closeDialog()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,19 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
span
|
span
|
||||||
el-button(icon='document' @click='openDialog()' title='Show History')
|
b-modal(v-model='historyVisible'
|
||||||
el-dialog(title='Prayer Request History' :visible.sync='historyVisible')
|
header-bg-variant='mpj'
|
||||||
span(v-if='null !== full')
|
header-text-variant='light'
|
||||||
full-request-history(v-for='item in full.history' :history='item' :key='item.asOf')
|
size='lg'
|
||||||
span.dialog-footer(slot='footer')
|
title='Prayer Request History'
|
||||||
el-button(type='primary' @click='closeDialog()') Close
|
@shows='focusRequestText')
|
||||||
|
b-list-group(v-if='null !== full'
|
||||||
|
flush)
|
||||||
|
full-request-history(v-for='item in full.history'
|
||||||
|
:key='item.asOf'
|
||||||
|
:history='item')
|
||||||
|
div.w-100.text-right(slot='modal-footer')
|
||||||
|
b-btn(variant='primary'
|
||||||
|
@click='closeDialog()') Close
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -17,25 +25,30 @@ import api from '@/api'
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'full-request',
|
name: 'full-request',
|
||||||
props: [ 'request' ],
|
components: {
|
||||||
|
FullRequestHistory
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
events: { required: true }
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
historyVisible: false,
|
historyVisible: false,
|
||||||
full: null
|
full: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
created () {
|
||||||
FullRequestHistory
|
this.events.$on('full', this.openDialog)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
closeDialog () {
|
closeDialog () {
|
||||||
this.full = null
|
this.full = null
|
||||||
this.historyVisible = false
|
this.historyVisible = false
|
||||||
},
|
},
|
||||||
async openDialog () {
|
async openDialog (requestId) {
|
||||||
this.historyVisible = true
|
this.historyVisible = true
|
||||||
this.$Progress.start()
|
this.$Progress.start()
|
||||||
const req = await api.getFullRequest(this.request.requestId)
|
const req = await api.getFullRequest(requestId)
|
||||||
this.full = req.data
|
this.full = req.data
|
||||||
this.$Progress.finish()
|
this.$Progress.finish()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
p.journal-request
|
b-list-group-item
|
||||||
| {{ history.status }} {{ asOf }}
|
| {{ history.status }}
|
||||||
span(v-if='0 < history.text.length') » {{ history.text }}
|
|
|
||||||
|
small.text-muted {{ asOf }}
|
||||||
|
div(v-if='hasText').mpj-request-text {{ history.text }}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -11,10 +13,15 @@ import moment from 'moment'
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'full-request-history',
|
name: 'full-request-history',
|
||||||
props: [ 'history' ],
|
props: {
|
||||||
|
history: { required: true }
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
asOf () {
|
asOf () {
|
||||||
return moment(this.history.asOf).fromNow()
|
return moment(this.history.asOf).fromNow()
|
||||||
|
},
|
||||||
|
hasText () {
|
||||||
|
return this.history.text.length > 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,28 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
div
|
div
|
||||||
el-button(icon='plus' @click='openDialog()') Add a New Request
|
b-btn(@click='openDialog()' size='sm' variant='primary')
|
||||||
el-dialog(title='Add a New Prayer Request' :visible.sync='showNewVisible')
|
icon(name='plus')
|
||||||
el-form(:model='form' :label-position='top')
|
| Add a New Request
|
||||||
el-form-item(label='Prayer Request')
|
b-modal(v-model='showNewVisible'
|
||||||
el-input(type='textarea' v-model='form.requestText' :rows='10' @blur='trimText()')
|
header-bg-variant='mpj'
|
||||||
span.dialog-footer(slot='footer')
|
header-text-variant='light'
|
||||||
el-button(@click='closeDialog()') Cancel
|
size='lg'
|
||||||
el-button(type='primary' @click='saveRequest()') Save
|
title='Add a New Prayer Request'
|
||||||
|
@shown='focusRequestText')
|
||||||
|
b-form
|
||||||
|
b-form-group(label='Prayer Request'
|
||||||
|
label-for='request_text')
|
||||||
|
b-textarea#request_text(ref='toFocus'
|
||||||
|
v-model='form.requestText'
|
||||||
|
:rows='10'
|
||||||
|
@blur='trimText()')
|
||||||
|
div.w-100.text-right(slot='modal-footer')
|
||||||
|
b-btn(variant='primary'
|
||||||
|
@click='saveRequest()') Save
|
||||||
|
|
|
||||||
|
b-btn(variant='outline-secondary'
|
||||||
|
@click='closeDialog()') Cancel
|
||||||
|
toast(ref='toast')
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -26,11 +41,17 @@ export default {
|
|||||||
formLabelWidth: '120px'
|
formLabelWidth: '120px'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted () {
|
||||||
|
this.$refs.toast.setOptions({ position: 'bottom right' })
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
closeDialog () {
|
closeDialog () {
|
||||||
this.form.requestText = ''
|
this.form.requestText = ''
|
||||||
this.showNewVisible = false
|
this.showNewVisible = false
|
||||||
},
|
},
|
||||||
|
focusRequestText (e) {
|
||||||
|
this.$refs.toFocus.focus()
|
||||||
|
},
|
||||||
openDialog () {
|
openDialog () {
|
||||||
this.showNewVisible = true
|
this.showNewVisible = true
|
||||||
},
|
},
|
||||||
@@ -42,10 +63,7 @@ export default {
|
|||||||
progress: this.$Progress,
|
progress: this.$Progress,
|
||||||
requestText: this.form.requestText
|
requestText: this.form.requestText
|
||||||
})
|
})
|
||||||
this.$message({
|
this.$refs.toast.showToast('New prayer request added', { theme: 'success' })
|
||||||
message: 'New prayer request added',
|
|
||||||
type: 'success'
|
|
||||||
})
|
|
||||||
this.closeDialog()
|
this.closeDialog()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
116
src/app/src/components/request/NotesEdit.vue
Normal file
116
src/app/src/components/request/NotesEdit.vue
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
<template lang="pug">
|
||||||
|
b-modal(v-model='notesVisible'
|
||||||
|
header-bg-variant='mpj'
|
||||||
|
header-text-variant='light'
|
||||||
|
size='lg'
|
||||||
|
title='Add Notes to Prayer Request'
|
||||||
|
@edit='openDialog()'
|
||||||
|
@shows='focusNotes')
|
||||||
|
b-form
|
||||||
|
b-form-group(label='Notes'
|
||||||
|
label-for='notes')
|
||||||
|
b-textarea#notes(ref='toFocus'
|
||||||
|
v-model='form.notes'
|
||||||
|
:rows='10'
|
||||||
|
@blur='trimText()')
|
||||||
|
div(v-if='hasPriorNotes')
|
||||||
|
p.text-center: strong Prior Notes for This Request
|
||||||
|
b-list-group(flush)
|
||||||
|
b-list-group-item(v-for='note in priorNotes'
|
||||||
|
:key='note.asOf')
|
||||||
|
small.text-muted: date-from-now(:value='note.asOf')
|
||||||
|
br
|
||||||
|
div.mpj-request-text {{ note.notes }}
|
||||||
|
div(v-else-if='noPriorNotes').text-center.text-muted There are no prior notes for this request
|
||||||
|
div(v-else).text-center
|
||||||
|
b-btn(variant='outline-secondary'
|
||||||
|
@click='loadNotes()') Load Prior Notes
|
||||||
|
div.w-100.text-right(slot='modal-footer')
|
||||||
|
b-btn(variant='primary'
|
||||||
|
@click='saveNotes()') Save
|
||||||
|
|
|
||||||
|
b-btn(variant='outline-secondary'
|
||||||
|
@click='closeDialog()') Cancel
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
import api from '@/api'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'notes-edit',
|
||||||
|
props: {
|
||||||
|
toast: { required: true },
|
||||||
|
events: { required: true }
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
notesVisible: false,
|
||||||
|
form: {
|
||||||
|
requestId: '',
|
||||||
|
notes: ''
|
||||||
|
},
|
||||||
|
priorNotes: [],
|
||||||
|
priorNotesLoaded: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
hasPriorNotes () {
|
||||||
|
return this.priorNotesLoaded && this.priorNotes.length > 0
|
||||||
|
},
|
||||||
|
noPriorNotes () {
|
||||||
|
return this.priorNotesLoaded && this.priorNotes.length === 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created () {
|
||||||
|
this.events.$on('notes', this.openDialog)
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
closeDialog () {
|
||||||
|
this.form.requestId = ''
|
||||||
|
this.form.notes = ''
|
||||||
|
this.priorNotes = []
|
||||||
|
this.priorNotesLoaded = false
|
||||||
|
this.notesVisible = false
|
||||||
|
},
|
||||||
|
focusNotes (e) {
|
||||||
|
this.$refs.toFocus.focus()
|
||||||
|
},
|
||||||
|
async loadNotes () {
|
||||||
|
this.$Progress.start()
|
||||||
|
try {
|
||||||
|
const notes = await api.getNotes(this.form.requestId)
|
||||||
|
this.priorNotes = notes.data
|
||||||
|
console.log(this.priorNotes)
|
||||||
|
this.$Progress.finish()
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
this.$Progress.fail()
|
||||||
|
} finally {
|
||||||
|
this.priorNotesLoaded = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
openDialog (request) {
|
||||||
|
this.form.requestId = request.requestId
|
||||||
|
this.notesVisible = true
|
||||||
|
this.focusNotes(null)
|
||||||
|
},
|
||||||
|
async saveNotes () {
|
||||||
|
this.$Progress.start()
|
||||||
|
try {
|
||||||
|
await api.addNote(this.form.requestId, this.form.notes)
|
||||||
|
this.$Progress.finish()
|
||||||
|
this.toast.showToast('Added notes', { theme: 'success' })
|
||||||
|
this.closeDialog()
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
this.$Progress.fail()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
trimText () {
|
||||||
|
this.form.notes = this.form.notes.trim()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -1,62 +1,57 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
el-row.journal-request
|
div
|
||||||
el-col(:span='4'): p
|
b-card-group.w-100(deck)
|
||||||
el-button(icon='check' @click='markPrayed()' title='Pray')
|
b-card(v-for='(request, idx) in row'
|
||||||
edit-request(:request='request')
|
:key='request.requestId'
|
||||||
full-request(:request='request')
|
border-variant='dark'
|
||||||
el-col(:span='16'): p {{ text }}
|
no-body)
|
||||||
el-col(:span='4'): p: date-from-now(:value='request.asOf')
|
b-card-header.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(@click.stop='showNotes(request)' 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-body.p-0
|
||||||
|
p.card-text.mpj-request-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(v-for='it in 3 - row.length' key='-1')
|
||||||
|
br
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
import moment from 'moment'
|
|
||||||
|
|
||||||
import DateFromNow from '../common/DateFromNow'
|
|
||||||
import EditRequest from './EditRequest'
|
|
||||||
import FullRequest from './FullRequest'
|
|
||||||
|
|
||||||
import actions from '@/store/action-types'
|
import actions from '@/store/action-types'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'request-list-item',
|
name: 'request-list-item',
|
||||||
props: [ 'request' ],
|
props: {
|
||||||
data () {
|
row: { required: true },
|
||||||
return { interval: null }
|
toast: { required: true },
|
||||||
},
|
events: { required: true }
|
||||||
components: {
|
|
||||||
DateFromNow,
|
|
||||||
EditRequest,
|
|
||||||
FullRequest
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async markPrayed () {
|
async markPrayed (idx) {
|
||||||
await this.$store.dispatch(actions.UPDATE_REQUEST, {
|
await this.$store.dispatch(actions.UPDATE_REQUEST, {
|
||||||
progress: this.$Progress,
|
progress: this.$Progress,
|
||||||
requestId: this.request.requestId,
|
requestId: this.row[idx].requestId,
|
||||||
status: 'Prayed',
|
status: 'Prayed',
|
||||||
updateText: ''
|
updateText: ''
|
||||||
})
|
})
|
||||||
this.$message({
|
this.toast.showToast('Request marked as prayed', { theme: 'success' })
|
||||||
message: 'Request marked as prayed',
|
|
||||||
type: 'success'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
asOf () {
|
|
||||||
return moment(this.request.asOf).fromNow()
|
|
||||||
},
|
},
|
||||||
text () {
|
showEdit (request) {
|
||||||
return this.request.text.split('\n').join('<br>')
|
this.events.$emit('edit', request)
|
||||||
|
},
|
||||||
|
showFull (idx) {
|
||||||
|
this.events.$emit('full', this.row[idx].requestId)
|
||||||
|
},
|
||||||
|
showNotes (request) {
|
||||||
|
this.events.$emit('notes', request)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
|
||||||
.journal-request {
|
|
||||||
border-bottom: dotted 1px lightgray;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -7,14 +7,10 @@ article
|
|||||||
<script>
|
<script>
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
import PageTitle from '../common/PageTitle'
|
|
||||||
import AuthService from '@/auth/AuthService'
|
import AuthService from '@/auth/AuthService'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'log-on',
|
name: 'log-on',
|
||||||
components: {
|
|
||||||
PageTitle
|
|
||||||
},
|
|
||||||
created () {
|
created () {
|
||||||
this.$Progress.start()
|
this.$Progress.start()
|
||||||
new AuthService().handleAuthentication(this.$store, this.$router)
|
new AuthService().handleAuthentication(this.$store, this.$router)
|
||||||
|
|||||||
@@ -1,20 +1,33 @@
|
|||||||
// The Vue build version to load with the `import` command
|
// The Vue build version to load with the `import` command
|
||||||
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
|
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import ElementUI from 'element-ui'
|
import BootstrapVue from 'bootstrap-vue'
|
||||||
|
import Icon from 'vue-awesome/components/Icon'
|
||||||
import VueProgressBar from 'vue-progressbar'
|
import VueProgressBar from 'vue-progressbar'
|
||||||
import 'element-ui/lib/theme-default/index.css'
|
import VueToast from 'vue-toast'
|
||||||
|
|
||||||
|
import 'bootstrap-vue/dist/bootstrap-vue.css'
|
||||||
|
import 'bootstrap/dist/css/bootstrap.css'
|
||||||
|
import 'vue-toast/dist/vue-toast.min.css'
|
||||||
|
|
||||||
|
// Only import the icons we need; the whole set is ~500K!
|
||||||
|
import 'vue-awesome/icons/check'
|
||||||
|
import 'vue-awesome/icons/file-text-o'
|
||||||
|
import 'vue-awesome/icons/pencil'
|
||||||
|
import 'vue-awesome/icons/plus'
|
||||||
|
import 'vue-awesome/icons/search'
|
||||||
|
|
||||||
import App from './App'
|
import App from './App'
|
||||||
import router from './router'
|
import router from './router'
|
||||||
import store from './store'
|
import store from './store'
|
||||||
|
import DateFromNow from './components/common/DateFromNow'
|
||||||
|
import PageTitle from './components/common/PageTitle'
|
||||||
|
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
|
|
||||||
Vue.use(ElementUI)
|
Vue.use(BootstrapVue)
|
||||||
|
|
||||||
Vue.use(VueProgressBar, {
|
Vue.use(VueProgressBar, {
|
||||||
color: 'rgb(32, 160, 255)',
|
color: 'yellow',
|
||||||
failedColor: 'red',
|
failedColor: 'red',
|
||||||
height: '5px',
|
height: '5px',
|
||||||
transition: {
|
transition: {
|
||||||
@@ -24,6 +37,11 @@ Vue.use(VueProgressBar, {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Vue.component('icon', Icon)
|
||||||
|
Vue.component('date-from-now', DateFromNow)
|
||||||
|
Vue.component('page-title', PageTitle)
|
||||||
|
Vue.component('toast', VueToast)
|
||||||
|
|
||||||
/* eslint-disable no-new */
|
/* eslint-disable no-new */
|
||||||
new Vue({
|
new Vue({
|
||||||
el: '#app',
|
el: '#app',
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import Router from 'vue-router'
|
import Router from 'vue-router'
|
||||||
|
|
||||||
|
import Answered from '@/components/Answered'
|
||||||
|
import AnsweredDetail from '@/components/AnsweredDetail'
|
||||||
import Home from '@/components/Home'
|
import Home from '@/components/Home'
|
||||||
import Journal from '@/components/Journal'
|
import Journal from '@/components/Journal'
|
||||||
import LogOn from '@/components/user/LogOn'
|
import LogOn from '@/components/user/LogOn'
|
||||||
@@ -10,8 +12,31 @@ Vue.use(Router)
|
|||||||
export default new Router({
|
export default new Router({
|
||||||
mode: 'history',
|
mode: 'history',
|
||||||
routes: [
|
routes: [
|
||||||
{ path: '/', name: 'Home', component: Home },
|
{
|
||||||
{ path: '/journal', name: 'Journal', component: Journal },
|
path: '/',
|
||||||
{ path: '/user/log-on', name: 'LogOn', component: LogOn }
|
name: 'Home',
|
||||||
|
component: Home
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/answered/:id',
|
||||||
|
name: 'AnsweredDetail',
|
||||||
|
component: AnsweredDetail,
|
||||||
|
props: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/answered',
|
||||||
|
name: 'Answered',
|
||||||
|
component: Answered
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/journal',
|
||||||
|
name: 'Journal',
|
||||||
|
component: Journal
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/user/log-on',
|
||||||
|
name: 'LogOn',
|
||||||
|
component: LogOn
|
||||||
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -33,7 +33,13 @@ const logError = function (error) {
|
|||||||
export default new Vuex.Store({
|
export default new Vuex.Store({
|
||||||
state: {
|
state: {
|
||||||
user: JSON.parse(localStorage.getItem('user_profile') || '{}'),
|
user: JSON.parse(localStorage.getItem('user_profile') || '{}'),
|
||||||
isAuthenticated: this.auth0.isAuthenticated(),
|
isAuthenticated: (() => {
|
||||||
|
this.auth0.scheduleRenewal()
|
||||||
|
if (this.auth0.isAuthenticated()) {
|
||||||
|
api.setBearer(localStorage.getItem('id_token'))
|
||||||
|
}
|
||||||
|
return this.auth0.isAuthenticated()
|
||||||
|
})(),
|
||||||
journal: {},
|
journal: {},
|
||||||
isLoadingJournal: false
|
isLoadingJournal: false
|
||||||
},
|
},
|
||||||
|
|||||||
22
src/app/static/silent.html
Normal file
22
src/app/static/silent.html
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<script src="https://cdn.auth0.com/js/auth0/8.9/auth0.min.js"></script>
|
||||||
|
<script>
|
||||||
|
var webAuth = new auth0.WebAuth({
|
||||||
|
domain: 'djs-consulting.auth0.com',
|
||||||
|
clientID: 'Of2s0RQCQ3mt3dwIkOBY5h85J9sXbF2n',
|
||||||
|
scope: 'openid profile email',
|
||||||
|
responseType: 'token id_token',
|
||||||
|
redirectUri: location.protocol + '//' + location.host + '/static/silent.html'
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
webAuth.parseHash(window.location.hash, function (err, response) {
|
||||||
|
parent.postMessage(err || response, location.protocol + '//' + location.host);
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body></body>
|
||||||
|
</html>
|
||||||
@@ -241,10 +241,6 @@ async-each@^1.0.0:
|
|||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d"
|
resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d"
|
||||||
|
|
||||||
async-validator@1.6.9:
|
|
||||||
version "1.6.9"
|
|
||||||
resolved "https://registry.yarnpkg.com/async-validator/-/async-validator-1.6.9.tgz#a8309daa8b83421cdbd4628e026d6abb25192d34"
|
|
||||||
|
|
||||||
async@1.x, async@^1.4.0:
|
async@1.x, async@^1.4.0:
|
||||||
version "1.5.2"
|
version "1.5.2"
|
||||||
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
|
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
|
||||||
@@ -480,10 +476,6 @@ babel-helper-replace-supers@^6.24.1:
|
|||||||
babel-traverse "^6.24.1"
|
babel-traverse "^6.24.1"
|
||||||
babel-types "^6.24.1"
|
babel-types "^6.24.1"
|
||||||
|
|
||||||
babel-helper-vue-jsx-merge-props@^2.0.0:
|
|
||||||
version "2.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.2.tgz#aceb1c373588279e2755ea1cfd35c22394fd33f8"
|
|
||||||
|
|
||||||
babel-helpers@^6.24.1:
|
babel-helpers@^6.24.1:
|
||||||
version "6.24.1"
|
version "6.24.1"
|
||||||
resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.24.1.tgz#3471de9caec388e5c850e597e58a26ddf37602b2"
|
resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.24.1.tgz#3471de9caec388e5c850e597e58a26ddf37602b2"
|
||||||
@@ -1001,6 +993,16 @@ boom@5.x.x:
|
|||||||
dependencies:
|
dependencies:
|
||||||
hoek "4.x.x"
|
hoek "4.x.x"
|
||||||
|
|
||||||
|
bootstrap-vue@^1.0.0-beta.9:
|
||||||
|
version "1.0.0-beta.9"
|
||||||
|
resolved "https://registry.yarnpkg.com/bootstrap-vue/-/bootstrap-vue-1.0.0-beta.9.tgz#4e0bc5bcb95a90dc3bec7124ea3ddf5cc4c6ffa6"
|
||||||
|
dependencies:
|
||||||
|
bootstrap "^4.0.0-beta"
|
||||||
|
|
||||||
|
bootstrap@^4.0.0-beta:
|
||||||
|
version "4.0.0-beta"
|
||||||
|
resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.0.0-beta.tgz#dc5928175d2e71310bc668cf9e05a907211b72a6"
|
||||||
|
|
||||||
brace-expansion@^1.0.0, brace-expansion@^1.1.7:
|
brace-expansion@^1.0.0, brace-expansion@^1.1.7:
|
||||||
version "1.1.8"
|
version "1.1.8"
|
||||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292"
|
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292"
|
||||||
@@ -1792,10 +1794,6 @@ deep-is@~0.1.3:
|
|||||||
version "0.1.3"
|
version "0.1.3"
|
||||||
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
|
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
|
||||||
|
|
||||||
deepmerge@^1.2.0:
|
|
||||||
version "1.5.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-1.5.2.tgz#10499d868844cdad4fee0842df8c7f6f0c95a753"
|
|
||||||
|
|
||||||
defined@^1.0.0:
|
defined@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693"
|
resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693"
|
||||||
@@ -1986,15 +1984,6 @@ electron-to-chromium@^1.2.7, electron-to-chromium@^1.3.18:
|
|||||||
version "1.3.21"
|
version "1.3.21"
|
||||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.21.tgz#a967ebdcfe8ed0083fc244d1894022a8e8113ea2"
|
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.21.tgz#a967ebdcfe8ed0083fc244d1894022a8e8113ea2"
|
||||||
|
|
||||||
element-ui@^1.4.4:
|
|
||||||
version "1.4.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/element-ui/-/element-ui-1.4.4.tgz#cbcb0bf36d06b7e9c8cefdb4514d2d0a50a4a6db"
|
|
||||||
dependencies:
|
|
||||||
async-validator "1.6.9"
|
|
||||||
babel-helper-vue-jsx-merge-props "^2.0.0"
|
|
||||||
deepmerge "^1.2.0"
|
|
||||||
throttle-debounce "^1.0.1"
|
|
||||||
|
|
||||||
elliptic@^6.0.0:
|
elliptic@^6.0.0:
|
||||||
version "6.4.0"
|
version "6.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.0.tgz#cac9af8762c85836187003c8dfe193e5e2eae5df"
|
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.0.tgz#cac9af8762c85836187003c8dfe193e5e2eae5df"
|
||||||
@@ -5937,10 +5926,6 @@ text-table@^0.2.0, text-table@~0.2.0:
|
|||||||
version "0.2.0"
|
version "0.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
|
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
|
||||||
|
|
||||||
throttle-debounce@^1.0.1:
|
|
||||||
version "1.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/throttle-debounce/-/throttle-debounce-1.0.1.tgz#dad0fe130f9daf3719fdea33dc36a8e6ba7f30b5"
|
|
||||||
|
|
||||||
throttleit@^1.0.0:
|
throttleit@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/throttleit/-/throttleit-1.0.0.tgz#9e785836daf46743145a5984b6268d828528ac6c"
|
resolved "https://registry.yarnpkg.com/throttleit/-/throttleit-1.0.0.tgz#9e785836daf46743145a5984b6268d828528ac6c"
|
||||||
@@ -6208,6 +6193,10 @@ void-elements@^2.0.0, void-elements@^2.0.1:
|
|||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-2.0.1.tgz#c066afb582bb1cb4128d60ea92392e94d5e9dbec"
|
resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-2.0.1.tgz#c066afb582bb1cb4128d60ea92392e94d5e9dbec"
|
||||||
|
|
||||||
|
vue-awesome@^2.3.3:
|
||||||
|
version "2.3.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/vue-awesome/-/vue-awesome-2.3.3.tgz#e83f976fe5c7f86d207c24ca33731bdc6e9906a9"
|
||||||
|
|
||||||
vue-hot-reload-api@^2.1.0:
|
vue-hot-reload-api@^2.1.0:
|
||||||
version "2.1.0"
|
version "2.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/vue-hot-reload-api/-/vue-hot-reload-api-2.1.0.tgz#9ca58a6e0df9078554ce1708688b6578754d86de"
|
resolved "https://registry.yarnpkg.com/vue-hot-reload-api/-/vue-hot-reload-api-2.1.0.tgz#9ca58a6e0df9078554ce1708688b6578754d86de"
|
||||||
@@ -6256,6 +6245,10 @@ vue-template-es2015-compiler@^1.2.2:
|
|||||||
version "1.5.3"
|
version "1.5.3"
|
||||||
resolved "https://registry.yarnpkg.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.5.3.tgz#22787de4e37ebd9339b74223bc467d1adee30545"
|
resolved "https://registry.yarnpkg.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.5.3.tgz#22787de4e37ebd9339b74223bc467d1adee30545"
|
||||||
|
|
||||||
|
vue-toast@^3.1.0:
|
||||||
|
version "3.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/vue-toast/-/vue-toast-3.1.0.tgz#19eb4c8150faf5c31c12f8b897a955d1ac0b5e9e"
|
||||||
|
|
||||||
vue@^2.4.4:
|
vue@^2.4.4:
|
||||||
version "2.4.4"
|
version "2.4.4"
|
||||||
resolved "https://registry.yarnpkg.com/vue/-/vue-2.4.4.tgz#ea9550b96a71465fd2b8b17b61673b3561861789"
|
resolved "https://registry.yarnpkg.com/vue/-/vue-2.4.4.tgz#ea9550b96a71465fd2b8b17b61673b3561861789"
|
||||||
|
|||||||
Reference in New Issue
Block a user