[widgets] Add widget css customization
This commit is contained in:
@ -33,6 +33,7 @@ class UserProfileForm(forms.ModelForm):
|
|||||||
"ntfy_enabled",
|
"ntfy_enabled",
|
||||||
"redirect_to_webpage",
|
"redirect_to_webpage",
|
||||||
"enable_public_widgets",
|
"enable_public_widgets",
|
||||||
|
"widget_custom_css",
|
||||||
]
|
]
|
||||||
widgets = {
|
widgets = {
|
||||||
"lastfm_password": forms.PasswordInput(render_value=True),
|
"lastfm_password": forms.PasswordInput(render_value=True),
|
||||||
|
|||||||
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 4.2.29 on 2026-03-20 17:23
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("profiles", "0029_userprofile_enable_public_widgets"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="userprofile",
|
||||||
|
name="widget_custom_css",
|
||||||
|
field=models.TextField(blank=True, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
@ -62,6 +62,7 @@ class UserProfile(TimeStampedModel):
|
|||||||
redirect_to_webpage = models.BooleanField(default=True)
|
redirect_to_webpage = models.BooleanField(default=True)
|
||||||
|
|
||||||
enable_public_widgets = models.BooleanField(default=False)
|
enable_public_widgets = models.BooleanField(default=False)
|
||||||
|
widget_custom_css = models.TextField(**BNULL)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"User profile for {self.user}"
|
return f"User profile for {self.user}"
|
||||||
|
|||||||
@ -1037,6 +1037,7 @@ class EmbeddableTopArtistWidget(TemplateView):
|
|||||||
raise Http404("Public widgets are not enabled for this user")
|
raise Http404("Public widgets are not enabled for this user")
|
||||||
|
|
||||||
context["user"] = user
|
context["user"] = user
|
||||||
|
context["custom_css"] = profile.widget_custom_css
|
||||||
|
|
||||||
artist = {
|
artist = {
|
||||||
"user": user,
|
"user": user,
|
||||||
@ -1071,6 +1072,7 @@ class EmbeddableTopBoardGamesMonthWidget(TemplateView):
|
|||||||
raise Http404("Public widgets are not enabled for this user")
|
raise Http404("Public widgets are not enabled for this user")
|
||||||
|
|
||||||
context["user"] = user
|
context["user"] = user
|
||||||
|
context["custom_css"] = profile.widget_custom_css
|
||||||
|
|
||||||
now = timezone.now()
|
now = timezone.now()
|
||||||
if user.is_authenticated:
|
if user.is_authenticated:
|
||||||
@ -1117,6 +1119,7 @@ class EmbeddableTopBoardGamesWeekWidget(TemplateView):
|
|||||||
raise Http404("Public widgets are not enabled for this user")
|
raise Http404("Public widgets are not enabled for this user")
|
||||||
|
|
||||||
context["user"] = user
|
context["user"] = user
|
||||||
|
context["custom_css"] = profile.widget_custom_css
|
||||||
|
|
||||||
now = timezone.now()
|
now = timezone.now()
|
||||||
if user.is_authenticated:
|
if user.is_authenticated:
|
||||||
@ -1161,6 +1164,7 @@ class EmbeddableTopBoardGamesYearWidget(TemplateView):
|
|||||||
raise Http404("Public widgets are not enabled for this user")
|
raise Http404("Public widgets are not enabled for this user")
|
||||||
|
|
||||||
context["user"] = user
|
context["user"] = user
|
||||||
|
context["custom_css"] = profile.widget_custom_css
|
||||||
|
|
||||||
now = timezone.now()
|
now = timezone.now()
|
||||||
if user.is_authenticated:
|
if user.is_authenticated:
|
||||||
|
|||||||
@ -185,6 +185,13 @@
|
|||||||
{{ imdb_form }}
|
{{ imdb_form }}
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
<div class="navbar-nav">
|
||||||
|
<div class="nav-item text-nowrap">
|
||||||
|
<a class="nav-link px-3" href="{% url "profiles:profile_settings" %}">Settings</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="navbar-nav">
|
<div class="navbar-nav">
|
||||||
<div class="nav-item text-nowrap">
|
<div class="nav-item text-nowrap">
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
|
|||||||
@ -14,6 +14,9 @@
|
|||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="btn-group me-2">
|
||||||
|
<a href="{% url 'scrobbles:charts-home' %}" class="btn btn-sm btn-outline-secondary">Charts</a>
|
||||||
|
</div>
|
||||||
<div class="btn-group me-2">
|
<div class="btn-group me-2">
|
||||||
<button type="button" class="btn btn-sm btn-outline-secondary" data-bs-toggle="modal"
|
<button type="button" class="btn btn-sm btn-outline-secondary" data-bs-toggle="modal"
|
||||||
data-bs-target="#exportModal">Export</button>
|
data-bs-target="#exportModal">Export</button>
|
||||||
|
|||||||
@ -16,6 +16,9 @@
|
|||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="btn-group me-2">
|
||||||
|
<a href="{% url 'scrobbles:charts-home' %}" class="btn btn-sm btn-outline-secondary">Charts</a>
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="btn-group me-2">
|
<div class="btn-group me-2">
|
||||||
{% if view == 'grid' %}
|
{% if view == 'grid' %}
|
||||||
|
|||||||
@ -57,6 +57,9 @@
|
|||||||
color: #666;
|
color: #666;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
{% if custom_css %}
|
||||||
|
{{ custom_css }}
|
||||||
|
{% endif %}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="vrobbler-widget">
|
<div class="vrobbler-widget">
|
||||||
|
|||||||
@ -57,6 +57,9 @@
|
|||||||
color: #666;
|
color: #666;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
{% if custom_css %}
|
||||||
|
{{ custom_css }}
|
||||||
|
{% endif %}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="vrobbler-widget">
|
<div class="vrobbler-widget">
|
||||||
|
|||||||
@ -57,6 +57,9 @@
|
|||||||
color: #666;
|
color: #666;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
{% if custom_css %}
|
||||||
|
{{ custom_css }}
|
||||||
|
{% endif %}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="vrobbler-widget">
|
<div class="vrobbler-widget">
|
||||||
|
|||||||
@ -57,6 +57,9 @@
|
|||||||
color: #666;
|
color: #666;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
{% if custom_css %}
|
||||||
|
{{ custom_css }}
|
||||||
|
{% endif %}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="vrobbler-widget">
|
<div class="vrobbler-widget">
|
||||||
|
|||||||
@ -95,9 +95,6 @@
|
|||||||
<button type="button" class="btn btn-sm btn-outline-secondary" data-bs-toggle="modal"
|
<button type="button" class="btn btn-sm btn-outline-secondary" data-bs-toggle="modal"
|
||||||
data-bs-target="#exportModal">Export</button>
|
data-bs-target="#exportModal">Export</button>
|
||||||
</div>
|
</div>
|
||||||
{% block charts_button %}
|
|
||||||
<a href="{% url 'scrobbles:charts-home' %}" class="btn btn-sm btn-outline-secondary">Charts</a>
|
|
||||||
{% endblock %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<button type="button" class="btn btn-sm btn-outline-secondary dropdown-toggle" id="graphDateButton"
|
<button type="button" class="btn btn-sm btn-outline-secondary dropdown-toggle" id="graphDateButton"
|
||||||
|
|||||||
Reference in New Issue
Block a user