Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [unreleased] -

### Fixed

- Fix model subform not displayed after page reload

## [2.15.3] - 2025-12-22

### Fixed
Expand Down
42 changes: 27 additions & 15 deletions templates/clientinjection.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,33 @@
</div>
</div>

{% if models_id %}
<div class="row mt-3">
<div class="col-12">
{% if step == upload_step %}
<script>
Ajax.updateItem("span_injection", "{{ upload_url }}", {{ params|json_encode|raw }});
</script>
{% elseif step == result_step %}
<script>
Ajax.updateItem("span_injection", "{{ result_url }}", {{ params|json_encode|raw }});
</script>
{% endif %}
</div>
</div>
{% endif %}
<script>
$(function() {
const rand = '{{ rand }}';
const uploadUrl = "{{ upload_url }}";
const resultUrl = "{{ result_url }}";
const modelId = {{ models_id }};
const step = {{ step }};
const resultStep = {{ result_step }};

function loadFormForModel(modelId) {
if (modelId > 0) {
const url = (step === resultStep) ? resultUrl : uploadUrl;
$('#span_injection').load(url, { models_id: modelId });
}
}

// On model change
$('#clientinjection_form' + rand + ' select[name="dropdown_models"]').on('change select2:select', function() {
loadFormForModel($(this).val());
});

// Initial load
if (modelId > 0) {
loadFormForModel(modelId);
}
});
</script>
</div>
</form>
</div>