diff --git a/src/eke.knowledge/src/eke/knowledge/migrations/0012_datacollectionindex_preamble.py b/src/eke.knowledge/src/eke/knowledge/migrations/0012_datacollectionindex_preamble.py new file mode 100644 index 00000000..316ae61f --- /dev/null +++ b/src/eke.knowledge/src/eke/knowledge/migrations/0012_datacollectionindex_preamble.py @@ -0,0 +1,19 @@ +# Generated by Django 4.1.9 on 2023-09-14 09:35 + +from django.db import migrations +import wagtail.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('ekeknowledge', '0011_rename_value_interest_description'), + ] + + operations = [ + migrations.AddField( + model_name='datacollectionindex', + name='preamble', + field=wagtail.fields.RichTextField(blank=True, help_text='Text to appear at the top of the page'), + ), + ] diff --git a/src/eke.knowledge/src/eke/knowledge/sciencedata.py b/src/eke.knowledge/src/eke/knowledge/sciencedata.py index ec1bb134..11f87f9c 100644 --- a/src/eke.knowledge/src/eke/knowledge/sciencedata.py +++ b/src/eke.knowledge/src/eke/knowledge/sciencedata.py @@ -8,6 +8,7 @@ from .protocols import Protocol from .rdf import RelativeRDFAttribute, RDFAttribute from .utils import Ingestor as BaseIngestor, filter_by_user, ghetto_plotly_legend +from dash_dangerously_set_inner_html import DangerouslySetInnerHTML from django.contrib.auth.models import Group from django.db import models from django.db.models import Q @@ -19,11 +20,11 @@ from modelcluster.fields import ParentalManyToManyField, ParentalKey from urllib.parse import urlparse from wagtail.admin.panels import FieldPanel, InlinePanel +from wagtail.fields import RichTextField from wagtail.models import Orderable, PageViewRestriction from wagtail.search import index import dash_core_components as dcc import dash_html_components as html -from dash_dangerously_set_inner_html import DangerouslySetInnerHTML import logging, rdflib, plotly.express, collections, pandas _logger = logging.getLogger(__name__) @@ -227,13 +228,18 @@ class DataCollectionIndex(KnowledgeFolder): subpage_types = [DataCollection, DataStatistic] page_description = 'Container for data collections' + preamble = RichTextField(blank=True, null=False, help_text='Text to appear at the top of the page') + metadata_collection_form = models.ForeignKey( 'edrnsitecontent.MetadataCollectionFormPage', null=True, blank=True, verbose_name='Metadata Collection Form', related_name='+', help_text='Which page to use as the metadata collection form', on_delete=models.SET_NULL ) - content_panels = KnowledgeFolder.content_panels + [FieldPanel('metadata_collection_form')] + content_panels = KnowledgeFolder.content_panels + [ + FieldPanel('preamble'), + FieldPanel('metadata_collection_form') + ] def get_vocabulary(self, name) -> list: '''Get a "vocabulary" of known values for the field ``name`` for our contained subpage.''' diff --git a/src/eke.knowledge/src/eke/knowledge/templates/eke.knowledge/data-collection-index.html b/src/eke.knowledge/src/eke/knowledge/templates/eke.knowledge/data-collection-index.html index e98b34c1..ad683999 100644 --- a/src/eke.knowledge/src/eke/knowledge/templates/eke.knowledge/data-collection-index.html +++ b/src/eke.knowledge/src/eke/knowledge/templates/eke.knowledge/data-collection-index.html @@ -10,13 +10,9 @@ {% edrn_boilerplate 'hidden-data-notice' %} - {% if page.metadata_collection_form %} + {% if page.preamble %}
-

- If you have data you would like captured or linked in LabCAS, please complete the - {{page.metadata_collection_form.title}}. - Or contact the Informatics Center with any questions. -

+ {{page.preamble|richtext}}
{% endif %}