File tree Expand file tree Collapse file tree 2 files changed +33
-15
lines changed
Expand file tree Collapse file tree 2 files changed +33
-15
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( http://keepachangelog.com/ )
66and this project adheres to [ Semantic Versioning] ( http://semver.org/ ) .
77
8+ ## [ unreleased] -
9+
10+ ### Fixed
11+
12+ - Fix model subform not displayed after page reload
13+
814## [ 2.15.3] - 2025-12-22
915
1016### Fixed
Original file line number Diff line number Diff line change 6868 </div >
6969 </div >
7070
71- {% if models_id %}
72- <div class =" row mt-3" >
73- <div class =" col-12" >
74- {% if step == upload_step %}
75- <script >
76- Ajax .updateItem (" span_injection" , " {{ upload_url }}" , {{ params| json_encode| raw }});
77- </script >
78- {% elseif step == result_step %}
79- <script >
80- Ajax .updateItem (" span_injection" , " {{ result_url }}" , {{ params| json_encode| raw }});
81- </script >
82- {% endif %}
83- </div >
84- </div >
85- {% endif %}
71+ <script >
72+ $ (function () {
73+ const rand = ' {{ rand }}' ;
74+ const uploadUrl = " {{ upload_url }}" ;
75+ const resultUrl = " {{ result_url }}" ;
76+ const modelId = {{ models_id }};
77+ const step = {{ step }};
78+ const resultStep = {{ result_step }};
79+
80+ function loadFormForModel (modelId ) {
81+ if (modelId > 0 ) {
82+ const url = (step === resultStep) ? resultUrl : uploadUrl;
83+ $ (' #span_injection' ).load (url, { models_id: modelId });
84+ }
85+ }
86+
87+ // On model change
88+ $ (' #clientinjection_form' + rand + ' select[name="dropdown_models"]' ).on (' change select2:select' , function () {
89+ loadFormForModel ($ (this ).val ());
90+ });
91+
92+ // Initial load
93+ if (modelId > 0 ) {
94+ loadFormForModel (modelId);
95+ }
96+ });
97+ </script >
8698 </div >
8799 </form >
88100</div >
You can’t perform that action at this time.
0 commit comments