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
let maintain (churches : Church list) (stats : Map<string, ChurchStats>) ctx vi =
let s = I18N.localizer.Force ()
[ 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
let chTbl =
match churches with
| [] -> space
| _ ->
table [ _class "pt-table pt-action-table" ] [
thead [] [
tr [] [
@ -98,6 +94,15 @@ let maintain (churches : Church list) (stats : Map<string, ChurchStats>) ctx vi
])
|> 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 ]
]
|> Layout.Content.wide

View File

@ -210,7 +210,7 @@ let maintain (reqs : PrayerRequest seq) (grp : SmallGroup) onlyActive (ctx : Htt
]
])
|> List.ofSeq
[ div [ _class "pt-center-text" ] [
[ yield div [ _class "pt-center-text" ] [
br []
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"] ]
@ -220,8 +220,11 @@ let maintain (reqs : PrayerRequest seq) (grp : SmallGroup) onlyActive (ctx : Htt
br []
br []
]
tableSummary requests.Length s
table [ _class "pt-table pt-action-table" ] [
yield tableSummary requests.Length s
match requests.Length with
| 0 -> ()
| _ ->
yield table [ _class "pt-table pt-action-table" ] [
thead [] [
tr [] [
th [] [ encLocText s.["Actions"] ]
@ -233,7 +236,7 @@ let maintain (reqs : PrayerRequest seq) (grp : SmallGroup) onlyActive (ctx : Htt
]
tbody [] requests
]
div [ _class "pt-center-text" ] [
yield div [ _class "pt-center-text" ] [
yield br []
match onlyActive with
| true ->
@ -245,7 +248,7 @@ let maintain (reqs : PrayerRequest seq) (grp : SmallGroup) onlyActive (ctx : Htt
yield br []
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.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
let maintain (grps : SmallGroup list) ctx vi =
let s = I18N.localizer.Force ()
[ 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
let grpTbl =
match grps with
| [] -> space
| _ ->
table [ _class "pt-table pt-action-table" ] [
thead [] [
tr [] [
@ -215,6 +208,18 @@ let maintain (grps : SmallGroup list) ctx vi =
])
|> 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 ]
]
|> Layout.Content.standard
@ -224,14 +229,10 @@ let maintain (grps : SmallGroup list) ctx vi =
/// View for the member maintenance page
let members (mbrs : Member list) (emailTyps : Map<string, LocalizedString>) ctx vi =
let s = I18N.localizer.Force ()
[ 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
let mbrTbl =
match mbrs with
| [] -> space
| _ ->
table [ _class "pt-table pt-action-table" ] [
thead [] [
tr [] [
@ -262,6 +263,15 @@ let members (mbrs : Member list) (emailTyps : Map<string, LocalizedString>) ctx
])
|> 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 ]
]
|> Layout.Content.standard

View File

@ -174,14 +174,10 @@ let logOn (m : UserLogOn) groups ctx vi =
/// View for the user maintenance page
let maintain (users : User list) ctx vi =
let s = I18N.localizer.Force ()
[ 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
let usrTbl =
match users with
| [] -> space
| _ ->
table [ _class "pt-table pt-action-table" ] [
thead [] [
tr [] [
@ -215,6 +211,15 @@ let maintain (users : User list) ctx vi =
])
|> 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 ]
]
|> Layout.Content.standard