Skip to content

Commit

Permalink
style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
facundoy committed Oct 20, 2024
1 parent e47f631 commit c762c91
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 12 deletions.
111 changes: 99 additions & 12 deletions src/haz3lweb/Grading.re
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,13 @@ module ImplGradingReport = {
};

let view =
(~inject, ~report: t, ~syntax_report: SyntaxReport.t, ~max_points: int) => {
(
~inject,
~report: t,
~syntax_report: SyntaxReport.t,
~max_points: int,
~settings: Settings.t,
) => {
Cell.panel(
~classes=["cell-item", "panel", "test-panel"],
[
Expand All @@ -649,18 +655,99 @@ module ImplGradingReport = {
div(
~attrs=[Attr.classes(["test-summary"])],
[
div(
~attrs=[Attr.class_("test-text")],
[
score_view(
score_of_percent(
percentage(report, syntax_report),
max_points,
settings.instructor_mode
? settings.editing_impl_grd_rep
? Node.div([
div(
~attrs=[Attr.class_("input-field")],
[
label([text("New point max:")]),
input(
~attrs=[
Attr.type_("number"),
Attr.class_("point-num-input"),
Attr.id("point-max-input"),
Attr.value(string_of_int(max_points)),
],
(),
),
],
),
div(
~attrs=[Attr.class_("edit-icon")],
[
Widgets.button(
Icons.confirm,
_ => {
let new_dist =
Obj.magic(
Js_of_ocaml.Js.some(
JsUtil.get_elem_by_id(
"point-max-input",
),
),
)##.value;

let update_events = [
inject(Set(EditingImplGrdRep)),
inject(
UpdateImplGrdRep(
int_of_string(new_dist),
),
),
];
Virtual_dom.Vdom.Effect.Many(update_events);
},
),
],
),
div(
~attrs=[Attr.class_("edit-icon")],
[
Widgets.button(Icons.cancel, _ =>
inject(Set(EditingImplGrdRep))
),
],
),
])
: Node.div([
div(
~attrs=[Attr.class_("test-text")],
[
score_view(
score_of_percent(
percentage(report, syntax_report),
max_points,
),
),
]
@ textual_summary(report)
@ [
div(
~attrs=[Attr.class_("edit-icon")],
[
Widgets.button(Icons.pencil, _ =>
inject(Set(EditingImplGrdRep))
),
],
),
],
),
])
: Node.div([
div(
~attrs=[Attr.class_("test-text")],
[
score_view(
score_of_percent(
percentage(report, syntax_report),
max_points,
),
),
]
@ textual_summary(report),
),
),
]
@ textual_summary(report),
),
]),
]
@ Option.to_list(
report.test_results
Expand Down
1 change: 1 addition & 0 deletions src/haz3lweb/view/ExerciseMode.re
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ let view =
~report=grading_report.impl_grading_report,
~syntax_report=grading_report.syntax_report,
~max_points=grading_report.point_distribution.impl_grading,
~settings,
),
);
[score_view, title_view, prompt_view]
Expand Down

0 comments on commit c762c91

Please sign in to comment.