Skip to content

Commit 1bade59

Browse files
committed
Rename include and extends
1 parent ff56e00 commit 1bade59

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+178
-179
lines changed

core/templatetags/analytics_tags.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
register = template.Library()
44

55

6-
@register.inclusion_tag("analytics/matomo.html")
6+
@register.inclusion_tag("ui/analytics/matomo.html")
77
def matomo(id):
88
return {"matomo_url": "stats.beta.gouv.fr", "matomo_id": id}
99

1010

11-
@register.inclusion_tag("analytics/posthog_data_attributes.html")
11+
@register.inclusion_tag("ui/analytics/posthog_data_attributes.html")
1212
def posthog_data_attributes(key):
1313
return {"key": key}

previews/template_preview.py

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ def get_default_action():
4444

4545

4646
class PinPointForm(forms.Form):
47-
4847
action = forms.ModelChoiceField(
4948
queryset=Action.objects.all(),
5049
label="Action",
@@ -150,23 +149,23 @@ def acteur_pinpoint(
150149

151150
def button(self, **kwargs):
152151
context = {"href": "google.fr", "text": "test"}
153-
return render_to_string("components/button.html", context)
152+
return render_to_string("ui/components/button.html", context)
154153

155154
def code(self, **kwargs):
156155
context = {
157156
"script": '<script src="https://quefairedemesdechets.ademe.local/iframe.js"></script>',
158157
}
159-
return render_to_string("components/code/code.html", context)
158+
return render_to_string("ui/components/code/code.html", context)
160159

161160
def logo(self, **kwargs):
162-
return render_to_string("components/logo/header.html")
161+
return render_to_string("ui/components/logo/header.html")
163162

164163
def logo_homepage(self, **kwargs):
165-
return render_to_string("components/logo/homepage.html")
164+
return render_to_string("ui/components/logo/homepage.html")
166165

167166
def produit_legacy_heading(self, **kwargs):
168167
context = {"title": "Coucou !"}
169-
return render_to_string("components/produit/legacy_heading.html", context)
168+
return render_to_string("ui/components/produit/legacy_heading.html", context)
170169

171170
@register_form_class(ProduitHeadingForm)
172171
def produit_heading(self, synonyme=None, pronom="mon", **kwargs):
@@ -177,7 +176,7 @@ def produit_heading(self, synonyme=None, pronom="mon", **kwargs):
177176

178177
context.update(pronom=pronom)
179178

180-
return render_to_string("components/produit/heading.html", context)
179+
return render_to_string("ui/components/produit/heading.html", context)
181180

182181
@register_form_class(ProduitHeadingForm)
183182
def produit_heading_family(self, synonyme=None, pronom="mon", **kwargs):
@@ -188,7 +187,7 @@ def produit_heading_family(self, synonyme=None, pronom="mon", **kwargs):
188187

189188
context.update(pronom=pronom)
190189

191-
return render_to_string("components/produit/heading_family.html", context)
190+
return render_to_string("ui/components/produit/heading_family.html", context)
192191

193192

194193
class ModalsPreview(LookbookPreview):
@@ -229,11 +228,11 @@ def home(self, **kwargs):
229228
},
230229
"ASSISTANT": {"faites_decouvrir_ce_site": "Faites découvrir ce site !"},
231230
}
232-
return render_to_string("pages/home.html", context)
231+
return render_to_string("ui/pages/home.html", context)
233232

234233
def produit(self, **kwargs):
235234
context = {"object": Synonyme.objects.first()}
236-
return render_to_string("pages/produit.html", context)
235+
return render_to_string("ui/pages/produit.html", context)
237236

238237

239238
class SnippetsPreview(LookbookPreview):
@@ -244,21 +243,21 @@ def header(self, **kwargs):
244243
**Markdown syntax is supported in docstring**
245244
"""
246245
context = {"request": None}
247-
return render_to_string("components/header/header.html", context)
246+
return render_to_string("ui/components/header/header.html", context)
248247

249248
def footer(self, **kwargs):
250-
return render_to_string("components/footer/footer.html")
249+
return render_to_string("ui/components/footer/footer.html")
251250

252251
def suggestions(self, **kwargs):
253252
context = {
254253
"heading": "Coucou",
255254
"suggestions": [("coucou", "google.fr"), ("youpi", "google.fr")],
256255
}
257-
return render_to_string("components/suggestions/suggestions.html", context)
256+
return render_to_string("ui/components/suggestions/suggestions.html", context)
258257

259258
def share_and_embed(self, **kwargs):
260259
context = {"heading": "Faites découvrir ce site"}
261-
return render_to_string("snippets/share_and_embed.html", context)
260+
return render_to_string("ui/snippets/share_and_embed.html", context)
262261

263262

264263
class IframePreview(LookbookPreview):
@@ -364,7 +363,7 @@ def P01_3_3(self, **kwargs):
364363
- [ ] Le contour de la recherche doit être en couleur #53918C
365364
"""
366365
context = {"search_form": SearchForm()}
367-
return render_to_string("components/search/view.html", context)
366+
return render_to_string("ui/components/search/view.html", context)
368367

369368
def P01_10_2(self, **kwargs):
370369
"""
@@ -378,7 +377,7 @@ def P01_10_2(self, **kwargs):
378377
- [ ] Avec le CSS désactivé, le label rechercher du bouton s'affiche
379378
"""
380379
context = {"search_form": SearchForm()}
381-
return render_to_string("components/search/view.html", context)
380+
return render_to_string("ui/components/search/view.html", context)
382381

383382
def P01_10_7(self, **kwargs):
384383
"""
@@ -394,7 +393,7 @@ def P01_10_7(self, **kwargs):
394393
- [ ] Le focus du champ de recherche affiche un contour bleu bien visible
395394
"""
396395
context = {"search_form": SearchForm()}
397-
return render_to_string("components/search/view.html", context)
396+
return render_to_string("ui/components/search/view.html", context)
398397

399398
def P01_13_8(self, **kwargs):
400399
"""
@@ -414,10 +413,10 @@ def P01_13_8(self, **kwargs):
414413
{% load dsfr_tags %}
415414
416415
<p class="fr-h2">Logo en homepage</p>
417-
{% include "components/logo/homepage.html" %}
416+
{% include "ui/components/logo/homepage.html" %}
418417
<hr>
419418
<p class="fr-h2">Logo du header</p>
420-
{% include "components/logo/header.html" %}
419+
{% include "ui/components/logo/header.html" %}
421420
""",
422421
)
423422
return template.render(Context({}))

qfdmd/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717

1818
class SearchInput(forms.TextInput):
19-
template_name = "components/search/widget.html"
19+
template_name = "ui/components/search/widget.html"
2020

2121

2222
class SearchForm(DsfrBaseForm):

qfdmd/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def family(self):
225225
class ProduitPage(
226226
CompiledFieldMixin, Page, GenreNombreModel, TitleFields, AncestorFieldsMixin
227227
):
228-
template = "pages/produit_page.html"
228+
template = "ui/pages/produit_page.html"
229229
subpage_types = [
230230
"qfdmd.synonymepage",
231231
]
@@ -355,7 +355,7 @@ class FamilyPageTag(TaggedItemBase):
355355

356356

357357
class FamilyPage(ProduitPage):
358-
template = "pages/family_page.html"
358+
template = "ui/pages/family_page.html"
359359
subpage_types = ["qfdmd.produitpage", "qfdmd.synonymepage"]
360360

361361
class Meta:
@@ -589,7 +589,7 @@ def en_savoir_plus(self):
589589
return None
590590

591591
return render_to_string(
592-
"components/produit/_en_savoir_plus.html",
592+
"ui/components/produit/_en_savoir_plus.html",
593593
{"liens": [produit_lien.lien for produit_lien in produit_liens]},
594594
)
595595

qfdmd/templatetags/qfdmd_tags.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def genre_nombre_from(reusable_content: ReusableContent, page):
3636
return richtext(content.replace("&lt;objet&gt;", replacement))
3737

3838

39-
@register.inclusion_tag("components/patchwork/patchwork.html")
39+
@register.inclusion_tag("ui/components/patchwork/patchwork.html")
4040
def patchwork() -> dict:
4141
from qfdmd.models import Synonyme
4242

@@ -90,7 +90,7 @@ def get_file_content() -> str:
9090
return ""
9191

9292

93-
@register.inclusion_tag("components/carte/carte.html", takes_context=True)
93+
@register.inclusion_tag("ui/components/carte/carte.html", takes_context=True)
9494
def carte(context, carte_config: CarteConfig) -> dict:
9595
page = context.get("page")
9696
return {

qfdmd/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def get_assistant_script(request):
4444
return static_file_content_from("embed/assistant.js")
4545

4646

47-
SEARCH_VIEW_TEMPLATE_NAME = "components/search/view.html"
47+
SEARCH_VIEW_TEMPLATE_NAME = "ui/components/search/view.html"
4848

4949

5050
def search_view(request) -> HttpResponse:
@@ -83,7 +83,7 @@ def dispatch(self, request, *args, **kwargs):
8383
@method_decorator(cache_control(max_age=60 * 15), name="dispatch")
8484
@method_decorator(vary_on_headers("logged-in", "iframe"), name="dispatch")
8585
class HomeView(AssistantBaseView, ListView):
86-
template_name = "pages/home.html"
86+
template_name = "ui/pages/home.html"
8787
model = Suggestion
8888

8989
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
@@ -117,7 +117,7 @@ def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
117117

118118

119119
class SynonymeDetailView(AssistantBaseView, DetailView):
120-
template_name = "pages/produit.html"
120+
template_name = "ui/pages/produit.html"
121121
model = Synonyme
122122

123123
def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse:

qfdmo/views/adresses.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ def setup(self, request, *args, **kwargs):
6969
def get_context_data(self, **kwargs):
7070
context = super().get_context_data(**kwargs)
7171
if self.turbo:
72-
context.update(turbo=True, base_template="layout/turbo.html")
72+
context.update(turbo=True, base_template="ui/layout/turbo.html")
7373
else:
74-
context.update(base_template="layout/base.html")
74+
context.update(base_template="ui/layout/base.html")
7575

7676
return context
7777

@@ -532,7 +532,7 @@ class FormulaireSearchActeursView(SearchActeursView):
532532
modifiée."""
533533

534534
is_iframe = True
535-
template_name = "pages/formulaire.html"
535+
template_name = "ui/pages/formulaire.html"
536536
form_class = FormulaireForm
537537

538538
def get_context_data(self, **kwargs):
@@ -638,10 +638,10 @@ def acteur_detail_redirect(request, identifiant_unique):
638638

639639

640640
def acteur_detail(request, uuid):
641-
base_template = "layout/carte.html"
641+
base_template = "ui/layout/carte.html"
642642

643643
if request.headers.get("Turbo-Frame"):
644-
base_template = "layout/turbo.html"
644+
base_template = "ui/layout/turbo.html"
645645

646646
latitude = request.GET.get("latitude")
647647
longitude = request.GET.get("longitude")
@@ -692,7 +692,7 @@ def acteur_detail(request, uuid):
692692
)
693693
)
694694

695-
return render(request, "components/carte/acteur.html", context)
695+
return render(request, "ui/components/carte/acteur.html", context)
696696

697697

698698
def solution_admin(request, identifiant_unique):

qfdmo/views/carte.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
class CarteSearchActeursView(SearchActeursView):
1717
is_carte = True
18-
template_name = "pages/carte.html"
18+
template_name = "ui/pages/carte.html"
1919
form_class = CarteForm
2020

2121
def get_initial(self, *args, **kwargs):

qfdmo/views/configurator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
class ConfiguratorView(FormView):
2323
form_class = ConfiguratorForm
24-
template_name = "pages/configurateur/base.html"
24+
template_name = "ui/pages/configurateur/base.html"
2525

2626
def get_initial(self) -> dict[str, Any]:
2727
"""Populate the view with values passed as a querystring in the URL"""
@@ -102,7 +102,7 @@ def _compile_script_tag(self, attributes) -> str:
102102

103103
class AdvancedConfiguratorView(LoginRequiredMixin, FormView):
104104
form_class = AdvancedConfiguratorForm
105-
template_name = "pages/configurateur/avance.html"
105+
template_name = "ui/pages/configurateur/avance.html"
106106

107107
def get_initial(self):
108108
initial = super().get_initial()

templates/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends "layout/assistant.html" %}
1+
{% extends "ui/layout/assistant.html" %}
22
{% comment %}
33
This overrides the base.html used by Sites Faciles.
44
At the moment, Sites Faciles does not namespace this template and

0 commit comments

Comments
 (0)