From aa9e60ca9d3b8154c3306bdcc35bb09ba96d7b62 Mon Sep 17 00:00:00 2001 From: Mario Sergio Date: Fri, 17 May 2024 15:30:54 -0300 Subject: [PATCH] fix(ds): layout adjusts --- .../admin/filer/widgets/admin_file.html | 6 ++-- .../0009_alter_block_background_size.py | 18 +++++++++++ app/contrib/ds/blocks/models.py | 8 +++-- .../templates/blocks/plugin/change_form.html | 31 +++++++++++++++---- app/contrib/ds/static/ds/css/input_file.scss | 11 ++++++- 5 files changed, 62 insertions(+), 12 deletions(-) create mode 100644 app/contrib/ds/blocks/migrations/0009_alter_block_background_size.py diff --git a/app/contrib/ds/admin_style/templates/admin/filer/widgets/admin_file.html b/app/contrib/ds/admin_style/templates/admin/filer/widgets/admin_file.html index e32b6056..bddcfecb 100644 --- a/app/contrib/ds/admin_style/templates/admin/filer/widgets/admin_file.html +++ b/app/contrib/ds/admin_style/templates/admin/filer/widgets/admin_file.html @@ -20,7 +20,7 @@ {% if max_filesize %}}data-max-filesize="{{ max_filesize|safe }}"{% endif %}>
- {% translate "or drop your file here" %} + Selecione um arquivo ou arraste-o para cá
@@ -51,14 +51,16 @@
+ {% if object.file.exists %} + {% endif %} - {% translate 'Choose File' %} + Selecione arquivo
diff --git a/app/contrib/ds/blocks/migrations/0009_alter_block_background_size.py b/app/contrib/ds/blocks/migrations/0009_alter_block_background_size.py new file mode 100644 index 00000000..0644c927 --- /dev/null +++ b/app/contrib/ds/blocks/migrations/0009_alter_block_background_size.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2 on 2024-05-17 18:02 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('blocks', '0008_alter_block_background_size'), + ] + + operations = [ + migrations.AlterField( + model_name='block', + name='background_size', + field=models.CharField(choices=[('cover', 'Preencher Área'), ('contain', 'Redimensionar'), ('initial', 'Tamanho Original')], default='cover', help_text='Escolha como a imagem de fundo deve ser exibida', max_length=8, verbose_name='Tamanho'), + ), + ] diff --git a/app/contrib/ds/blocks/models.py b/app/contrib/ds/blocks/models.py index 883aec7f..c898e85e 100644 --- a/app/contrib/ds/blocks/models.py +++ b/app/contrib/ds/blocks/models.py @@ -44,9 +44,9 @@ class BlockLayout(models.TextChoices): flex = "d-flex", _("Flexível") class BackgroundSize(models.TextChoices): - contain = "contain" - cover = "cover" - initial = "initial" + cover = "cover", _("Preencher Área") + contain = "contain", _("Redimensionar") + initial = "initial", _("Tamanho Original") class BlockAbstractModel(models.Model): @@ -88,6 +88,8 @@ class BlockAbstractModel(models.Model): on_delete=models.SET_NULL, ) background_size = models.CharField( + verbose_name=_("Tamanho"), + help_text=_("Escolha como a imagem de fundo deve ser exibida"), choices=BackgroundSize.choices, max_length=8, default=BackgroundSize.cover diff --git a/app/contrib/ds/blocks/templates/blocks/plugin/change_form.html b/app/contrib/ds/blocks/templates/blocks/plugin/change_form.html index c2c85a04..6a9f6df7 100644 --- a/app/contrib/ds/blocks/templates/blocks/plugin/change_form.html +++ b/app/contrib/ds/blocks/templates/blocks/plugin/change_form.html @@ -128,15 +128,34 @@

Estrutura

{{ field.help_text }} - {{field}} + {{field}}
{% endwith %} {% with field=adminform.form.background_size %} -
- - {{ field.help_text }} - {{field}} -
+
+ + {{ field.help_text }} +
+ {% with choice=field.field.choices.0 %} +
+ + +
+ {% endwith %} + {% with choice=field.field.choices.1 %} +
+ + +
+ {% endwith %} + {% with choice=field.field.choices.2 %} +
+ + +
+ {% endwith %} +
+
{% endwith %} {% with field=adminform.form.background_color %}
diff --git a/app/contrib/ds/static/ds/css/input_file.scss b/app/contrib/ds/static/ds/css/input_file.scss index 71790ad2..ef5e5e35 100644 --- a/app/contrib/ds/static/ds/css/input_file.scss +++ b/app/contrib/ds/static/ds/css/input_file.scss @@ -23,10 +23,19 @@ .file-controls { display: flex; flex-direction: row; + --dca-primary: blue; } .file-desc-object { display: flex; flex-direction: row; gap: 10px; -} \ No newline at end of file +} + +.text-input-file { + max-width: 100%; + font-size: 1em; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } \ No newline at end of file