From ec13031e05da7592e41f00ef346b5b57d66b6174 Mon Sep 17 00:00:00 2001 From: Odei Alba Date: Fri, 19 Apr 2024 17:17:22 +0200 Subject: [PATCH] SV-65 Change "Save" for "Update" when the user has already voted --- classes/output/sort_voting_form.php | 1 + templates/sort_voting_form.mustache | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/classes/output/sort_voting_form.php b/classes/output/sort_voting_form.php index 55aaf0d..2aa81a8 100644 --- a/classes/output/sort_voting_form.php +++ b/classes/output/sort_voting_form.php @@ -83,6 +83,7 @@ public function export_for_template(renderer_base $output): array { return [ 'sortvotingid' => $this->sortvoting->id, 'allowupdate' => $allowupdate, + 'alreadyvoted' => count($existingvotes) > 0, 'options' => $optionsclean, 'max' => count($options), ]; diff --git a/templates/sort_voting_form.mustache b/templates/sort_voting_form.mustache index a9c2e9b..65ac8cc 100644 --- a/templates/sort_voting_form.mustache +++ b/templates/sort_voting_form.mustache @@ -73,7 +73,10 @@ {{#allowupdate}} - + {{#js}} require(['mod_sortvoting/sortvoting'], function(sortvoting) { sortvoting.init();