11{% load nimbus_extras %}
22
3- < div class ="d-flex gap-4 ">
3+ < div class ="d-flex gap-3 ">
44 {% with shot=branch.screenshots.first %}
55 {% if shot and shot.image %}
6- < img src ="{{ shot.image.url }} "
7- alt ="{{ shot.description|default:branch.name }} "
8- class ="border border-secondary-subtle rounded w-50 "
9- style ="height: 120px;
10- object-fit: cover " />
6+ < div class ="position-relative border border-secondary-subtle rounded w-50 h-100 ">
7+ < img src ="{{ shot.image.url }} "
8+ alt ="{{ shot.description|default:branch.name }} "
9+ class ="rounded w-100 "
10+ style ="height: 120px;
11+ object-fit: cover " />
12+ < button type ="button "
13+ data-bs-toggle ="modal "
14+ data-bs-target ="#{{ experiment_slug }}-{{ branch.slug }}-image-edit "
15+ class ="position-absolute border-0 opacity-75 bg-secondary-subtle top-0 end-0 p-2 m-1 rounded lh-1 ">
16+ < i class ="fa-solid fa-up-right-and-down-left-from-center text-muted "> </ i >
17+ </ button >
18+ </ div >
1119 {% else %}
12- < div class ="border border-secondary-subtle rounded text-center d-flex align-items-center justify-content-center w-50 "
20+ < div class ="position-relative border border-secondary-subtle rounded text-center d-flex align-items-center justify-content-center w-50 "
1321 style ="height: 120px ">
1422 < small class ="text-muted "> No screenshot</ small >
23+ < button type ="button "
24+ data-bs-toggle ="modal "
25+ data-bs-target ="#{{ experiment_slug }}-{{ branch.slug }}-image-edit "
26+ class ="position-absolute border-0 opacity-75 bg-secondary-subtle top-0 end-0 p-2 m-1 rounded lh-1 ">
27+ < i class ="fa-solid fa-up-right-and-down-left-from-center text-muted "> </ i >
28+ </ button >
1529 </ div >
1630 {% endif %}
1731 {% endwith %}
@@ -28,3 +42,63 @@ <h6 class="mt-2">{{ branch.name }}</h6>
2842 < p class ="text-muted "> {{ branch.description|truncatechars:100 }}</ p >
2943 </ div >
3044</ div >
45+ < div class ="modal fade "
46+ id ="{{ experiment_slug }}-{{ branch.slug }}-image-edit "
47+ tabindex ="-1 "
48+ aria-labelledby ="{{ experiment_slug }}-{{ branch.slug }}-image-edit "
49+ aria-hidden ="true ">
50+ < div class ="modal-dialog modal-dialog-centered modal-lg ">
51+ < div class ="modal-content p-4 ">
52+ < div class ="modal-header border-0 ">
53+ < button type ="button "
54+ class ="btn-close "
55+ data-bs-dismiss ="modal "
56+ aria-label ="Close "> </ button >
57+ </ div >
58+ < div class ="modal-body ">
59+ < form method ="post "
60+ id ="branch-screenshot-form-{{ experiment_slug }}-{{ branch.slug }} "
61+ hx-encoding ="multipart/form-data "
62+ hx-post ="{% url "nimbus-ui-branch-leading-screenshot-upload " slug=experiment_slug branch_slug =branch.slug %} "
63+ class="accordion ">
64+ {% csrf_token %}
65+ {% if screenshot_form.instance.pk and screenshot_form.instance.image %}
66+ < div class ="position-relative border border-secondary-subtle rounded h-100 mb-3 ">
67+ < img src ="{{ screenshot_form.instance.image.url }} "
68+ alt ="{{ screenshot_form.instance.description }} "
69+ class ="w-100 rounded ">
70+ </ div >
71+ {% else %}
72+ < div class ="border border-secondary-subtle rounded mb-3 ">
73+ < small class ="text-muted d-block p-5 text-center "> No screenshot uploaded</ small >
74+ </ div >
75+ {% endif %}
76+ {{ screenshot_form.image }}
77+ {% if screenshot_form.instance.image %}
78+ < div class ="accordion-item border border-1 rounded mt-4 ">
79+ < button class ="accordion-button shadow-none bg-transparent text-body "
80+ type ="button "
81+ data-bs-toggle ="collapse "
82+ data-bs-target ="#screenshot-form-{{ experiment_slug }}-{{ branch.slug }} "
83+ aria-expanded ="true "
84+ aria-controls ="screenshot-form-{{ experiment_slug }}-{{ branch.slug }} ">
85+ < div class ="d-flex flex-column align-items-start ">
86+ < h6 class ="mb-1 "> Add image description</ h6 >
87+ < small class ="text-muted "> Add a short description so people who can't see the image know what it shows.</ small >
88+ </ div >
89+ </ button >
90+ < div id ="screenshot-form-{{ experiment_slug }}-{{ branch.slug }} "
91+ class ="accordion-collapse collapse show ">
92+ < div class ="accordion-body pt-0 "> {{ screenshot_form.description }}</ div >
93+ </ div >
94+ </ div >
95+ {% endif %}
96+ < div class ="d-flex justify-content-end gap-2 mt-4 ">
97+ < button type ="button " class ="btn btn-secondary " data-bs-dismiss ="modal "> Close</ button >
98+ < button type ="submit " class ="btn btn-primary "> Save changes</ button >
99+ </ div >
100+ </ form >
101+ </ div >
102+ </ div >
103+ </ div >
104+ </ div >
0 commit comments