aboutsummaryrefslogtreecommitdiffstats
path: root/pyblackbird_cc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pyblackbird_cc/resources/migrations/0012_resourcecategory_colour_css_class.py18
-rw-r--r--pyblackbird_cc/resources/models.py1
-rw-r--r--pyblackbird_cc/resources/views.py2
-rw-r--r--pyblackbird_cc/static/css/custom.css5
-rw-r--r--pyblackbird_cc/static/scss/custom.scss5
-rw-r--r--pyblackbird_cc/templates/resources/resource_list.html4
6 files changed, 33 insertions, 2 deletions
diff --git a/pyblackbird_cc/resources/migrations/0012_resourcecategory_colour_css_class.py b/pyblackbird_cc/resources/migrations/0012_resourcecategory_colour_css_class.py
new file mode 100644
index 0000000..b48ba61
--- /dev/null
+++ b/pyblackbird_cc/resources/migrations/0012_resourcecategory_colour_css_class.py
@@ -0,0 +1,18 @@
+# Generated by Django 5.0.4 on 2024-07-11 15:47
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('resources', '0011_alter_resource_curriculum'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='resourcecategory',
+ name='colour_css_class',
+ field=models.CharField(blank=True, max_length=56, null=True),
+ ),
+ ]
diff --git a/pyblackbird_cc/resources/models.py b/pyblackbird_cc/resources/models.py
index c23fd34..912cd17 100644
--- a/pyblackbird_cc/resources/models.py
+++ b/pyblackbird_cc/resources/models.py
@@ -114,6 +114,7 @@ class ResourceCategory(models.Model):
name = models.CharField(max_length=255, null=False)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
+ colour_css_class = models.CharField(max_length=56, blank=True, null=True)
class Meta:
verbose_name_plural = "Resource Categories"
diff --git a/pyblackbird_cc/resources/views.py b/pyblackbird_cc/resources/views.py
index cf6eb9d..bf1f6ba 100644
--- a/pyblackbird_cc/resources/views.py
+++ b/pyblackbird_cc/resources/views.py
@@ -46,6 +46,7 @@ class ResourceInfo:
description: str
card_description: str
main_resource_category_name: str
+ main_resource_category_colour_css_class: str
additional_resource_category_name: str | None
age_range: str | None
pdf_filenames: list[str]
@@ -108,6 +109,7 @@ def _extract_metadata_from_resource(resource_obj) -> ResourceInfo | None:
description=resource_obj.description,
card_description=resource_obj.card_description,
main_resource_category_name=resource_obj.main_resource_category.name,
+ main_resource_category_colour_css_class=resource_obj.main_resource_category.colour_css_class,
additional_resource_category_name=arc_name,
age_range=resource_obj.age_range,
pdf_filenames=pdf_resource_filenames,
diff --git a/pyblackbird_cc/static/css/custom.css b/pyblackbird_cc/static/css/custom.css
index 342225b..a26cd3c 100644
--- a/pyblackbird_cc/static/css/custom.css
+++ b/pyblackbird_cc/static/css/custom.css
@@ -6182,6 +6182,11 @@ h2, .h2 {
color: #51635e;
}
+.ey_literacy {
+ background-color: #ebde34;
+ color: black;
+}
+
.form-label {
font-weight: 500;
}
diff --git a/pyblackbird_cc/static/scss/custom.scss b/pyblackbird_cc/static/scss/custom.scss
index 5c05488..f565f16 100644
--- a/pyblackbird_cc/static/scss/custom.scss
+++ b/pyblackbird_cc/static/scss/custom.scss
@@ -37,6 +37,11 @@ h2 {
color: $primary;
}
+.ey_literacy {
+ background-color: #ebde34;
+ color: black;
+ }
+
.form-label {
font-weight: $ml-font-label-weight;
}
diff --git a/pyblackbird_cc/templates/resources/resource_list.html b/pyblackbird_cc/templates/resources/resource_list.html
index d33d6bc..13d2a61 100644
--- a/pyblackbird_cc/templates/resources/resource_list.html
+++ b/pyblackbird_cc/templates/resources/resource_list.html
@@ -53,7 +53,7 @@
<h5 class="card-title"><a href="{% url 'resources:resource_detail' resource_id=resource.id %}">{{ resource.name }}</a></h5>
<div class="d-flex flex-row justify-content-start align-content-center">
<div>
- <span class="badge bg-danger me-2">{{ resource.main_resource_category_name }}</span>
+ <span class="badge {{ resource.main_resource_category.colour_css_class }} me-2">{{ resource.main_resource_category_name }}</span>
</div>
<div>
<span class="badge bg-secondary me-2">{{ resource.age_range }}</span>
@@ -101,7 +101,7 @@
<h5 class="card-title"><a href="{% url 'resources:resource_detail' resource_id=resource.id %}">{{ resource.name }}</a></h5>
<div class="d-flex flex-row justify-content-start align-content-center">
<div>
- <span class="badge bg-danger me-2">{{ resource.main_resource_category_name }}</span>
+ <span class="badge {{ resource.main_resource_category_colour_css_class }} me-2">{{ resource.main_resource_category_name }}</span>
</div>
<div>
<span class="badge bg-secondary me-2">{{ resource.age_range }}</span>