[OCaml] High Intensity Training Online
feat add a browse-routines button and tidy the routine page
Add a Browse routines button linking to the routine chooser. Drop the redundant ledger-meta styling from the Next/status lines and rename the in-progress card class to .in-progress after the card removal. Cover the button with an end-to-end assertion.
Changed files
lib/presenter/pages_routine.ml
@@ -138,7 +138,7 @@
138
138
html_page ~viewer ~request ~active:"home" "Home"
139
139
([
140
140
tag "h1" [] [ txt "%s" vm.routine_name ];
141
Removed:
tag "p" [ class_ "ledger-meta" ] [ txt "Next: %s" vm.next_workout ];
141
Added:
tag "p" [] [ txt "Next: %s" vm.next_workout ];
142
142
(if vm.next_exercises = [] then txt ""
143
143
else
144
144
tag "ul"
@@ -146,7 +146,7 @@
146
146
(List.map
147
147
(fun name -> tag "li" [] [ txt "%s" name ])
148
148
vm.next_exercises));
149
Removed:
tag "p" [ class_ "ledger-meta" ] [ txt "%s" status ];
149
Added:
tag "p" [] [ txt "%s" status ];
150
150
]
151
151
@ gate)
152
152
@@ -159,7 +159,7 @@
159
159
[
160
160
tag "a"
161
161
[
162
Removed:
class_ "in-progress-card";
162
Added:
class_ "in-progress";
163
163
href Routes.workout;
164
164
Dream_html.attr "data-hito-app-link";
165
165
]
@@ -173,6 +173,17 @@
173
173
let routine request ?(logging = false) ~viewer (vm : View_model.Routine.t) =
174
174
html_page ~viewer ~request ~active:"routine" ~logging "Routine"
175
175
(tag "h1" [] [ txt "%s" vm.name ]
176
Added:
:: tag "p"
177
Added:
[ class_ "button-group" ]
178
Added:
[
179
Added:
tag "a"
180
Added:
[
181
Added:
href Routes.routines;
182
Added:
class_ "button";
183
Added:
Dream_html.attr "data-hito-app-link";
184
Added:
]
185
Added:
[ txt "Browse routines" ];
186
Added:
]
176
187
:: List.concat_map
177
188
(fun (workout : View_model.Routine.workout) ->
178
189
[
test/web/overview.ml
@@ -59,9 +59,15 @@
59
59
post c "/routines/ideal/select" [ ("dream.csrf", token) ]
60
60
in
61
61
Alcotest.(check int) "routine selected" 303 (status selection);
62
Removed:
Alcotest.(check int)
63
Removed:
"routine page served" 200
64
Removed:
(status (get c "/routine")) );
62
Added:
let routine_page = body (get c "/routine") in
63
Added:
Alcotest.(check bool)
64
Added:
"routine browser button is present" true
65
Added:
(Option.is_some
66
Added:
(index_from ~needle:"Browse routines" routine_page 0));
67
Added:
Alcotest.(check bool)
68
Added:
"routine browser button links to routines" true
69
Added:
(Option.is_some
70
Added:
(index_from ~needle:"href=\"/routines\"" routine_page 0)) );
65
71
( "selecting an unknown routine is not found and selects nothing",
66
72
`Quick,
67
73
fun () ->