Skip to content

Commit

Permalink
Support #285
Browse files Browse the repository at this point in the history
  • Loading branch information
nutjob4life committed Sep 14, 2023
1 parent e4f3bfe commit ab1d4ec
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -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'),
),
]
10 changes: 8 additions & 2 deletions src/eke.knowledge/src/eke/knowledge/sciencedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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__)
Expand Down Expand Up @@ -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.'''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@

{% edrn_boilerplate 'hidden-data-notice' %}

{% if page.metadata_collection_form %}
{% if page.preamble %}
<div class='row'>
<p>
If you have data you would like captured or linked in LabCAS, please complete the
<a href='{{page.metadata_collection_form.url}}'>{{page.metadata_collection_form.title}}</a>.
Or contact the <a href='mailto:[email protected]'>Informatics Center</a> with any questions.
</p>
{{page.preamble|richtext}}
</div>
{% endif %}

Expand Down

0 comments on commit ab1d4ec

Please sign in to comment.