mirror of
https://github.com/Superredstone/patrickcanal.it.git
synced 2026-11-19 04:41:15 +01:00
Compare commits
13
Commits
14118cf438
...
06d759e809
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06d759e809
|
||
|
|
cc76207bb4
|
||
|
|
1d25e49966
|
||
|
|
b10f0c65bb
|
||
|
|
4be478ab33
|
||
|
|
fca325d2cc
|
||
|
|
456dfa5793 | ||
|
|
e48e524c0a | ||
|
|
874764c3e3
|
||
|
|
92c15da936
|
||
|
|
e4383cabc8
|
||
|
|
7b3de9c9da
|
||
|
|
00f6633ecf
|
No files matched your search
@@ -0,0 +1,13 @@
|
||||
.git
|
||||
.gitignore
|
||||
__pycache__
|
||||
*.pyc
|
||||
*.pyo
|
||||
*.pyd
|
||||
.env
|
||||
venv
|
||||
.venv
|
||||
db.sqlite3
|
||||
staticfiles
|
||||
media
|
||||
wholestatic
|
||||
@@ -0,0 +1,43 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ["v*"]
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
@@ -10,7 +10,9 @@ devenv.local.yaml
|
||||
|
||||
*.sqlite3
|
||||
|
||||
.ruff_cache
|
||||
*.pyc
|
||||
__pycache__/
|
||||
local_settings.py
|
||||
uploads/
|
||||
wholestatic/
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
FROM python:3.12-slim
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends gcc
|
||||
|
||||
COPY requirements.txt .
|
||||
|
||||
RUN pip install --no-cache-dir --upgrade pip \
|
||||
&& pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["sh", "-c", "python manage.py migrate && python manage.py collectstatic --noinput && gunicorn patrickcanal_it.wsgi:application --bind 0.0.0.0:8000"]
|
||||
@@ -0,0 +1,18 @@
|
||||
# patrickcanal.it
|
||||
|
||||
## Docker
|
||||
Build container
|
||||
`docker build . -t patrickcanal.it`
|
||||
|
||||
Run docker run
|
||||
`docker run -p 8000:8000 patrickcanal.it -v "$(pwd)/patrickcanal.it/local_settings.py:/app/patrickcanal.it/local_settings.py" -v "$(pwd)/patrickcanal.it/db.sqlite:/app/db.sqlite"`
|
||||
|
||||
## Required variables
|
||||
### Portfolio
|
||||
Email variables will be replaced once `django-post_office` will be updated to support django 6.1 email system
|
||||
- MAILER_HOST
|
||||
- EMAIL_CONTACT
|
||||
- EMAIL_HOST_USER
|
||||
- EMAIL_HOST_PASSWORD
|
||||
- EMAIL_PORT
|
||||
- EMAIL_USE_TLS
|
||||
+15
-15
@@ -3,11 +3,11 @@
|
||||
"devenv": {
|
||||
"locked": {
|
||||
"dir": "src/modules",
|
||||
"lastModified": 1786975632,
|
||||
"narHash": "sha256-3N/pfn4/ADlkTzHJWgClmKD1mTLyVJNFxLbDMMHl/xw=",
|
||||
"lastModified": 1789304775,
|
||||
"narHash": "sha256-WPuZ7LbqlQ8n+kocw8oo4sNvHy//LXBTAHOqRDp5I5c=",
|
||||
"owner": "cachix",
|
||||
"repo": "devenv",
|
||||
"rev": "c972cb46d511e690c942e6ee3309a7e8b9a20475",
|
||||
"rev": "e6f5e1e6cda3a75bad3e0a4af97eb9e70bc9e127",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -55,11 +55,11 @@
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1784288435,
|
||||
"narHash": "sha256-ReRHaLgr/uVqdD8afFSn+myXIfpHeOhP0yYe0TJqAA8=",
|
||||
"lastModified": 1788267358,
|
||||
"narHash": "sha256-nt+lUqYVpc9Y6JeMd2WmXzCDojasdadKo0mWcluvY2Y=",
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "43b3c1ab9d40fb1dbb008f451988a91e375825e9",
|
||||
"rev": "27555e2624241fb116b49095df4caaee85a25691",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -70,11 +70,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1782918843,
|
||||
"narHash": "sha256-ETYnV9U7Sr+A45dohzZdfCZKOss4qrTkO+wgNZNvEc0=",
|
||||
"lastModified": 1787631388,
|
||||
"narHash": "sha256-vMiXptXarfSdJb1Gkc+FYVOAibuBRj7qxGa8z68q1Uw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e8273b29fe1390ec8d4603f2477357555291432e",
|
||||
"rev": "ac6b2166e7a9375683b8e98f860f273222337b16",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -108,11 +108,11 @@
|
||||
"nixpkgs-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1786098110,
|
||||
"narHash": "sha256-shi1tjDhCGGd0kIgVPNY03V8NBWSTzhMSFDb7IqSoec=",
|
||||
"lastModified": 1787394516,
|
||||
"narHash": "sha256-pRGOQSClnXNI2iLUG6DYpsGvYcuw0drOutVZFTJNw90=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "afb4584a80bbf779ce0f691509ff902d188c2b3d",
|
||||
"rev": "c8f90650c15282fa8656a041bfbbd2403997a9a7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -127,11 +127,11 @@
|
||||
"nixpkgs-src": "nixpkgs-src"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1786472144,
|
||||
"narHash": "sha256-W1wLGKZKGtnTWGRFgjbsVQleuO6jgMweaSAbFltLkN0=",
|
||||
"lastModified": 1787753358,
|
||||
"narHash": "sha256-Tl77VbWyAKrOfRNQhL6JbQtb/MLzbYa/1RG1gWWfICk=",
|
||||
"owner": "cachix",
|
||||
"repo": "devenv-nixpkgs",
|
||||
"rev": "ea21d30f66a051c7cd750692a2af8d56e0ec4bfb",
|
||||
"rev": "256551e45f6303e142ab4a98be1bf243feb77dc0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
@@ -11,6 +10,5 @@
|
||||
enable = true;
|
||||
requirements = ./requirements.txt;
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
@@ -37,6 +37,7 @@ INSTALLED_APPS = [
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'post_office',
|
||||
'portfolio'
|
||||
]
|
||||
|
||||
@@ -48,6 +49,7 @@ MIDDLEWARE = [
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
"whitenoise.middleware.WhiteNoiseMiddleware",
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'patrickcanal_it.urls'
|
||||
@@ -114,6 +116,12 @@ USE_I18N = True
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
STATIC_ROOT = BASE_DIR / "wholestatic"
|
||||
|
||||
try:
|
||||
from patrickcanal_it.local_settings import *
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/6.1/howto/static-files/
|
||||
@@ -121,14 +129,23 @@ USE_TZ = True
|
||||
STATIC_URL = 'static/'
|
||||
STATICFILES_DIRS = [
|
||||
BASE_DIR / "static/",
|
||||
BASE_DIR / "uploads/",
|
||||
]
|
||||
|
||||
MEDIA_URL = "/uploads/"
|
||||
MEDIA_ROOT = BASE_DIR / "uploads/"
|
||||
|
||||
# Email
|
||||
# https://docs.djangoproject.com/en/6.1/topics/email/#topic-email-configuration
|
||||
EMAIL_BACKEND = 'post_office.EmailBackend'
|
||||
# TODO: Replace old mail backend with new once post_office supports it
|
||||
# MAILERS = {
|
||||
# 'default': {
|
||||
# 'BACKEND': 'post_office.EmailBackend',
|
||||
# },
|
||||
# 'smtp': {
|
||||
# 'BACKEND': 'django.core.mail.backends.smtp.EmailBackend',
|
||||
# 'OPTIONS': {'host': MAILER_HOST, 'port': 587},
|
||||
# },
|
||||
# }
|
||||
# POST_OFFICE = {'DEFAULT_MAILER': 'smtp'}
|
||||
|
||||
MAILERS = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.mail.backends.console.EmailBackend',
|
||||
},
|
||||
}
|
||||
@@ -11,10 +11,11 @@
|
||||
<link rel="stylesheet" href="{% static 'fontawesome-7/css/all.min.css' %}">
|
||||
<script src="{% static 'tabler/tabler.min.js' %}"></script>
|
||||
<script src="{% static 'tailwindcss/tailwindcss.min.js' %}"></script>
|
||||
<script src="{% static 'htmx/htmx.min.js' %}"></script>
|
||||
</head>
|
||||
<body class="d-flex flex-column">
|
||||
<header class="navbar navbar-expand-md d-print-none">
|
||||
<div class="container-xl">
|
||||
<div class="container-xl d-flex justify-content-between">
|
||||
<button class="navbar-toggler"
|
||||
type="button"
|
||||
data-bs-toggle="collapse"
|
||||
@@ -42,6 +43,18 @@
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% if request.user.is_superuser %}
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a href="{% url 'admin:index' %}" class="nav-link">
|
||||
<span class="nav-link-icon">
|
||||
<i class="fa-solid fa-screwdriver-wrench"></i>
|
||||
</span>
|
||||
<span class="nav-link-title">{% trans "Admin" %}</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</header>
|
||||
<main class="mb-2">
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
from django import forms
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
|
||||
class TablerEmailInput(forms.EmailInput):
|
||||
def __init__(self, *args, **kwargs):
|
||||
attrs = kwargs.setdefault("attrs", {})
|
||||
attrs.update(
|
||||
{
|
||||
"class": "form-control",
|
||||
"placeholder": "example@mail.com",
|
||||
"autocomplete": "off",
|
||||
"minlength": "4",
|
||||
}
|
||||
)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
|
||||
class TablerTextInput(forms.TextInput):
|
||||
def __init__(self, placeholder=None, *args, **kwargs):
|
||||
attrs = kwargs.setdefault("attrs", {})
|
||||
attrs.update(
|
||||
{
|
||||
"class": "form-control",
|
||||
"placeholder": placeholder,
|
||||
"autocomplete": "off",
|
||||
"minlength": "4",
|
||||
}
|
||||
)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
|
||||
class TablerTextArea(forms.Textarea):
|
||||
def __init__(self, placeholder=None, *args, **kwargs):
|
||||
attrs = kwargs.setdefault("attrs", {})
|
||||
attrs.update(
|
||||
{
|
||||
"class": "form-control",
|
||||
"placeholder": placeholder,
|
||||
"autocomplete": "off",
|
||||
"minlength": "4",
|
||||
}
|
||||
)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
|
||||
class ContactForm(forms.Form):
|
||||
email = forms.EmailField(max_length=50, min_length=4, widget=TablerEmailInput())
|
||||
subject = forms.CharField(
|
||||
max_length=200,
|
||||
min_length=4,
|
||||
widget=TablerTextInput(placeholder=_("Your message")),
|
||||
)
|
||||
message = forms.CharField(max_length=5000, min_length=10, widget=TablerTextArea())
|
||||
@@ -0,0 +1,8 @@
|
||||
{% extends "base.html" %}
|
||||
{% load i18n static %}
|
||||
{% block content %}
|
||||
<div class="container mt-4 fs-2">
|
||||
<div>{% trans "Thanks for contacting me!" %}</div>
|
||||
<a href="{% url 'index' %}" class="btn btn-primary mt-4">{% trans "Go back" %}</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "base.html" %}
|
||||
{% load i18n static %}
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="container px-4 px-md-0">
|
||||
<div class="row mb-4">
|
||||
<div class="col">
|
||||
<div class="text-center mt-4">
|
||||
@@ -16,26 +16,26 @@
|
||||
</div>
|
||||
<div class="mb-4 text-center">
|
||||
<div class="mb-2">
|
||||
<span class="badge bg-blue-lt fs-4 me-2">Python</span>
|
||||
<span class="badge bg-blue-lt fs-4 me-2">Django</span>
|
||||
<span class="badge bg-blue-lt fs-4 me-2">JavaScript/TypeScript</span>
|
||||
<span class="badge bg-blue-lt fs-4 me-2">HTML/CSS</span>
|
||||
<span class="badge bg-blue-lt fs-4 m-1">Python</span>
|
||||
<span class="badge bg-blue-lt fs-4 m-1">Django</span>
|
||||
<span class="badge bg-blue-lt fs-4 m-1">JavaScript/TypeScript</span>
|
||||
<span class="badge bg-blue-lt fs-4 m-1">HTML/CSS</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="badge bg-blue-lt fs-4 me-2">Docker</span>
|
||||
<span class="badge bg-blue-lt fs-4 me-2">Git</span>
|
||||
<span class="badge bg-blue-lt fs-4 me-2">Linux</span>
|
||||
<span class="badge bg-blue-lt fs-4">NixOS</span>
|
||||
<span class="badge bg-blue-lt fs-4 m-1">Docker</span>
|
||||
<span class="badge bg-blue-lt fs-4 m-1">Git</span>
|
||||
<span class="badge bg-blue-lt fs-4 m-1">Linux</span>
|
||||
<span class="badge bg-blue-lt fs-4 m-1">NixOS</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<a href="{% url 'projects' %}" class="btn btn-primary btn-lg me-2">My projects</a>
|
||||
<a href="" class="btn btn-outline-secondary btn-lg">Contact me</a>
|
||||
<a href="#contact-me" class="btn btn-outline-secondary btn-lg">Contact me</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row row-deck row-cards">
|
||||
<div class="col-md-4">
|
||||
<div class="card h-full">
|
||||
<div class="card-body d-flex align-items-center flex-column">
|
||||
<div class="w-24 h-30">
|
||||
@@ -50,7 +50,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="col-md-4">
|
||||
<div class="card h-full">
|
||||
<div class="card-body d-flex align-items-center flex-column">
|
||||
<div class="w-24 h-30">
|
||||
@@ -66,7 +66,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="col-md-4">
|
||||
<div class="card h-full">
|
||||
<div class="card-body d-flex align-items-center flex-column">
|
||||
<div class="w-24 h-30 text-5xl pt-4">
|
||||
@@ -90,7 +90,7 @@
|
||||
{% for je in job_experiences %}
|
||||
<li class="timeline-event">
|
||||
<div class="timeline-event-icon bg-primary">
|
||||
<img src="{{ je.company.logo.url }}" alt="">
|
||||
<img src="{% url 'company-logo' pk=je.company.pk %}" alt="">
|
||||
</div>
|
||||
<div class="timeline-event-card card">
|
||||
<div class="card-body">
|
||||
@@ -111,5 +111,35 @@
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="hr"></div>
|
||||
<div class="row d-flex justify-content-center mb-md-4">
|
||||
<div class="card col-md-6" id="contact-me">
|
||||
<div class="card-body">
|
||||
<h3 class="card-title fs-2">
|
||||
<b>
|
||||
<i class="fa-solid fa-envelope"></i>
|
||||
{% trans "Contact me" %}
|
||||
</b>
|
||||
</h3>
|
||||
<form action="{% url 'contact' %}" method="post" id="contact-form">
|
||||
{% csrf_token %}
|
||||
{% for field in contact_form %}
|
||||
<div class="form-floating mb-2">
|
||||
{{ field }}
|
||||
<label for="{{ field.id }}">{{ field.label }}</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="d-flex justify-content-end">
|
||||
<button class="btn btn-primary" type="submit">{% trans "Send" %}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
textarea {
|
||||
height: 10rem !important;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
@@ -6,7 +6,9 @@
|
||||
{% for project in object_list %}
|
||||
<div class="col-md-4">
|
||||
{% if project.url %}
|
||||
<a class="card card-link card-link-pop" href="{{ project.url }}">
|
||||
<a class="card card-link card-link-pop"
|
||||
href="{{ project.url }}"
|
||||
target="_blank">
|
||||
<div class="card-body">
|
||||
<h4>{{ project.name }}</h4>
|
||||
<p>{{ project.short_description }}</p>
|
||||
|
||||
@@ -5,4 +5,6 @@ from portfolio import views
|
||||
urlpatterns = [
|
||||
path("", views.PortfolioView.as_view(), name="portfolio"),
|
||||
path("projects/", views.ProjectList.as_view(), name="projects"),
|
||||
path("contact/", views.ContactSend.as_view(), name="contact"),
|
||||
path("company/<int:pk>/logo/", views.CompanyLogo.as_view(), name="company-logo"),
|
||||
]
|
||||
+37
-3
@@ -1,17 +1,51 @@
|
||||
from django.views.generic import ListView, TemplateView
|
||||
from django.conf import settings
|
||||
from django.http.response import FileResponse, HttpResponseBadRequest
|
||||
from django.utils.translation import gettext as _
|
||||
from django.views.generic import DetailView, ListView, TemplateView
|
||||
from post_office import mail
|
||||
|
||||
from portfolio import models
|
||||
from portfolio import forms, models
|
||||
|
||||
|
||||
class PortfolioView(TemplateView):
|
||||
template_name = "index.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
contact_form = forms.ContactForm()
|
||||
return {
|
||||
"job_experiences": models.JobExperience.objects.all().order_by("-start")
|
||||
"job_experiences": models.JobExperience.objects.all().order_by("-start"),
|
||||
"contact_form": contact_form,
|
||||
}
|
||||
|
||||
|
||||
class ProjectList(ListView):
|
||||
template_name = "project_list.html"
|
||||
model = models.Project
|
||||
|
||||
|
||||
class ContactSend(TemplateView):
|
||||
template_name = "contact_thanks.html"
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
form = forms.ContactForm(request.POST)
|
||||
|
||||
if not form.is_valid():
|
||||
return HttpResponseBadRequest(_("Invalid request"))
|
||||
|
||||
mail.send(
|
||||
subject=form.cleaned_data["subject"],
|
||||
message=form.cleaned_data["message"],
|
||||
sender=settings.EMAIL_HOST_USER,
|
||||
cc=form.cleaned_data["email"],
|
||||
recipients=[settings.EMAIL_CONTACT],
|
||||
)
|
||||
|
||||
return super().get(request, *args, **kwargs)
|
||||
|
||||
|
||||
class CompanyLogo(DetailView):
|
||||
model = models.Company
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
company = self.get_object()
|
||||
return FileResponse(company.logo)
|
||||
@@ -1,2 +1,5 @@
|
||||
django
|
||||
djlint
|
||||
django-post_office
|
||||
gunicorn
|
||||
whitenoise
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
var htmx=function(){"use strict";const Q={onLoad:null,process:null,on:null,off:null,trigger:null,ajax:null,find:null,findAll:null,closest:null,values:function(e,t){const n=dn(e,t||"post");return n.values},remove:null,addClass:null,removeClass:null,toggleClass:null,takeClass:null,swap:null,defineExtension:null,removeExtension:null,logAll:null,logNone:null,logger:null,config:{historyEnabled:true,historyCacheSize:10,refreshOnHistoryMiss:false,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:true,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:true,allowScriptTags:true,inlineScriptNonce:"",inlineStyleNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:false,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",scrollBehavior:"instant",defaultFocusScroll:false,getCacheBusterParam:false,globalViewTransitions:false,methodsThatUseUrlParams:["get","delete"],selfRequestsOnly:true,ignoreTitle:false,scrollIntoViewOnBoost:true,triggerSpecsCache:null,disableInheritance:false,responseHandling:[{code:"204",swap:false},{code:"[23]..",swap:true},{code:"[45]..",swap:false,error:true}],allowNestedOobSwaps:true,historyRestoreAsHxRequest:true,reportValidityOfForms:false},parseInterval:null,location:location,_:null,version:"2.0.10"};Q.onLoad=j;Q.process=Ft;Q.on=ye;Q.off=xe;Q.trigger=ae;Q.ajax=Nn;Q.find=f;Q.findAll=y;Q.closest=g;Q.remove=z;Q.addClass=w;Q.removeClass=b;Q.toggleClass=G;Q.takeClass=W;Q.swap=_e;Q.defineExtension=_n;Q.removeExtension=zn;Q.logAll=$;Q.logNone=_;Q.parseInterval=d;Q._=e;const n={addTriggerHandler:St,bodyContains:se,canAccessLocalStorage:U,findThisElement:we,filterValues:yn,swap:_e,hasAttribute:s,getAttributeValue:a,getClosestAttributeValue:ne,getClosestMatch:A,getExpressionVars:Rn,getHeaders:mn,getInputValues:dn,getInternalData:oe,getSwapSpecification:bn,getTriggerSpecs:st,getTarget:Se,makeFragment:P,mergeObjects:le,makeSettleInfo:Sn,oobSwap:He,querySelectorExt:ce,settleImmediately:Yt,shouldCancel:ht,triggerEvent:ae,triggerErrorEvent:fe,withExtensions:Vt};const de=["get","post","put","delete","patch"];const R=de.map(function(e){return"[hx-"+e+"], [data-hx-"+e+"]"}).join(", ");function d(e){if(e==undefined){return undefined}let t=NaN;if(e.slice(-2)=="ms"){t=parseFloat(e.slice(0,-2))}else if(e.slice(-1)=="s"){t=parseFloat(e.slice(0,-1))*1e3}else if(e.slice(-1)=="m"){t=parseFloat(e.slice(0,-1))*1e3*60}else{t=parseFloat(e)}return isNaN(t)?undefined:t}function ee(e,t){return e instanceof Element&&e.getAttribute(t)}function s(e,t){return!!e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function a(e,t){return ee(e,t)||ee(e,"data-"+t)}function c(e){const t=e.parentElement;if(!t&&e.parentNode instanceof ShadowRoot)return e.parentNode;return t}function te(){return document}function q(e,t){return e.getRootNode?e.getRootNode({composed:t}):te()}function A(e,t){while(e&&!t(e)){e=c(e)}return e||null}function o(e,t,n){const r=a(t,n);const o=a(t,"hx-disinherit");var i=a(t,"hx-inherit");if(e!==t){if(Q.config.disableInheritance){if(i&&(i==="*"||i.split(" ").indexOf(n)>=0)){return r}else{return null}}if(o&&(o==="*"||o.split(" ").indexOf(n)>=0)){return"unset"}}return r}function ne(t,n){let r=null;A(t,function(e){return!!(r=o(t,ue(e),n))});if(r!=="unset"){return r}}function h(e,t){return e instanceof Element&&e.matches(t)}function N(e){const t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i;const n=t.exec(e);if(n){return n[1].toLowerCase()}else{return""}}function I(e){if("parseHTMLUnsafe"in Document){return Document.parseHTMLUnsafe(e)}const t=new DOMParser;return t.parseFromString(e,"text/html")}function L(e,t){while(t.childNodes.length>0){e.append(t.childNodes[0])}}function r(e){const t=te().createElement("script");ie(e.attributes,function(e){t.setAttribute(e.name,e.value)});t.textContent=e.textContent;t.async=false;if(Q.config.inlineScriptNonce){t.nonce=Q.config.inlineScriptNonce}return t}function i(e){return e.matches("script")&&(e.type==="text/javascript"||e.type==="module"||e.type==="")}function D(e){Array.from(e.querySelectorAll("script")).forEach(e=>{if(i(e)){const t=r(e);const n=e.parentNode;try{n.insertBefore(t,e)}catch(e){H(e)}finally{e.remove()}}})}function P(e){const t=e.replace(/<head(\s[^>]*)?>[\s\S]*?<\/head>/i,"");const n=N(t);let r;if(n==="html"){r=new DocumentFragment;const i=I(e);L(r,i.body);r.title=i.title}else if(n==="body"){r=new DocumentFragment;const i=I(t);L(r,i.body);r.title=i.title}else{const i=I('<body><template class="internal-htmx-wrapper">'+t+"</template></body>");r=i.querySelector("template").content;r.title=i.title;var o=r.querySelector("title");if(o&&o.parentNode===r){o.remove();r.title=o.innerText}}if(r){if(Q.config.allowScriptTags){D(r)}else{r.querySelectorAll("script").forEach(e=>e.remove())}}return r}function re(e){if(e){e()}}function t(e,t){return Object.protLine truncated
|
||||
Reference in new issue
Block a user