Don't show headings for empty tables (#6)

This commit is contained in:
Daniel J. Summers 2019-03-14 22:59:07 -05:00
parent d80c5eb4ed
commit 05985189e7
4 changed files with 169 additions and 146 deletions

View File

@ -55,14 +55,10 @@ let edit (m : EditChurch) ctx vi =
/// View for church maintenance page /// View for church maintenance page
let maintain (churches : Church list) (stats : Map<string, ChurchStats>) ctx vi = let maintain (churches : Church list) (stats : Map<string, ChurchStats>) ctx vi =
let s = I18N.localizer.Force () let s = I18N.localizer.Force ()
[ div [ _class "pt-center-text" ] [ let chTbl =
br [] match churches with
a [ _href (sprintf "/church/%s/edit" emptyGuid); _title s.["Add a New Church"].Value ] | [] -> space
[ icon "add_circle"; rawText " &nbsp;"; encLocText s.["Add a New Church"] ] | _ ->
br []
br []
]
tableSummary churches.Length s
table [ _class "pt-table pt-action-table" ] [ table [ _class "pt-table pt-action-table" ] [
thead [] [ thead [] [
tr [] [ tr [] [
@ -98,6 +94,15 @@ let maintain (churches : Church list) (stats : Map<string, ChurchStats>) ctx vi
]) ])
|> tbody [] |> tbody []
] ]
[ div [ _class "pt-center-text" ] [
br []
a [ _href (sprintf "/church/%s/edit" emptyGuid); _title s.["Add a New Church"].Value ]
[ icon "add_circle"; rawText " &nbsp;"; encLocText s.["Add a New Church"] ]
br []
br []
]
tableSummary churches.Length s
chTbl
form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ] form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ]
] ]
|> Layout.Content.wide |> Layout.Content.wide

View File

@ -210,7 +210,7 @@ let maintain (reqs : PrayerRequest seq) (grp : SmallGroup) onlyActive (ctx : Htt
] ]
]) ])
|> List.ofSeq |> List.ofSeq
[ div [ _class "pt-center-text" ] [ [ yield div [ _class "pt-center-text" ] [
br [] br []
a [ _href (sprintf "/prayer-request/%s/edit" emptyGuid); _title s.["Add a New Request"].Value ] a [ _href (sprintf "/prayer-request/%s/edit" emptyGuid); _title s.["Add a New Request"].Value ]
[ icon "add_circle"; rawText " &nbsp;"; encLocText s.["Add a New Request"] ] [ icon "add_circle"; rawText " &nbsp;"; encLocText s.["Add a New Request"] ]
@ -220,8 +220,11 @@ let maintain (reqs : PrayerRequest seq) (grp : SmallGroup) onlyActive (ctx : Htt
br [] br []
br [] br []
] ]
tableSummary requests.Length s yield tableSummary requests.Length s
table [ _class "pt-table pt-action-table" ] [ match requests.Length with
| 0 -> ()
| _ ->
yield table [ _class "pt-table pt-action-table" ] [
thead [] [ thead [] [
tr [] [ tr [] [
th [] [ encLocText s.["Actions"] ] th [] [ encLocText s.["Actions"] ]
@ -233,7 +236,7 @@ let maintain (reqs : PrayerRequest seq) (grp : SmallGroup) onlyActive (ctx : Htt
] ]
tbody [] requests tbody [] requests
] ]
div [ _class "pt-center-text" ] [ yield div [ _class "pt-center-text" ] [
yield br [] yield br []
match onlyActive with match onlyActive with
| true -> | true ->
@ -245,7 +248,7 @@ let maintain (reqs : PrayerRequest seq) (grp : SmallGroup) onlyActive (ctx : Htt
yield br [] yield br []
yield a [ _href "/prayer-requests" ] [ encLocText s.["Do Not Show Inactive Requests"] ] yield a [ _href "/prayer-requests" ] [ encLocText s.["Do Not Show Inactive Requests"] ]
] ]
form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ] yield form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ]
] ]
|> Layout.Content.wide |> Layout.Content.wide
|> Layout.standard vi "Maintain Requests" |> Layout.standard vi "Maintain Requests"

View File

@ -175,17 +175,10 @@ let logOn (grps : SmallGroup list) grpId ctx vi =
/// View for the small group maintenance page /// View for the small group maintenance page
let maintain (grps : SmallGroup list) ctx vi = let maintain (grps : SmallGroup list) ctx vi =
let s = I18N.localizer.Force () let s = I18N.localizer.Force ()
[ div [ _class "pt-center-text" ] [ let grpTbl =
br [] match grps with
a [ _href (sprintf "/small-group/%s/edit" emptyGuid); _title s.["Add a New Group"].Value ] [ | [] -> space
icon "add_circle" | _ ->
rawText " &nbsp;"
encLocText s.["Add a New Group"]
]
br []
br []
]
tableSummary grps.Length s
table [ _class "pt-table pt-action-table" ] [ table [ _class "pt-table pt-action-table" ] [
thead [] [ thead [] [
tr [] [ tr [] [
@ -215,6 +208,18 @@ let maintain (grps : SmallGroup list) ctx vi =
]) ])
|> tbody [] |> tbody []
] ]
[ div [ _class "pt-center-text" ] [
br []
a [ _href (sprintf "/small-group/%s/edit" emptyGuid); _title s.["Add a New Group"].Value ] [
icon "add_circle"
rawText " &nbsp;"
encLocText s.["Add a New Group"]
]
br []
br []
]
tableSummary grps.Length s
grpTbl
form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ] form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ]
] ]
|> Layout.Content.standard |> Layout.Content.standard
@ -224,14 +229,10 @@ let maintain (grps : SmallGroup list) ctx vi =
/// View for the member maintenance page /// View for the member maintenance page
let members (mbrs : Member list) (emailTyps : Map<string, LocalizedString>) ctx vi = let members (mbrs : Member list) (emailTyps : Map<string, LocalizedString>) ctx vi =
let s = I18N.localizer.Force () let s = I18N.localizer.Force ()
[ div [ _class"pt-center-text" ] [ let mbrTbl =
br [] match mbrs with
a [ _href (sprintf "/small-group/member/%s/edit" emptyGuid); _title s.["Add a New Group Member"].Value ] | [] -> space
[ icon "add_circle"; rawText " &nbsp;"; encLocText s.["Add a New Group Member"] ] | _ ->
br []
br []
]
tableSummary mbrs.Length s
table [ _class "pt-table pt-action-table" ] [ table [ _class "pt-table pt-action-table" ] [
thead [] [ thead [] [
tr [] [ tr [] [
@ -262,6 +263,15 @@ let members (mbrs : Member list) (emailTyps : Map<string, LocalizedString>) ctx
]) ])
|> tbody [] |> tbody []
] ]
[ div [ _class"pt-center-text" ] [
br []
a [ _href (sprintf "/small-group/member/%s/edit" emptyGuid); _title s.["Add a New Group Member"].Value ]
[ icon "add_circle"; rawText " &nbsp;"; encLocText s.["Add a New Group Member"] ]
br []
br []
]
tableSummary mbrs.Length s
mbrTbl
form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ] form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ]
] ]
|> Layout.Content.standard |> Layout.Content.standard

View File

@ -174,14 +174,10 @@ let logOn (m : UserLogOn) groups ctx vi =
/// View for the user maintenance page /// View for the user maintenance page
let maintain (users : User list) ctx vi = let maintain (users : User list) ctx vi =
let s = I18N.localizer.Force () let s = I18N.localizer.Force ()
[ div [ _class "pt-center-text" ] [ let usrTbl =
br [] match users with
a [ _href (sprintf "/user/%s/edit" emptyGuid); _title s.["Add a New User"].Value ] | [] -> space
[ icon "add_circle"; rawText " &nbsp;"; encLocText s.["Add a New User"] ] | _ ->
br []
br []
]
tableSummary users.Length s
table [ _class "pt-table pt-action-table" ] [ table [ _class "pt-table pt-action-table" ] [
thead [] [ thead [] [
tr [] [ tr [] [
@ -215,6 +211,15 @@ let maintain (users : User list) ctx vi =
]) ])
|> tbody [] |> tbody []
] ]
[ div [ _class "pt-center-text" ] [
br []
a [ _href (sprintf "/user/%s/edit" emptyGuid); _title s.["Add a New User"].Value ]
[ icon "add_circle"; rawText " &nbsp;"; encLocText s.["Add a New User"] ]
br []
br []
]
tableSummary users.Length s
usrTbl
form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ] form [ _id "DeleteForm"; _action ""; _method "post" ] [ csrfToken ctx ]
] ]
|> Layout.Content.standard |> Layout.Content.standard