From 478e7ae32031fef328833189aec6860fcad7244c Mon Sep 17 00:00:00 2001 From: adinhodovic Date: Tue, 12 Sep 2023 22:57:09 +0200 Subject: [PATCH 1/3] feat: Made icons for blocks not required Improve css and visual look of resume --- pyproject.toml | 4 +- wagtail_resume/blocks.py | 8 +- ...0011_baseresumepage_about_icon_and_more.py | 313 ++++++++++++++++++ wagtail_resume/models.py | 4 + .../static/wagtail_resume/css/resume_page.css | 44 ++- .../blocks/contributions_block.html | 6 +- .../blocks/education_block.html | 6 +- .../blocks/work_experience_block.html | 26 +- .../wagtail_resume/blocks/writings_block.html | 6 +- .../wagtail_resume/resume_page_body.html | 10 +- 10 files changed, 391 insertions(+), 36 deletions(-) create mode 100644 wagtail_resume/migrations/0011_baseresumepage_about_icon_and_more.py diff --git a/pyproject.toml b/pyproject.toml index 7a8d87c..413ae71 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,8 +62,8 @@ pylint = "^2.17.5" pylint-django = "^2.5.3" [build-system] -requires = ["poetry>=0.12"] -build-backend = "poetry.masonry.api" +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" [tool.isort] skip_glob = "**/migrations/*.py,**/fixtures/*.py" diff --git a/wagtail_resume/blocks.py b/wagtail_resume/blocks.py index 8bdf049..4d0b77d 100644 --- a/wagtail_resume/blocks.py +++ b/wagtail_resume/blocks.py @@ -9,7 +9,7 @@ class Meta: icon = "doc-full-inverse" heading = blocks.CharBlock(default="Work experience") - fa_icon = blocks.CharBlock(default="fas fa-tools") + fa_icon = blocks.CharBlock(default="fas fa-tools", required=False) experiences = blocks.ListBlock( blocks.StructBlock( [ @@ -39,7 +39,7 @@ class Meta: icon = "edit" heading = blocks.CharBlock(default="Writing") - fa_icon = blocks.CharBlock(default="fas fa-pencil-alt") + fa_icon = blocks.CharBlock(default="fas fa-pencil-alt", required=False) posts = blocks.StreamBlock( [ ( @@ -70,7 +70,7 @@ class Meta: icon = "code" heading = blocks.CharBlock(default="Contributions") - fa_icon = blocks.CharBlock(default="fas fa-code-branch") + fa_icon = blocks.CharBlock(default="fas fa-code-branch", required=False) contributions = blocks.ListBlock( blocks.StructBlock( [ @@ -89,7 +89,7 @@ class Meta: icon = "doc-full-inverse" heading = blocks.CharBlock(default="Education") - fa_icon = blocks.CharBlock(default="fas fa-graduation-cap") + fa_icon = blocks.CharBlock(default="fas fa-graduation-cap", required=False) educations = blocks.StreamBlock( [ ( diff --git a/wagtail_resume/migrations/0011_baseresumepage_about_icon_and_more.py b/wagtail_resume/migrations/0011_baseresumepage_about_icon_and_more.py new file mode 100644 index 0000000..f13a03c --- /dev/null +++ b/wagtail_resume/migrations/0011_baseresumepage_about_icon_and_more.py @@ -0,0 +1,313 @@ +# Generated by Django 4.1.2 on 2023-09-12 17:14 + +from django.db import migrations, models +import wagtail.blocks +import wagtail.fields +import wagtailmarkdown.blocks + + +class Migration(migrations.Migration): + + dependencies = [ + ("wagtail_resume", "0010_alter_baseresumepage_resume_and_more"), + ] + + operations = [ + migrations.AddField( + model_name="baseresumepage", + name="about_icon", + field=models.CharField( + blank=True, default="fas fa-tools", max_length=50, null=True + ), + ), + migrations.AlterField( + model_name="baseresumepage", + name="resume", + field=wagtail.fields.StreamField( + [ + ( + "work_experience", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(default="Work experience"), + ), + ( + "fa_icon", + wagtail.blocks.CharBlock( + default="fas fa-tools", required=False + ), + ), + ( + "experiences", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("role", wagtail.blocks.CharBlock()), + ("company", wagtail.blocks.CharBlock()), + ("url", wagtail.blocks.URLBlock()), + ( + "location", + wagtail.blocks.CharBlock( + required=False + ), + ), + ( + "from_date", + wagtail.blocks.DateBlock(), + ), + ( + "to_date", + wagtail.blocks.DateBlock( + required=False + ), + ), + ( + "currently_working_here", + wagtail.blocks.BooleanBlock( + help_text="Check this box if you are currently working here and it will indicate so on the resume.", + required=False, + ), + ), + ( + "text", + wagtailmarkdown.blocks.MarkdownBlock(), + ), + ], + icon="folder-open-inverse", + ) + ), + ), + ] + ), + ), + ( + "contributions", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(default="Contributions"), + ), + ( + "fa_icon", + wagtail.blocks.CharBlock( + default="fas fa-code-branch", required=False + ), + ), + ( + "contributions", + wagtail.blocks.ListBlock( + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.CharBlock()), + ( + "description", + wagtail.blocks.TextBlock(), + ), + ("url", wagtail.blocks.URLBlock()), + ], + icon="folder-open-inverse", + ) + ), + ), + ] + ), + ), + ( + "writing", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(default="Writing"), + ), + ( + "fa_icon", + wagtail.blocks.CharBlock( + default="fas fa-pencil-alt", required=False + ), + ), + ( + "posts", + wagtail.blocks.StreamBlock( + [ + ( + "internal_post", + wagtail.blocks.StructBlock( + [ + ( + "post", + wagtail.blocks.PageChooserBlock(), + ) + ], + icon="doc-full-inverse", + ), + ), + ( + "external_post", + wagtail.blocks.StructBlock( + [ + ( + "title", + wagtail.blocks.CharBlock(), + ), + ( + "url", + wagtail.blocks.URLBlock(), + ), + ( + "date", + wagtail.blocks.DateBlock(), + ), + ], + icon="doc-full-inverse", + ), + ), + ], + icon="folder-open-inverse", + ), + ), + ] + ), + ), + ( + "education", + wagtail.blocks.StructBlock( + [ + ( + "heading", + wagtail.blocks.CharBlock(default="Education"), + ), + ( + "fa_icon", + wagtail.blocks.CharBlock( + default="fas fa-graduation-cap", required=False + ), + ), + ( + "educations", + wagtail.blocks.StreamBlock( + [ + ( + "degree", + wagtail.blocks.StructBlock( + [ + ( + "degree", + wagtail.blocks.CharBlock( + default="Bachelor's degree" + ), + ), + ( + "field_of_study", + wagtail.blocks.CharBlock( + default="Computer Software Engineering" + ), + ), + ( + "degree_url", + wagtail.blocks.URLBlock(), + ), + ( + "university_name", + wagtail.blocks.CharBlock(), + ), + ( + "university_url", + wagtail.blocks.URLBlock(), + ), + ( + "studies_starting_date", + wagtail.blocks.DateBlock( + help_text="The year will only be displayed in the resume" + ), + ), + ( + "studies_ending_date", + wagtail.blocks.DateBlock( + help_text="The year will only be displayed in the resume" + ), + ), + ], + icon="doc-full-inverse", + ), + ), + ( + "certificate", + wagtail.blocks.StructBlock( + [ + ( + "name", + wagtail.blocks.CharBlock(), + ), + ( + "certificate_url", + wagtail.blocks.URLBlock(), + ), + ( + "studies_starting_date", + wagtail.blocks.DateBlock( + help_text="The year and month will only be displayed in the resume" + ), + ), + ( + "studies_ending_date", + wagtail.blocks.DateBlock( + help_text="The year and month will only be displayed in the resume" + ), + ), + ( + "institute_name", + wagtail.blocks.CharBlock(), + ), + ( + "institute_url", + wagtail.blocks.URLBlock(), + ), + ], + icon="doc-full-inverse", + ), + ), + ( + "course", + wagtail.blocks.StructBlock( + [ + ( + "name", + wagtail.blocks.CharBlock(), + ), + ( + "course_url", + wagtail.blocks.URLBlock(), + ), + ( + "studies_starting_date", + wagtail.blocks.DateBlock( + help_text="The year and month will only be displayed in the resume" + ), + ), + ( + "studies_ending_date", + wagtail.blocks.DateBlock( + help_text="The year and month will only be displayed in the resume" + ), + ), + ], + icon="doc-full-inverse", + ), + ), + ] + ), + ), + ] + ), + ), + ], + blank=True, + null=True, + use_json_field=True, + ), + ), + ] diff --git a/wagtail_resume/models.py b/wagtail_resume/models.py index dc8d2bf..c7a4c36 100644 --- a/wagtail_resume/models.py +++ b/wagtail_resume/models.py @@ -45,6 +45,9 @@ class BaseResumePage(MetadataMixin, Page): role = models.CharField(max_length=100, null=True, blank=True) about = MarkdownField(max_length=2500, null=True, blank=True) + about_icon = models.CharField( + max_length=50, default="fas fa-tools", null=True, blank=True + ) photo = models.ForeignKey( Image, null=True, blank=True, on_delete=models.SET_NULL, related_name="+" ) @@ -93,6 +96,7 @@ class BaseResumePage(MetadataMixin, Page): FieldPanel("full_name"), FieldPanel("role"), MarkdownPanel("about"), + FieldPanel("about_icon"), FieldPanel("photo"), FieldPanel("social_links"), ], diff --git a/wagtail_resume/static/wagtail_resume/css/resume_page.css b/wagtail_resume/static/wagtail_resume/css/resume_page.css index 57c3b64..cf4d135 100644 --- a/wagtail_resume/static/wagtail_resume/css/resume_page.css +++ b/wagtail_resume/static/wagtail_resume/css/resume_page.css @@ -4,23 +4,36 @@ body { } p { - line-height: 1.4; - font-size: 0.95rem + line-height: 1.5; + font-size: 1rem } h2 { - font-weight: 400; - font-size: 1.7rem; + font-weight: 600; + font-size: 1.3rem; } -h4 { - font-size: 1.4rem; - font-weight: 400; +hr { + border-color: #fdfcfc; + border-width: 0.1px; + margin-top: 1rem; + margin-bottom: 1rem; } -.role { - margin-top: 0; - margin-bottom: 0.5rem; +.mt-0 { + margin-top: 0rem; +} + +.mb-0 { + margin-bottom: 0rem; +} + +.mt-1 { + margin-top: 0.25rem; +} + +.mb-1 { + margin-bottom: 0.25rem; } .name { @@ -37,7 +50,7 @@ h4 { } .work-experience-heading, .contribution-title { - font-size: 1.05rem; + font-size: 1.10rem; } .resume { @@ -53,7 +66,7 @@ img { } a { - color: #007bff; + color: #4652F6; text-decoration: none; background-color: transparent; } @@ -89,8 +102,7 @@ a { } .date { - color: grey; - font-size: 0.8rem; + color: #5b5b55; } .text { @@ -98,8 +110,8 @@ a { } .section-title { - padding-bottom: 1rem; - border-bottom: 1px solid #B0B0B0; + margin-top: 2rem; + margin-bottom: 0rem; align-items: center; } diff --git a/wagtail_resume/templates/wagtail_resume/blocks/contributions_block.html b/wagtail_resume/templates/wagtail_resume/blocks/contributions_block.html index 5a56ca7..6211576 100644 --- a/wagtail_resume/templates/wagtail_resume/blocks/contributions_block.html +++ b/wagtail_resume/templates/wagtail_resume/blocks/contributions_block.html @@ -1,6 +1,10 @@ {% load wagtailcore_tags %} -

{{ value.heading }}

+

+ {% if value.fa_icon %}{% endif %} + {{ value.heading }} +

+