Dodato full regenerisanje dokumenta,dodat fallback za incomplete document
This commit is contained in:
@@ -22,7 +22,23 @@
|
||||
/* Hide labels (and colons) for regen action rows */
|
||||
.form-row.field-regen_controls_action label,
|
||||
.form-row.field-regen_keyfindings_action label,
|
||||
.form-row.field-regen_document_action label,
|
||||
.form-row.field-regen_note_action label,
|
||||
.form-row.field-regen_recommendations_action label { display: none; }
|
||||
.form-row.field-regen_top_risks_action label { display: none; }
|
||||
.form-row.field-regen_controls_action { display: none !important; }
|
||||
|
||||
.ai-callout {
|
||||
margin: 8px 0 0;
|
||||
padding: 10px 12px;
|
||||
border-left: 4px solid #2f80ed;
|
||||
border-radius: 4px;
|
||||
background: #e8f4ff;
|
||||
color: #0c3b66;
|
||||
box-shadow: 0 1px 0 rgba(0,0,0,0.04), 0 0 0 1px rgba(13, 110, 253, 0.06) inset;
|
||||
font-size: 13px;
|
||||
line-height: 1.35;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
@@ -31,6 +47,19 @@
|
||||
<p>Use the Regenerate buttons inside each section to update content. When ready, Save and Send.</p>
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
||||
{% block field_sets %}
|
||||
{% for fieldset in adminform %}
|
||||
{% include "admin/includes/fieldset.html" %}
|
||||
{% if forloop.first %}
|
||||
{% for inline_admin_formset in inline_admin_formsets %}
|
||||
{% include inline_admin_formset.opts.template %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% block inline_field_sets %}{% endblock %}
|
||||
|
||||
|
||||
{% block submit_buttons_bottom %}
|
||||
{{ block.super }}
|
||||
@@ -48,7 +77,36 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addRegenControlsInsideInline() {
|
||||
var inlineGroup = document.getElementById('documentriskcontrol_set-group');
|
||||
if (!inlineGroup) {
|
||||
document.querySelectorAll('.inline-group').forEach(function(g){
|
||||
if (inlineGroup) return;
|
||||
var h2 = g.querySelector('h2');
|
||||
if (h2 && /document risk controls/i.test(h2.textContent)) {
|
||||
inlineGroup = g;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!inlineGroup) return;
|
||||
|
||||
if (inlineGroup.querySelector('button[name="_regen_controls"]')) return;
|
||||
|
||||
var h2 = inlineGroup.querySelector('h2') || inlineGroup.firstElementChild;
|
||||
(h2 || inlineGroup).insertAdjacentHTML('afterend',
|
||||
'<div class="inline-action">' +
|
||||
'<div class="ai-callout ai-callout-info">' +
|
||||
'💡 <strong>Recommended:</strong> after regenerating controls, also update Key Findings and Recommendations.' +
|
||||
'</div>' +
|
||||
'<br/>' +
|
||||
'<button type="submit" name="_regen_controls" class="button">Regenerate Controls using AI</button>' +
|
||||
'<br/>'+
|
||||
'</div>'
|
||||
);
|
||||
}
|
||||
addSaveSendButton();
|
||||
addRegenControlsInsideInline();
|
||||
document.addEventListener('formset:added', addSaveSendButton);
|
||||
document.addEventListener('formset:removed', addSaveSendButton);
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user