diff --git a/module/ai/view/prompts.html.php b/module/ai/view/prompts.html.php index 4abbeec20c..e0f013126a 100644 --- a/module/ai/view/prompts.html.php +++ b/module/ai/view/prompts.html.php @@ -10,6 +10,37 @@ */ ?> +ai->isExecutable($prompt); + $publishable = $prompt->status == 'draft'; + + /* Design button. */ + $html .= html::a(helper::createLink('ai', 'promptassignrole', "prompt=$prompt->id"), '', '', "class='btn' title='{$lang->ai->prompts->action->design}'"); + + /* Test / audit button. */ + $html .= html::a($executable ? $this->ai->getTestingLocation($prompt) : '#', '', '', "class='btn' title='{$lang->ai->prompts->action->test}'" . ($executable ? '' : " data-toggle='modal' data-target='#designConfirmModal'")); + + /* Edit button. */ + $html .= html::a(helper::createLink('ai', '', "prompt=$prompt->id"), '', '', "class='btn' title='{$lang->ai->prompts->action->edit}'"); + + /* Publish button. */ + $html .= html::a($publishable && $executable ? "javascript:togglePromptStatus($prompt->id)" : '#', '', '', "class='btn" . ($publishable ? '' : ' disabled') . "' title='{$lang->ai->prompts->action->publish}'" . ($executable ? '' : " data-toggle='modal' data-target='#designConfirmModal'")); + + /* Unpublish button. */ + $html .= html::a('#', '', '', "class='btn" . ($publishable ? ' disabled' : '') . "' title='{$lang->ai->prompts->action->unpublish}'" . ($publishable ? '' : " data-toggle='modal' data-target='#draftConfirmModal'")); + + echo $html; + } +?>