Skip to content

Commit

Permalink
Fixed #344: removed branding_css
Browse files Browse the repository at this point in the history
  • Loading branch information
rgaudin committed Jan 3, 2024
1 parent f28b0ea commit d827cbb
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
1 change: 0 additions & 1 deletion manager/manager/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class ConfigLike:
admin_password: str = "admin-password"
branding_logo: str = ""
branding_favicon: str = ""
branding_css: str = ""
content_zims: list[str] = field(default_factory=list) # parsed json
content_wikifundi_fr: bool = False
content_wikifundi_en: bool = False
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated by Django 4.2.5 on 2024-01-03 14:25

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("manager", "0023_configuration_content_metrics"),
]

operations = [
migrations.RemoveField(
model_name="configuration",
name="branding_css",
),
]
10 changes: 1 addition & 9 deletions manager/manager/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,6 @@ class Meta:
upload_to=get_branding_path,
verbose_name=_lz("Favicon (1MB max Image)"),
)
branding_css = models.FileField(
blank=True,
null=True,
upload_to=get_branding_path,
verbose_name=_lz("CSS File"),
)

content_zims = models.JSONField(
blank=True,
Expand Down Expand Up @@ -419,7 +413,6 @@ def create_from(cls, config, author):
"branding_favicon": save_branding_file(favicon)
if favicon is not None
else None,
"branding_css": save_branding_file(css) if css is not None else None,
"content_zims": packages_list,
"content_wikifundi_fr": "fr" in wikifundi_langs,
"content_wikifundi_en": "en" in wikifundi_langs,
Expand All @@ -445,7 +438,7 @@ def create_from(cls, config, author):
logger.warn(exp)

# remove saved branding files
for key in ("branding_logo", "branding_favicon", "branding_css"):
for key in ("branding_logo", "branding_favicon"):
if kwargs.get(key):
try:
Path(settings.MEDIA_ROOT).joinpath(kwargs.get(key))
Expand Down Expand Up @@ -593,7 +586,6 @@ def to_dict(self):
[
("logo", retrieve_branding_file(self.branding_logo)),
("favicon", retrieve_branding_file(self.branding_favicon)),
("css", retrieve_branding_file(self.branding_css)),
]
),
),
Expand Down
5 changes: 1 addition & 4 deletions manager/manager/templates/configuration_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,10 @@ <h3>{% blocktrans %}Branding{% endblocktrans %}</h3>
<h4>{% blocktrans %}Advanced Branding{% endblocktrans %}</h4>
<p>{% blocktrans %}Change <em>favicon</em> and <em>CSS</em> only of you know what you are doing.{% endblocktrans %}</p>
<div class="form-row visual-group">
<div class="form-group col-md-6">
<div class="form-group">
{% include "_input_field.html" with field=form.branding_favicon type=file use_raw=1 %}
{% include "_file_preview.html" with field=form.branding_favicon class="favicon" %}
</div>
<div class="form-group col-md-6">
{% include "_input_field.html" with field=form.branding_css type=file use_raw=1 %}
</div>
</div>

</div>
Expand Down
6 changes: 0 additions & 6 deletions manager/manager/views/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class Meta:
"admin_password",
"branding_logo",
"branding_favicon",
"branding_css",
"content_zims",
"content_wikifundi_fr",
"content_wikifundi_en",
Expand All @@ -58,11 +57,6 @@ class Meta:
"content_africatikmd",
"content_metrics",
]
widgets = { # noqa: RUF012
"branding_css": forms.ClearableFileInput(
attrs={"accept": "text/css,text/plain"}
),
}


def handle_uploaded_json(fd):
Expand Down

0 comments on commit d827cbb

Please sign in to comment.