From d3aff4a11056dc2480eca4aab759fd1866f4bc19 Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Fri, 17 Aug 2018 20:59:57 -0500 Subject: [PATCH] Add/Edit request works No longer a modal (#20) --- src/api/MyPrayerJournal.Api/Handlers.fs | 2 +- src/app/src/App.vue | 12 ++ src/app/src/api/index.js | 2 +- src/app/src/components/Journal.vue | 11 +- .../src/components/request/EditRequest.vue | 148 ++++++++++++------ .../src/components/request/RequestCard.vue | 30 ++-- src/app/src/router/index.js | 7 + src/app/src/store/index.js | 8 +- 8 files changed, 135 insertions(+), 85 deletions(-) diff --git a/src/api/MyPrayerJournal.Api/Handlers.fs b/src/api/MyPrayerJournal.Api/Handlers.fs index 7df9836..5073d76 100644 --- a/src/api/MyPrayerJournal.Api/Handlers.fs +++ b/src/api/MyPrayerJournal.Api/Handlers.fs @@ -26,7 +26,7 @@ module Error = /// Handle 404s from the API, sending known URL paths to the Vue app so that they can be handled there let notFound : HttpHandler = fun next ctx -> - [ "/answered"; "/journal"; "/snoozed"; "/user" ] + [ "/answered"; "/journal"; "/legal"; "/request"; "/snoozed"; "/user" ] |> List.filter ctx.Request.Path.Value.StartsWith |> List.length |> function diff --git a/src/app/src/App.vue b/src/app/src/App.vue index f68c23d..be30745 100644 --- a/src/app/src/App.vue +++ b/src/app/src/App.vue @@ -61,8 +61,17 @@ a[role="button"] { border-radius: .5rem; background-color: whitesmoke; } +a[role="button"] { + padding: .25rem; +} +button.primary, +a[role="button"].primary { + background-color: white; + border-width: 3px; +} button:hover, a[role="button"]:hover { + cursor: pointer; background-color: #050; color: white; text-decoration: none; @@ -132,4 +141,7 @@ a:hover { margin-left: 1rem; margin-right: 1rem; } +.material-icons { + vertical-align: middle; +} diff --git a/src/app/src/api/index.js b/src/app/src/api/index.js index 5d24c4d..5720496 100644 --- a/src/app/src/api/index.js +++ b/src/app/src/api/index.js @@ -31,7 +31,7 @@ export default { * Add a new prayer request * @param {string} requestText The text of the request to be added */ - addRequest: requestText => http.post('request', { requestText }), + addRequest: requestText => http.post('request', { requestText, recurType: 'immediate' }), /** * Get all answered requests, along with the text they had when it was answered diff --git a/src/app/src/components/Journal.vue b/src/app/src/components/Journal.vue index 6cee922..d2747be 100644 --- a/src/app/src/components/Journal.vue +++ b/src/app/src/components/Journal.vue @@ -3,7 +3,10 @@ article.mpj-main-content-wide(role='main') page-title(:title='title') p(v-if='isLoadingJournal') Loading your prayer journal... template(v-else) - new-request + router-link(:to="{ name: 'EditRequest', params: { id: 'new' } }" + role='button') + md-icon(icon='add_box') + |   Add a New Request br .mpj-journal(v-if='journal.length > 0') request-card(v-for='request in journal' @@ -13,8 +16,6 @@ article.mpj-main-content-wide(role='main') :toast='toast') p.text-center(v-else): 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') snooze-request(:events='eventBus' @@ -27,8 +28,6 @@ article.mpj-main-content-wide(role='main') import Vue from 'vue' import { mapState } from 'vuex' -import EditRequest from './request/EditRequest' -import NewRequest from './request/NewRequest' import NotesEdit from './request/NotesEdit' import RequestCard from './request/RequestCard' import SnoozeRequest from './request/SnoozeRequest' @@ -38,8 +37,6 @@ import actions from '@/store/action-types' export default { name: 'journal', components: { - EditRequest, - NewRequest, NotesEdit, RequestCard, SnoozeRequest diff --git a/src/app/src/components/request/EditRequest.vue b/src/app/src/components/request/EditRequest.vue index 77e9544..235cd12 100644 --- a/src/app/src/components/request/EditRequest.vue +++ b/src/app/src/components/request/EditRequest.vue @@ -1,46 +1,62 @@ + + diff --git a/src/app/src/components/request/RequestCard.vue b/src/app/src/components/request/RequestCard.vue index 850ab20..bb226b9 100644 --- a/src/app/src/components/request/RequestCard.vue +++ b/src/app/src/components/request/RequestCard.vue @@ -1,10 +1,10 @@