Skip to content

Commit

Permalink
Button instead of static html for ws js call
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusgreen committed Feb 23, 2025
1 parent db3c4fc commit 80469d5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion amd/build/editformhelper.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/src/editformhelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const init = (contextid) => {
const marksscheme = form.querySelector(Selectors.fields.markscheme);
const defaultmark = form.querySelector(Selectors.fields.defaultmark);

if(sampleanswer.value==="" || aiprompt.value===""){
if (sampleanswer.value === "" || aiprompt.value === "") {
Notify.alert(strings.prompttester, strings.sampleanswerempty);
return;
}
Expand Down
10 changes: 8 additions & 2 deletions edit_aitext_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class qtype_aitext_edit_form extends question_edit_form {
*/
protected function definition_inner($mform) {
global $PAGE;

/** @var qtype_aitext $qtype */
$qtype = question_bank::get_qtype('aitext');
$mform->removeelement('generalfeedback');
Expand Down Expand Up @@ -91,7 +90,12 @@ protected function definition_inner($mform) {
$mform->addElement('static', 'sampleanswereval', '', '<a class="qtype_aitext_sampleanswerbtn btn btn-secondary"
id="id_sampleanswerbtn">'
. get_string('sampleanswerevaluate', 'qtype_aitext') . '</a>' .
'<div class="qtype_aitext_sampleanswereval" id="id_sampleanswereval"></div>');
'<div id="id_sampleanswereval"></div>');


$mform->addElement('button', 'sampleanswerbtn2"', get_string('sampleanswerevaluate', 'qtype_aitext'));
$mform->registerNoSubmitButton('sampleanswerbtn2"');

$mform->addElement('header', 'responseoptions', get_string('responseoptions', 'qtype_aitext'));
$mform->setExpanded('responseoptions');

Expand Down Expand Up @@ -136,6 +140,8 @@ protected function definition_inner($mform) {

// Load any JS that we need to make things happen, specifically the prompt tester.
$PAGE->requires->js_call_amd('qtype_aitext/editformhelper', 'init', [$this->context->id]);
$PAGE->requires->js_call_amd('qtype_aitext/responserun','init');

}

/**
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();

$plugin->component = 'qtype_aitext';
$plugin->version = 2024051110;
$plugin->version = 2024071802;
$plugin->requires = 2020110900;
$plugin->release = '0.02';
$plugin->maturity = MATURITY_BETA;

0 comments on commit 80469d5

Please sign in to comment.