Skip to content

Commit

Permalink
Merge pull request #69 from odeialba/SV-65
Browse files Browse the repository at this point in the history
SV-65 Change "Save" for "Update" when the user has already voted
  • Loading branch information
odeialba authored May 3, 2024
2 parents 2bcc213 + ec13031 commit 7836a79
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions classes/output/sort_voting_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
];
Expand Down
5 changes: 4 additions & 1 deletion templates/sort_voting_form.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@
</ul>

{{#allowupdate}}
<button class="btn btn-primary" data-action="savevote" title="{{#str}} save {{/str}}">{{#str}} save {{/str}}</button>
<button class="btn btn-primary" data-action="savevote"
{{#alreadyvoted}} title="{{#str}} update {{/str}}">{{#str}} update {{/str}}{{/alreadyvoted}}
{{^alreadyvoted}} title="{{#str}} save {{/str}}">{{#str}} save {{/str}}{{/alreadyvoted}}
</button>
{{#js}}
require(['mod_sortvoting/sortvoting'], function(sortvoting) {
sortvoting.init();
Expand Down

0 comments on commit 7836a79

Please sign in to comment.