From 7f72e5cded65e719e08b99c204e82319b47e12ef Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Tue, 11 Jun 2019 13:02:36 -0500 Subject: [PATCH] First cut at adding /web to all the links --- src/PrayerTracker.UI/Church.fs | 8 ++--- src/PrayerTracker.UI/Home.fs | 2 +- src/PrayerTracker.UI/Layout.fs | 42 +++++++++++++-------------- src/PrayerTracker.UI/PrayerRequest.fs | 36 +++++++++++------------ src/PrayerTracker.UI/SmallGroup.fs | 32 ++++++++++---------- src/PrayerTracker.UI/User.fs | 16 +++++----- src/PrayerTracker/App.fs | 31 ++++++++++---------- src/PrayerTracker/Church.fs | 4 +-- src/PrayerTracker/CommonFunctions.fs | 8 ++--- src/PrayerTracker/Home.fs | 4 +-- src/PrayerTracker/PrayerRequest.fs | 12 ++++---- src/PrayerTracker/SmallGroup.fs | 14 ++++----- src/PrayerTracker/User.fs | 22 +++++++------- 13 files changed, 116 insertions(+), 115 deletions(-) diff --git a/src/PrayerTracker.UI/Church.fs b/src/PrayerTracker.UI/Church.fs index 341d473..7d1cdbd 100644 --- a/src/PrayerTracker.UI/Church.fs +++ b/src/PrayerTracker.UI/Church.fs @@ -8,7 +8,7 @@ open PrayerTracker.ViewModels let edit (m : EditChurch) ctx vi = let pageTitle = match m.isNew () with true -> "Add a New Church" | false -> "Edit Church" let s = I18N.localizer.Force () - [ form [ _action "/church/save"; _method "post"; _class "pt-center-columns" ] [ + [ form [ _action "/web/church/save"; _method "post"; _class "pt-center-columns" ] [ style [ _scoped ] [ rawText "#name { width: 20rem; } #city { width: 10rem; } #st { width: 3rem; } #interfaceAddress { width: 30rem; }" ] csrfToken ctx @@ -74,12 +74,12 @@ let maintain (churches : Church list) (stats : Map) ctx vi churches |> List.map (fun ch -> let chId = flatGuid ch.churchId - let delAction = sprintf "/church/%s/delete" chId + let delAction = sprintf "/web/church/%s/delete" chId let delPrompt = s.["Are you sure you want to delete this {0}? This action cannot be undone.", sprintf "%s (%s)" (s.["Church"].Value.ToLower ()) ch.name] tr [] [ td [] [ - a [ _href (sprintf "/church/%s/edit" chId); _title s.["Edit This Church"].Value ] [ icon "edit" ] + a [ _href (sprintf "/web/church/%s/edit" chId); _title s.["Edit This Church"].Value ] [ icon "edit" ] a [ _href delAction _title s.["Delete This Church"].Value _onclick (sprintf "return PT.confirmDelete('%s','%A')" delAction delPrompt) ] @@ -96,7 +96,7 @@ let maintain (churches : Church list) (stats : Map) ctx vi ] [ div [ _class "pt-center-text" ] [ br [] - a [ _href (sprintf "/church/%s/edit" emptyGuid); _title s.["Add a New Church"].Value ] + a [ _href (sprintf "/web/church/%s/edit" emptyGuid); _title s.["Add a New Church"].Value ] [ icon "add_circle"; rawText "  "; locStr s.["Add a New Church"] ] br [] br [] diff --git a/src/PrayerTracker.UI/Home.fs b/src/PrayerTracker.UI/Home.fs index 4f380fb..5744d35 100644 --- a/src/PrayerTracker.UI/Home.fs +++ b/src/PrayerTracker.UI/Home.fs @@ -203,7 +203,7 @@ let termsOfService vi = use sw = new StringWriter () let raw = rawLocText sw let ppLink = - a [ _href "/legal/privacy-policy" ] [ str (s.["Privacy Policy"].Value.ToLower ()) ] + a [ _href "/web/legal/privacy-policy" ] [ str (s.["Privacy Policy"].Value.ToLower ()) ] |> (renderHtmlNode >> HtmlString) [ p [ _class "pt-right-text" ] [ small [] [ em [] [ raw l.["(as of May 24, 2018)"] ] ] ] diff --git a/src/PrayerTracker.UI/Layout.fs b/src/PrayerTracker.UI/Layout.fs index d9d346c..6426893 100644 --- a/src/PrayerTracker.UI/Layout.fs +++ b/src/PrayerTracker.UI/Layout.fs @@ -26,17 +26,17 @@ module Navigation = a [ _class "dropbtn"; _role "button"; _aria "label" s.["Requests"].Value; _title s.["Requests"].Value ] [ icon "question_answer"; space; locStr s.["Requests"]; space; icon "keyboard_arrow_down" ] div [ _class "dropdown-content"; _role "menu" ] [ - a [ _href "/prayer-requests" ] [ icon "compare_arrows"; menuSpacer; locStr s.["Maintain"] ] - a [ _href "/prayer-requests/view" ] [ icon "list"; menuSpacer; locStr s.["View List"] ] + a [ _href "/web/prayer-requests" ] [ icon "compare_arrows"; menuSpacer; locStr s.["Maintain"] ] + a [ _href "/web/prayer-requests/view" ] [ icon "list"; menuSpacer; locStr s.["View List"] ] ] ] yield li [ _class "dropdown" ] [ a [ _class "dropbtn"; _role "button"; _aria "label" s.["Group"].Value; _title s.["Group"].Value ] [ icon "group"; space; locStr s.["Group"]; space; icon "keyboard_arrow_down" ] div [ _class "dropdown-content"; _role "menu" ] [ - a [ _href "/small-group/members" ] [ icon "email"; menuSpacer; locStr s.["Maintain Group Members"] ] - a [ _href "/small-group/announcement" ] [ icon "send"; menuSpacer; locStr s.["Send Announcement"] ] - a [ _href "/small-group/preferences" ] [ icon "build"; menuSpacer; locStr s.["Change Preferences"] ] + a [ _href "/web/small-group/members" ] [ icon "email"; menuSpacer; locStr s.["Maintain Group Members"] ] + a [ _href "/web/small-group/announcement" ] [ icon "send"; menuSpacer; locStr s.["Send Announcement"] ] + a [ _href "/web/small-group/preferences" ] [ icon "build"; menuSpacer; locStr s.["Change Preferences"] ] ] ] match u.isAdmin with @@ -45,9 +45,9 @@ module Navigation = a [ _class "dropbtn"; _role "button"; _aria "label" s.["Administration"].Value; _title s.["Administration"].Value ] [ icon "settings"; space; locStr s.["Administration"]; space; icon "keyboard_arrow_down" ] div [ _class "dropdown-content"; _role "menu" ] [ - a [ _href "/churches" ] [ icon "home"; menuSpacer; locStr s.["Churches"] ] - a [ _href "/small-groups" ] [ icon "send"; menuSpacer; locStr s.["Groups"] ] - a [ _href "/users" ] [ icon "build"; menuSpacer; locStr s.["Users"] ] + a [ _href "/web/churches" ] [ icon "home"; menuSpacer; locStr s.["Churches"] ] + a [ _href "/web/small-groups" ] [ icon "send"; menuSpacer; locStr s.["Groups"] ] + a [ _href "/web/users" ] [ icon "build"; menuSpacer; locStr s.["Users"] ] ] ] | false -> () @@ -55,7 +55,7 @@ module Navigation = match m.group with | Some _ -> yield li [] [ - a [ _href "/prayer-requests/view" + a [ _href "/web/prayer-requests/view" _aria "label" s.["View Request List"].Value _title s.["View Request List"].Value ] [ icon "list"; space; locStr s.["View Request List"] ] @@ -65,12 +65,12 @@ module Navigation = a [ _class "dropbtn"; _role "button"; _aria "label" s.["Log On"].Value; _title s.["Log On"].Value ] [ icon "security"; space; locStr s.["Log On"]; space; icon "keyboard_arrow_down" ] div [ _class "dropdown-content"; _role "menu" ] [ - a [ _href "/user/log-on" ] [ icon "person"; menuSpacer; locStr s.["User"] ] - a [ _href "/small-group/log-on" ] [ icon "group"; menuSpacer; locStr s.["Group"] ] + a [ _href "/web/user/log-on" ] [ icon "person"; menuSpacer; locStr s.["User"] ] + a [ _href "/web/small-group/log-on" ] [ icon "group"; menuSpacer; locStr s.["Group"] ] ] ] yield li [] [ - a [ _href "/prayer-requests/lists" + a [ _href "/web/prayer-requests/lists" _aria "label" s.["View Request List"].Value _title s.["View Request List"].Value ] [ icon "list"; space; locStr s.["View Request List"] ] @@ -90,14 +90,14 @@ module Navigation = [ match m.user with | Some _ -> yield li [] [ - a [ _href "/user/password" + a [ _href "/web/user/password" _aria "label" s.["Change Your Password"].Value _title s.["Change Your Password"].Value ] [ icon "lock"; space; locStr s.["Change Your Password"] ] ] | None -> () yield li [] [ - a [ _href "/log-off"; _aria "label" s.["Log Off"].Value; _title s.["Log Off"].Value ] + a [ _href "/web/log-off"; _aria "label" s.["Log Off"].Value; _title s.["Log Off"].Value ] [ icon "power_settings_new"; space; locStr s.["Log Off"] ] ] ] @@ -105,7 +105,7 @@ module Navigation = header [ _class "pt-title-bar" ] [ section [ _class "pt-title-bar-left" ] [ span [ _class "pt-title-bar-home" ] [ - a [ _href "/"; _title s.["Home"].Value ] [ locStr s.["PrayerTracker"] ] + a [ _href "/web/"; _title s.["Home"].Value ] [ locStr s.["PrayerTracker"] ] ] ul [] leftLinks ] @@ -125,11 +125,11 @@ module Navigation = | "es" -> yield locStr s.["Spanish"] yield rawText "   •   " - yield a [ _href "/language/en" ] [ locStr s.["Change to English"] ] + yield a [ _href "/web/language/en" ] [ locStr s.["Change to English"] ] | _ -> yield locStr s.["English"] yield rawText "   •   " - yield a [ _href "/language/es" ] [ locStr s.["Cambie a Español"] ] + yield a [ _href "/web/language/es" ] [ locStr s.["Cambie a Español"] ] ] match m.group with | Some g -> @@ -146,7 +146,7 @@ module Navigation = yield icon "group" yield space match m.user with - | Some _ -> yield a [ _href "/small-group" ] [ strong [] [ str g.name ] ] + | Some _ -> yield a [ _href "/web/small-group" ] [ strong [] [ str g.name ] ] | None -> yield strong [] [ str g.name ] yield rawText "  " ] @@ -238,9 +238,9 @@ let private htmlFooter m = let resultTime = TimeSpan(DateTime.Now.Ticks - m.requestStart).TotalSeconds footer [] [ div [ _id "pt-legal" ] [ - a [ _href "/legal/privacy-policy" ] [ locStr s.["Privacy Policy"] ] + a [ _href "/web/legal/privacy-policy" ] [ locStr s.["Privacy Policy"] ] rawText " • " - a [ _href "/legal/terms-of-service" ] [ locStr s.["Terms of Service"] ] + a [ _href "/web/legal/terms-of-service" ] [ locStr s.["Terms of Service"] ] rawText " • " a [ _href "https://github.com/bit-badger/PrayerTracker" _title s.["View source code and get technical support"].Value @@ -250,7 +250,7 @@ let private htmlFooter m = ] ] div [ _id "pt-footer" ] [ - a [ _href "/"; _style "line-height:28px;" ] [ + a [ _href "/web/"; _style "line-height:28px;" ] [ img [ _src (sprintf "/img/%O.png" s.["footer_en"]); _alt imgText; _title imgText ] ] str m.version diff --git a/src/PrayerTracker.UI/PrayerRequest.fs b/src/PrayerTracker.UI/PrayerRequest.fs index 9e4ec15..9819331 100644 --- a/src/PrayerTracker.UI/PrayerRequest.fs +++ b/src/PrayerTracker.UI/PrayerRequest.fs @@ -15,7 +15,7 @@ open System.Text let edit (m : EditRequest) today ctx vi = let s = I18N.localizer.Force () let pageTitle = match m.isNew () with true -> "Add a New Request" | false -> "Edit Request" - [ form [ _action "/prayer-request/save"; _method "post"; _class "pt-center-columns" ] [ + [ form [ _action "/web/prayer-request/save"; _method "post"; _class "pt-center-columns" ] [ csrfToken ctx input [ _type "hidden"; _name "requestId"; _value (flatGuid m.requestId) ] div [ _class "pt-field-row" ] [ @@ -143,9 +143,9 @@ let lists (grps : SmallGroup list) vi = tr [] [ match grp.preferences.isPublic with | true -> - a [ _href (sprintf "/prayer-requests/%s/list" grpId); _title s.["View"].Value ] [ icon "list" ] + a [ _href (sprintf "/web/prayer-requests/%s/list" grpId); _title s.["View"].Value ] [ icon "list" ] | false -> - a [ _href (sprintf "/small-group/log-on/%s" grpId); _title s.["Log On"].Value ] + a [ _href (sprintf "/web/small-group/log-on/%s" grpId); _title s.["Log On"].Value ] [ icon "verified_user" ] |> List.singleton |> td [] @@ -180,7 +180,7 @@ let maintain m (ctx : HttpContext) vi = |> Seq.map (fun req -> let reqId = flatGuid req.prayerRequestId let reqText = Utils.htmlToPlainText req.text - let delAction = sprintf "/prayer-request/%s/delete" reqId + let delAction = sprintf "/web/prayer-request/%s/delete" reqId let delPrompt = [ s.["Are you sure you want to delete this {0}? This action cannot be undone.", s.["Prayer Request"].Value.ToLower() ] @@ -192,15 +192,15 @@ let maintain m (ctx : HttpContext) vi = |> String.concat "" tr [] [ td [] [ - yield a [ _href (sprintf "/prayer-request/%s/edit" reqId); _title l.["Edit This Prayer Request"].Value ] + yield a [ _href (sprintf "/web/prayer-request/%s/edit" reqId); _title l.["Edit This Prayer Request"].Value ] [ icon "edit" ] match req.isExpired now m.smallGroup.preferences.daysToExpire with | true -> - yield a [ _href (sprintf "/prayer-request/%s/restore" reqId) + yield a [ _href (sprintf "/web/prayer-request/%s/restore" reqId) _title l.["Restore This Inactive Request"].Value ] [ icon "visibility" ] | false -> - yield a [ _href (sprintf "/prayer-request/%s/expire" reqId) + yield a [ _href (sprintf "/web/prayer-request/%s/expire" reqId) _title l.["Expire This Request Immediately"].Value ] [ icon "visibility_off" ] yield a [ _href delAction; _title l.["Delete This Request"].Value; @@ -222,19 +222,19 @@ let maintain m (ctx : HttpContext) vi = |> List.ofSeq [ yield div [ _class "pt-center-text" ] [ yield br [] - yield a [ _href (sprintf "/prayer-request/%s/edit" emptyGuid); _title s.["Add a New Request"].Value ] + yield a [ _href (sprintf "/web/prayer-request/%s/edit" emptyGuid); _title s.["Add a New Request"].Value ] [ icon "add_circle"; rawText "  "; locStr s.["Add a New Request"] ] yield rawText "       " - yield a [ _href "/prayer-requests/view"; _title s.["View Prayer Request List"].Value ] + yield a [ _href "/web/prayer-requests/view"; _title s.["View Prayer Request List"].Value ] [ icon "list"; rawText "  "; locStr s.["View Prayer Request List"] ] match m.searchTerm with | Some _ -> yield rawText "       " - yield a [ _href "/prayer-requests"; _title l.["Clear Search Criteria"].Value ] + yield a [ _href "/web/prayer-requests"; _title l.["Clear Search Criteria"].Value ] [ icon "highlight_off"; rawText "  "; raw l.["Clear Search Criteria"] ] | None -> () ] - yield form [ _action "/prayer-requests"; _method "get"; _class "pt-center-text pt-search-form" ] [ + yield form [ _action "/web/prayer-requests"; _method "get"; _class "pt-center-text pt-search-form" ] [ input [ _type "text" _name "search" _placeholder l.["Search requests..."].Value @@ -266,18 +266,18 @@ let maintain m (ctx : HttpContext) vi = | Some true -> yield raw l.["Inactive requests are currently not shown"] yield br [] - yield a [ _href "/prayer-requests/inactive" ] [ raw l.["Show Inactive Requests"] ] + yield a [ _href "/web/prayer-requests/inactive" ] [ raw l.["Show Inactive Requests"] ] | _ -> match Option.isSome m.onlyActive with | true -> yield raw l.["Inactive requests are currently shown"] yield br [] - yield a [ _href "/prayer-requests" ] [ raw l.["Do Not Show Inactive Requests"] ] + yield a [ _href "/web/prayer-requests" ] [ raw l.["Do Not Show Inactive Requests"] ] yield br [] yield br [] | false -> () let srch = [ match m.searchTerm with Some s -> yield "search", s | None -> () ] - let url = match m.onlyActive with Some true | None -> "" | _ -> "/inactive" |> sprintf "/prayer-requests%s" + let url = match m.onlyActive with Some true | None -> "" | _ -> "/inactive" |> sprintf "/web/prayer-requests%s" let pg = defaultArg m.pageNbr 1 match pg with | 1 -> () @@ -329,7 +329,7 @@ let view m vi = [ div [ _class "pt-center-text" ] [ yield br [] yield a [ _class "pt-icon-link" - _href (sprintf "/prayer-requests/print/%s" dtString) + _href (sprintf "/web/prayer-requests/print/%s" dtString) _title s.["View Printable"].Value ] [ icon "print"; rawText "  "; locStr s.["View Printable"] ] @@ -345,20 +345,20 @@ let view m vi = | false -> findSunday (date.AddDays 1.) let sunday = findSunday m.date yield a [ _class "pt-icon-link" - _href (sprintf "/prayer-requests/view/%s" (sunday.ToString "yyyy-MM-dd")) + _href (sprintf "/web/prayer-requests/view/%s" (sunday.ToString "yyyy-MM-dd")) _title s.["List for Next Sunday"].Value ] [ icon "update"; rawText "  "; locStr s.["List for Next Sunday"] ] yield spacer let emailPrompt = s.["This will e-mail the current list to every member of your group, without further prompting. Are you sure this is what you are ready to do?"].Value yield a [ _class "pt-icon-link" - _href (sprintf "/prayer-requests/email/%s" dtString) + _href (sprintf "/web/prayer-requests/email/%s" dtString) _title s.["Send via E-mail"].Value _onclick (sprintf "return PT.requests.view.promptBeforeEmail('%s')" emailPrompt) ] [ icon "mail_outline"; rawText "  "; locStr s.["Send via E-mail"] ] yield spacer - yield a [ _class "pt-icon-link"; _href "/prayer-requests"; _title s.["Maintain Prayer Requests"].Value ] [ + yield a [ _class "pt-icon-link"; _href "/web/prayer-requests"; _title s.["Maintain Prayer Requests"].Value ] [ icon "compare_arrows"; rawText "  "; locStr s.["Maintain Prayer Requests"] ] | false -> () diff --git a/src/PrayerTracker.UI/SmallGroup.fs b/src/PrayerTracker.UI/SmallGroup.fs index 8e5235e..bc93446 100644 --- a/src/PrayerTracker.UI/SmallGroup.fs +++ b/src/PrayerTracker.UI/SmallGroup.fs @@ -11,7 +11,7 @@ open System.IO let announcement isAdmin ctx vi = let s = I18N.localizer.Force () let reqTypes = ReferenceList.requestTypeList s - [ form [ _action "/small-group/announcement/send"; _method "post"; _class "pt-center-columns" ] [ + [ form [ _action "/web/small-group/announcement/send"; _method "post"; _class "pt-center-columns" ] [ yield csrfToken ctx yield div [ _class "pt-field-row" ] [ div [ _class "pt-field pt-editor" ] [ @@ -75,7 +75,7 @@ let announcementSent (m : Announcement) vi = let edit (m : EditSmallGroup) (churches : Church list) ctx vi = let s = I18N.localizer.Force () let pageTitle = match m.isNew () with true -> "Add a New Group" | false -> "Edit Group" - form [ _action "/small-group/save"; _method "post"; _class "pt-center-columns" ] [ + form [ _action "/web/small-group/save"; _method "post"; _class "pt-center-columns" ] [ csrfToken ctx input [ _type "hidden"; _name "smallGroupId"; _value (flatGuid m.smallGroupId) ] div [ _class "pt-field-row" ] [ @@ -105,7 +105,7 @@ let edit (m : EditSmallGroup) (churches : Church list) ctx vi = let editMember (m : EditMember) (typs : (string * LocalizedString) seq) ctx vi = let s = I18N.localizer.Force () let pageTitle = match m.isNew () with true -> "Add a New Group Member" | false -> "Edit Group Member" - form [ _action "/small-group/member/save"; _method "post"; _class "pt-center-columns" ] [ + form [ _action "/web/small-group/member/save"; _method "post"; _class "pt-center-columns" ] [ style [ _scoped ] [ rawText "#memberName { width: 15rem; } #emailAddress { width: 20rem; }" ] csrfToken ctx input [ _type "hidden"; _name "memberId"; _value (flatGuid m.memberId) ] @@ -137,7 +137,7 @@ let editMember (m : EditMember) (typs : (string * LocalizedString) seq) ctx vi = /// View for the small group log on page let logOn (grps : SmallGroup list) grpId ctx vi = let s = I18N.localizer.Force () - [ form [ _action "/small-group/log-on/submit"; _method "post"; _class "pt-center-columns" ] [ + [ form [ _action "/web/small-group/log-on/submit"; _method "post"; _class "pt-center-columns" ] [ csrfToken ctx div [ _class "pt-field-row" ] [ div [ _class "pt-field" ] [ @@ -191,12 +191,12 @@ let maintain (grps : SmallGroup list) ctx vi = grps |> List.map (fun g -> let grpId = flatGuid g.smallGroupId - let delAction = sprintf "/small-group/%s/delete" grpId + let delAction = sprintf "/web/small-group/%s/delete" grpId let delPrompt = s.["Are you sure you want to delete this {0}? This action cannot be undone.", sprintf "%s (%s)" (s.["Small Group"].Value.ToLower ()) g.name].Value tr [] [ td [] [ - a [ _href (sprintf "/small-group/%s/edit" grpId); _title s.["Edit This Group"].Value ] [ icon "edit" ] + a [ _href (sprintf "/web/small-group/%s/edit" grpId); _title s.["Edit This Group"].Value ] [ icon "edit" ] a [ _href delAction _title s.["Delete This Group"].Value _onclick (sprintf "return PT.confirmDelete('%s','%s')" delAction delPrompt) ] @@ -210,7 +210,7 @@ let maintain (grps : SmallGroup list) ctx vi = ] [ div [ _class "pt-center-text" ] [ br [] - a [ _href (sprintf "/small-group/%s/edit" emptyGuid); _title s.["Add a New Group"].Value ] [ + a [ _href (sprintf "/web/small-group/%s/edit" emptyGuid); _title s.["Add a New Group"].Value ] [ icon "add_circle" rawText "  " locStr s.["Add a New Group"] @@ -245,14 +245,14 @@ let members (mbrs : Member list) (emailTyps : Map) ctx mbrs |> List.map (fun mbr -> let mbrId = flatGuid mbr.memberId - let delAction = sprintf "/small-group/member/%s/delete" mbrId + let delAction = sprintf "/web/small-group/member/%s/delete" mbrId let delPrompt = s.["Are you sure you want to delete this {0}? This action cannot be undone.", s.["group member"]] .Value .Replace("?", sprintf " (%s)?" mbr.memberName) tr [] [ td [] [ - a [ _href (sprintf "/small-group/member/%s/edit" mbrId); _title s.["Edit This Group Member"].Value ] + a [ _href (sprintf "/web/small-group/member/%s/edit" mbrId); _title s.["Edit This Group Member"].Value ] [ icon "edit" ] a [ _href delAction _title s.["Delete This Group Member"].Value @@ -267,7 +267,7 @@ let members (mbrs : Member list) (emailTyps : Map) ctx ] [ div [ _class"pt-center-text" ] [ br [] - a [ _href (sprintf "/small-group/member/%s/edit" emptyGuid); _title s.["Add a New Group Member"].Value ] + a [ _href (sprintf "/web/small-group/member/%s/edit" emptyGuid); _title s.["Add a New Group Member"].Value ] [ icon "add_circle"; rawText "  "; locStr s.["Add a New Group Member"] ] br [] br [] @@ -292,11 +292,11 @@ let overview m vi = locStr s.["Quick Actions"] ] div [] [ - a [ _href "/prayer-requests/view" ] [ icon "list"; linkSpacer; locStr s.["View Prayer Request List"] ] + a [ _href "/web/prayer-requests/view" ] [ icon "list"; linkSpacer; locStr s.["View Prayer Request List"] ] hr [] - a [ _href "/small-group/announcement" ] [ icon "send"; linkSpacer; locStr s.["Send Announcement"] ] + a [ _href "/web/small-group/announcement" ] [ icon "send"; linkSpacer; locStr s.["Send Announcement"] ] hr [] - a [ _href "/small-group/preferences" ] [ icon "build"; linkSpacer; locStr s.["Change Preferences"] ] + a [ _href "/web/small-group/preferences" ] [ icon "build"; linkSpacer; locStr s.["Change Preferences"] ] ] ] section [] [ @@ -319,7 +319,7 @@ let overview m vi = yield space yield locStr s.["Total Requests"] yield hr [] - yield a [ _href "/prayer-requests/maintain" ] [ + yield a [ _href "/web/prayer-requests/maintain" ] [ icon "compare_arrows" linkSpacer locStr s.["Maintain Prayer Requests"] @@ -334,7 +334,7 @@ let overview m vi = div [ _class "pt-center-text" ] [ strong [] [ str (m.totalMbrs.ToString "N0"); space; locStr s.["Members"] ] hr [] - a [ _href "/small-group/members" ] [ icon "email"; linkSpacer; locStr s.["Maintain Group Members"] ] + a [ _href "/web/small-group/members" ] [ icon "email"; linkSpacer; locStr s.["Maintain Group Members"] ] ] ] ] @@ -349,7 +349,7 @@ let preferences (m : EditPreferences) (tzs : TimeZone list) ctx vi = let l = I18N.forView "SmallGroup/Preferences" use sw = new StringWriter () let raw = rawLocText sw - [ form [ _action "/small-group/preferences/save"; _method "post"; _class "pt-center-columns" ] [ + [ form [ _action "/web/small-group/preferences/save"; _method "post"; _class "pt-center-columns" ] [ style [ _scoped ] [ rawText "#expireDays, #daysToKeepNew, #longTermUpdateWeeks, #headingFontSize, #listFontSize, #pageSize { width: 3rem; } #emailFromAddress { width: 20rem; } #listFonts { width: 40rem; } @media screen and (max-width: 40rem) { #listFonts { width: 100%; } }" ] csrfToken ctx fieldset [] [ diff --git a/src/PrayerTracker.UI/User.fs b/src/PrayerTracker.UI/User.fs index b6527f8..2662213 100644 --- a/src/PrayerTracker.UI/User.fs +++ b/src/PrayerTracker.UI/User.fs @@ -8,7 +8,7 @@ open PrayerTracker.ViewModels let assignGroups m groups curGroups ctx vi = let s = I18N.localizer.Force () let pageTitle = sprintf "%s • %A" m.userName s.["Assign Groups"] - form [ _action "/user/small-groups/save"; _method "post"; _class "pt-center-columns" ] [ + form [ _action "/web/user/small-groups/save"; _method "post"; _class "pt-center-columns" ] [ csrfToken ctx input [ _type "hidden"; _name "userId"; _value (flatGuid m.userId) ] input [ _type "hidden"; _name "userName"; _value m.userName ] @@ -47,7 +47,7 @@ let changePassword ctx vi = [ p [ _class "pt-center-text" ] [ locStr s.["To change your password, enter your current password in the specified box below, then enter your new password twice."] ] - form [ _action "/user/password/change" + form [ _action "/web/user/password/change" _method "post" _onsubmit (sprintf "return PT.compareValidation('newPassword','newPasswordConfirm','%A')" s.["The passwords do not match"]) ] [ style [ _scoped ] [ rawText "#oldPassword, #newPassword, #newPasswordConfirm { width: 10rem; } "] @@ -83,7 +83,7 @@ let edit (m : EditUser) ctx vi = let s = I18N.localizer.Force () let pageTitle = match m.isNew () with true -> "Add a New User" | false -> "Edit User" let pwPlaceholder = s.[match m.isNew () with true -> "" | false -> "No change"].Value - [ form [ _action "/user/edit/save"; _method "post"; _class "pt-center-columns" + [ form [ _action "/web/user/edit/save"; _method "post"; _class "pt-center-columns" _onsubmit (sprintf "return PT.compareValidation('password','passwordConfirm','%A')" s.["The passwords do not match"]) ] [ style [ _scoped ] [ rawText "#firstName, #lastName, #password, #passwordConfirm { width: 10rem; } #emailAddress { width: 20rem; } " ] @@ -132,7 +132,7 @@ let edit (m : EditUser) ctx vi = /// View for the user log on page let logOn (m : UserLogOn) groups ctx vi = let s = I18N.localizer.Force () - form [ _action "/user/log-on"; _method "post"; _class "pt-center-columns" ] [ + form [ _action "/web/user/log-on"; _method "post"; _class "pt-center-columns" ] [ style [ _scoped ] [ rawText "#emailAddress { width: 20rem; }" ] csrfToken ctx input [ _type "hidden"; _name "redirectUrl"; _value (defaultArg m.redirectUrl "") ] @@ -189,13 +189,13 @@ let maintain (users : User list) ctx vi = users |> List.map (fun user -> let userId = flatGuid user.userId - let delAction = sprintf "/user/%s/delete" userId + let delAction = sprintf "/web/user/%s/delete" userId let delPrompt = s.["Are you sure you want to delete this {0}? This action cannot be undone.", (sprintf "%s (%s)" (s.["User"].Value.ToLower()) user.fullName)].Value tr [] [ td [] [ - a [ _href (sprintf "/user/%s/edit" userId); _title s.["Edit This User"].Value ] [ icon "edit" ] - a [ _href (sprintf "/user/%s/small-groups" userId); _title s.["Assign Groups to This User"].Value ] + a [ _href (sprintf "/web/user/%s/edit" userId); _title s.["Edit This User"].Value ] [ icon "edit" ] + a [ _href (sprintf "/web/user/%s/small-groups" userId); _title s.["Assign Groups to This User"].Value ] [ icon "group" ] a [ _href delAction _title s.["Delete This User"].Value @@ -213,7 +213,7 @@ let maintain (users : User list) ctx vi = ] [ div [ _class "pt-center-text" ] [ br [] - a [ _href (sprintf "/user/%s/edit" emptyGuid); _title s.["Add a New User"].Value ] + a [ _href (sprintf "/web/user/%s/edit" emptyGuid); _title s.["Add a New User"].Value ] [ icon "add_circle"; rawText "  "; locStr s.["Add a New User"] ] br [] br [] diff --git a/src/PrayerTracker/App.fs b/src/PrayerTracker/App.fs index ffb5937..8ccc1fe 100644 --- a/src/PrayerTracker/App.fs +++ b/src/PrayerTracker/App.fs @@ -62,19 +62,19 @@ module Configure = let webApp = router Handlers.CommonFunctions.fourOhFour [ GET [ - subRoute "/church" [ + subRoute "/web/church" [ route "es" Handlers.Church.maintain routef "/%O/edit" Handlers.Church.edit ] - route "/class/logon" (redirectTo true "/small-group/log-on") - routef "/error/%s" Handlers.Home.error - routef "/language/%s" Handlers.Home.language - subRoute "/legal" [ + route "/web/class/logon" (redirectTo true "/small-group/log-on") + routef "/web/error/%s" Handlers.Home.error + routef "/web/language/%s" Handlers.Home.language + subRoute "/web/legal" [ route "/privacy-policy" Handlers.Home.privacyPolicy route "/terms-of-service" Handlers.Home.tos ] - route "/log-off" Handlers.Home.logOff - subRoute "/prayer-request" [ + route "/web/log-off" Handlers.Home.logOff + subRoute "/web/prayer-request" [ route "s" (Handlers.PrayerRequest.maintain true) routef "s/email/%s" Handlers.PrayerRequest.email route "s/inactive" (Handlers.PrayerRequest.maintain false) @@ -88,7 +88,7 @@ module Configure = routef "/%O/expire" Handlers.PrayerRequest.expire routef "/%O/restore" Handlers.PrayerRequest.restore ] - subRoute "/small-group" [ + subRoute "/web/small-group" [ route "" Handlers.SmallGroup.overview route "s" Handlers.SmallGroup.maintain route "/announcement" Handlers.SmallGroup.announcement @@ -100,8 +100,8 @@ module Configure = route "/members" Handlers.SmallGroup.members route "/preferences" Handlers.SmallGroup.preferences ] - route "/unauthorized" Handlers.Home.unauthorized - subRoute "/user" [ + route "/web/unauthorized" Handlers.Home.unauthorized + subRoute "/web/user" [ route "s" Handlers.User.maintain routef "/%O/edit" Handlers.User.edit routef "/%O/small-groups" Handlers.User.smallGroups @@ -109,18 +109,19 @@ module Configure = route "/logon" (redirectTo true "/user/log-on") route "/password" Handlers.User.password ] - route "/" Handlers.Home.homePage + route "/web/" Handlers.Home.homePage + route "/" (redirectTo true "/web/") ] POST [ - subRoute "/church" [ + subRoute "/web/church" [ routef "/%O/delete" Handlers.Church.delete route "/save" Handlers.Church.save ] - subRoute "/prayer-request" [ + subRoute "/web/prayer-request" [ routef "/%O/delete" Handlers.PrayerRequest.delete route "/save" Handlers.PrayerRequest.save ] - subRoute "/small-group" [ + subRoute "/web/small-group" [ route "/announcement/send" Handlers.SmallGroup.sendAnnouncement routef "/%O/delete" Handlers.SmallGroup.delete route "/log-on/submit" Handlers.SmallGroup.logOnSubmit @@ -129,7 +130,7 @@ module Configure = route "/preferences/save" Handlers.SmallGroup.savePreferences route "/save" Handlers.SmallGroup.save ] - subRoute "/user" [ + subRoute "/web/user" [ routef "/%O/delete" Handlers.User.delete route "/edit/save" Handlers.User.save route "/log-on" Handlers.User.doLogOn diff --git a/src/PrayerTracker/Church.fs b/src/PrayerTracker/Church.fs index 55520c3..c18fc32 100644 --- a/src/PrayerTracker/Church.fs +++ b/src/PrayerTracker/Church.fs @@ -36,7 +36,7 @@ let delete churchId : HttpHandler = addInfo ctx s.["The church {0} and its {1} small groups (with {2} prayer request(s)) were deleted successfully; revoked access from {3} user(s)", ch.name, stats.smallGroups, stats.prayerRequests, stats.users] - return! redirectTo false "/churches" next ctx + return! redirectTo false "/web/churches" next ctx | None -> return! fourOhFour next ctx } @@ -108,7 +108,7 @@ let save : HttpHandler = let s = Views.I18N.localizer.Force () let act = s.[match m.isNew () with true -> "Added" | _ -> "Updated"].Value.ToLower () addInfo ctx s.["Successfully {0} church “{1}”", act, m.name] - return! redirectTo false "/churches" next ctx + return! redirectTo false "/web/churches" next ctx | None -> return! fourOhFour next ctx | Error e -> return! bindError e next ctx } diff --git a/src/PrayerTracker/CommonFunctions.fs b/src/PrayerTracker/CommonFunctions.fs index 9ff8460..52b1fbf 100644 --- a/src/PrayerTracker/CommonFunctions.fs +++ b/src/PrayerTracker/CommonFunctions.fs @@ -256,17 +256,17 @@ let requireAccess level : HttpHandler = | false -> let s = Views.I18N.localizer.Force () addError ctx s.["You are not authorized to view the requested page."] - return! redirectTo false "/unauthorized" next ctx + return! redirectTo false "/web/unauthorized" next ctx | _ when level |> List.contains User -> // Redirect to the user log on page ctx.Session.SetString (Key.Session.redirectUrl, ctx.Request.GetEncodedUrl ()) - return! redirectTo false "/user/log-on" next ctx + return! redirectTo false "/web/user/log-on" next ctx | _ when level |> List.contains Group -> // Redirect to the small group log on page ctx.Session.SetString (Key.Session.redirectUrl, ctx.Request.GetEncodedUrl ()) - return! redirectTo false "/small-group/log-on" next ctx + return! redirectTo false "/web/small-group/log-on" next ctx | _ -> let s = Views.I18N.localizer.Force () addError ctx s.["You are not authorized to view the requested page."] - return! redirectTo false "/unauthorized" next ctx + return! redirectTo false "/web/unauthorized" next ctx } diff --git a/src/PrayerTracker/Home.fs b/src/PrayerTracker/Home.fs index 0becb22..804f199 100644 --- a/src/PrayerTracker/Home.fs +++ b/src/PrayerTracker/Home.fs @@ -47,7 +47,7 @@ let language culture : HttpHandler = CookieRequestCultureProvider.MakeCookieValue (RequestCulture c), CookieOptions (Expires = Nullable (DateTimeOffset (DateTime.Now.AddYears 1)))) | _ -> () - let url = match string ctx.Request.Headers.["Referer"] with null | "" -> "/" | r -> r + let url = match string ctx.Request.Headers.["Referer"] with null | "" -> "/web/" | r -> r redirectTo false url next ctx @@ -78,7 +78,7 @@ let logOff : HttpHandler = Key.Cookie.logOffCookies |> List.iter ctx.Response.Cookies.Delete let s = Views.I18N.localizer.Force () addHtmlInfo ctx s.["Log Off Successful • Have a nice day!"] - redirectTo false "/" next ctx + redirectTo false "/web/" next ctx /// GET /unauthorized diff --git a/src/PrayerTracker/PrayerRequest.fs b/src/PrayerTracker/PrayerRequest.fs index af7fe2f..ec0ba5c 100644 --- a/src/PrayerTracker/PrayerRequest.fs +++ b/src/PrayerTracker/PrayerRequest.fs @@ -19,7 +19,7 @@ let private findRequest (ctx : HttpContext) reqId = | Some _ -> let s = Views.I18N.localizer.Force () addError ctx s.["The prayer request you tried to access is not assigned to your group"] - return Error (redirectTo false "/unauthorized") + return Error (redirectTo false "/web/unauthorized") | None -> return Error fourOhFour } @@ -121,7 +121,7 @@ let delete reqId : HttpHandler = db.PrayerRequests.Remove r |> ignore let! _ = db.SaveChangesAsync () addInfo ctx s.["The prayer request was deleted successfully"] - return! redirectTo false "/prayer-requests" next ctx + return! redirectTo false "/web/prayer-requests" next ctx | Error e -> return! e next ctx } @@ -139,7 +139,7 @@ let expire reqId : HttpHandler = db.UpdateEntry { r with expiration = Forced } let! _ = db.SaveChangesAsync () addInfo ctx s.["Successfully {0} prayer request", s.["Expired"].Value.ToLower ()] - return! redirectTo false "/prayer-requests" next ctx + return! redirectTo false "/web/prayer-requests" next ctx | Error e -> return! e next ctx } @@ -170,7 +170,7 @@ let list groupId : HttpHandler = | Some _ -> let s = Views.I18N.localizer.Force () addError ctx s.["The request list for the group you tried to view is not public."] - return! redirectTo false "/unauthorized" next ctx + return! redirectTo false "/web/unauthorized" next ctx | None -> return! fourOhFour next ctx } @@ -250,7 +250,7 @@ let restore reqId : HttpHandler = db.UpdateEntry { r with expiration = Automatic; updatedDate = DateTime.Now } let! _ = db.SaveChangesAsync () addInfo ctx s.["Successfully {0} prayer request", s.["Restored"].Value.ToLower ()] - return! redirectTo false "/prayer-requests" next ctx + return! redirectTo false "/web/prayer-requests" next ctx | Error e -> return! e next ctx } @@ -295,7 +295,7 @@ let save : HttpHandler = let s = Views.I18N.localizer.Force () let act = match m.isNew () with true -> "Added" | false -> "Updated" addInfo ctx s.["Successfully {0} prayer request", s.[act].Value.ToLower ()] - return! redirectTo false "/prayer-requests" next ctx + return! redirectTo false "/web/prayer-requests" next ctx | None -> return! fourOhFour next ctx | Error e -> return! bindError e next ctx } diff --git a/src/PrayerTracker/SmallGroup.fs b/src/PrayerTracker/SmallGroup.fs index 2384f48..5663bc2 100644 --- a/src/PrayerTracker/SmallGroup.fs +++ b/src/PrayerTracker/SmallGroup.fs @@ -47,7 +47,7 @@ let delete groupId : HttpHandler = addInfo ctx s.["The group {0} and its {1} prayer request(s) were deleted successfully; revoked access from {2} user(s)", g.name, reqs, usrs] - return! redirectTo false "/small-groups" next ctx + return! redirectTo false "/web/small-groups" next ctx | None -> return! fourOhFour next ctx } @@ -66,7 +66,7 @@ let deleteMember memberId : HttpHandler = db.RemoveEntry m let! _ = db.SaveChangesAsync () addHtmlInfo ctx s.["The group member “{0}” was deleted successfully", m.memberName] - return! redirectTo false "/small-group/members" next ctx + return! redirectTo false "/web/small-group/members" next ctx | Some _ | None -> return! fourOhFour next ctx } @@ -160,10 +160,10 @@ let logOnSubmit : HttpHandler = | Some x when x -> (setGroupCookie ctx << Utils.sha1Hash) m.password | _ -> () addInfo ctx s.["Log On Successful • Welcome to {0}", s.["PrayerTracker"]] - return! redirectTo false "/prayer-requests/view" next ctx + return! redirectTo false "/web/prayer-requests/view" next ctx | None -> addError ctx s.["Password incorrect - login unsuccessful"] - return! redirectTo false (sprintf "/small-group/log-on/%s" (flatGuid m.smallGroupId)) next ctx + return! redirectTo false (sprintf "/web/small-group/log-on/%s" (flatGuid m.smallGroupId)) next ctx | Error e -> return! bindError e next ctx } @@ -270,7 +270,7 @@ let save : HttpHandler = let! _ = db.SaveChangesAsync () let act = s.[match m.isNew () with true -> "Added" | false -> "Updated"].Value.ToLower () addHtmlInfo ctx s.["Successfully {0} group “{1}”", act, m.name] - return! redirectTo false "/small-groups" next ctx + return! redirectTo false "/web/small-groups" next ctx | None -> return! fourOhFour next ctx | Error e -> return! bindError e next ctx } @@ -309,7 +309,7 @@ let saveMember : HttpHandler = let s = Views.I18N.localizer.Force () let act = s.[match m.isNew () with true -> "Added" | false -> "Updated"].Value.ToLower () addInfo ctx s.["Successfully {0} group member", act] - return! redirectTo false "/small-group/members" next ctx + return! redirectTo false "/web/small-group/members" next ctx | Some _ | None -> return! fourOhFour next ctx | Error e -> return! bindError e next ctx @@ -339,7 +339,7 @@ let savePreferences : HttpHandler = ctx.Session.SetSmallGroup <| Some { g with preferences = prefs } let s = Views.I18N.localizer.Force () addInfo ctx s.["Group preferences updated successfully"] - return! redirectTo false "/small-group/preferences" next ctx + return! redirectTo false "/web/small-group/preferences" next ctx | None -> return! fourOhFour next ctx | Error e -> return! bindError e next ctx } diff --git a/src/PrayerTracker/User.fs b/src/PrayerTracker/User.fs index f1bec2d..cb1bd9a 100644 --- a/src/PrayerTracker/User.fs +++ b/src/PrayerTracker/User.fs @@ -84,13 +84,13 @@ let changePassword : HttpHandler = | _ -> () addInfo ctx s.["Your password was changed successfully"] | None -> addError ctx s.["Unable to change password"] - return! redirectTo false "/" next ctx + return! redirectTo false "/web/" next ctx | Some _ -> addError ctx s.["The new passwords did not match - your password was NOT changed"] - return! redirectTo false "/user/password" next ctx + return! redirectTo false "/web/user/password" next ctx | None -> addError ctx s.["The old password was incorrect - your password was NOT changed"] - return! redirectTo false "/user/password" next ctx + return! redirectTo false "/web/user/password" next ctx | Error e -> return! bindError e next ctx } @@ -109,7 +109,7 @@ let delete userId : HttpHandler = let! _ = db.SaveChangesAsync () let s = Views.I18N.localizer.Force () addInfo ctx s.["Successfully deleted user {0}", u.fullName] - return! redirectTo false "/users" next ctx + return! redirectTo false "/web/users" next ctx | _ -> return! fourOhFour next ctx } @@ -135,8 +135,8 @@ let doLogOn : HttpHandler = match m.rememberMe with Some x when x -> setUserCookie ctx pwHash | _ -> () addHtmlInfo ctx s.["Log On Successful • Welcome to {0}", s.["PrayerTracker"]] match m.redirectUrl with - | None -> "/small-group" - | Some x when x = "" -> "/small-group" + | None -> "/web/small-group" + | Some x when x = "" -> "/web/small-group" | Some x -> x | _ -> let grpName = match grp with Some g -> g.name | _ -> "N/A" @@ -156,7 +156,7 @@ let doLogOn : HttpHandler = |> (HtmlString >> Some) } |> addUserMessage ctx - "/user/log-on" + "/web/user/log-on" return! redirectTo false nextUrl next ctx | Error e -> return! bindError e next ctx } @@ -271,10 +271,10 @@ let save : HttpHandler = |> Some } |> addUserMessage ctx - return! redirectTo false (sprintf "/user/%s/small-groups" (flatGuid u.userId)) next ctx + return! redirectTo false (sprintf "/web/user/%s/small-groups" (flatGuid u.userId)) next ctx | false -> addInfo ctx s.["Successfully {0} user", s.["Updated"].Value.ToLower ()] - return! redirectTo false "/users" next ctx + return! redirectTo false "/web/users" next ctx | None -> return! fourOhFour next ctx | Error e -> return! bindError e next ctx } @@ -293,7 +293,7 @@ let saveGroups : HttpHandler = match Seq.length m.smallGroups with | 0 -> addError ctx s.["You must select at least one group to assign"] - return! redirectTo false (sprintf "/user/%s/small-groups" (flatGuid m.userId)) next ctx + return! redirectTo false (sprintf "/web/user/%s/small-groups" (flatGuid m.userId)) next ctx | _ -> let db = ctx.dbContext () let! user = db.TryUserByIdWithGroups m.userId @@ -314,7 +314,7 @@ let saveGroups : HttpHandler = |> List.iter db.AddEntry let! _ = db.SaveChangesAsync () addInfo ctx s.["Successfully updated group permissions for {0}", m.userName] - return! redirectTo false "/users" next ctx + return! redirectTo false "/web/users" next ctx | _ -> return! fourOhFour next ctx | Error e -> return! bindError e next ctx }