Skip to content

feat: Implement youtube, citation, and input/output data schema additions#874

Draft
Karthik99999 wants to merge 1 commit into
comses:mainfrom
Karthik99999:refactors
Draft

feat: Implement youtube, citation, and input/output data schema additions#874
Karthik99999 wants to merge 1 commit into
comses:mainfrom
Karthik99999:refactors

Conversation

@Karthik99999

Copy link
Copy Markdown
Contributor

comses/planning#332

Currently does not include changes to the Upload Form Page to include fields to edit input/output urls, still figuring out issues with actually saving the data on that page.

value = value[4:].strip()
if value.lower().startswith("http://") or value.lower().startswith("https://"):
parsed = urlparse(value)
if parsed.netloc.endswith("doi.org") and parsed.path:
raise ValidationError(_(f"Invalid DOI link: {value}"))
if value.lower().startswith("http://") or value.lower().startswith("https://"):
parsed = urlparse(value)
if parsed.netloc.endswith("doi.org") and parsed.path:

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the codebase/release metadata model to support (1) an optional YouTube video alongside release images, (2) structured “associated publications” (DOI links with a “include in citation” flag), and (3) a new release-level inputDataUrl in addition to outputDataUrl, with corresponding updates across the Django API, templates, and Vue UI.

Changes:

  • Add youtubeUrl to codebases and render it in the release detail media gallery (plus a new “Add Media” modal in the release editor).
  • Replace freeform associatedPublicationText with structured associatedPublications[] and update citation/rendering behavior to use the new structure.
  • Add inputDataUrl to releases and include it in both the release editor metadata form and CodeMeta “supportingData”.

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
frontend/src/types.ts Adds new TS types/fields for YouTube, associated publications, and input data URL.
frontend/src/stores/releaseEditor.ts Wires inputDataUrl, youtubeUrl, and associatedPublications into the editor store state/metadata mapping.
frontend/src/components/releaseEditor/MetadataFormPage.vue Adds an “Input Data URL” field + validation (but includes a stray console log).
frontend/src/components/releaseEditor/CommonMediaModal.vue New modal combining image upload with optional YouTube URL saving.
frontend/src/components/releaseEditor/CommonImagesModal.vue Removed in favor of the combined media modal.
frontend/src/components/releaseEditor/App.vue Switches UI from images-only modal to the new media modal.
frontend/src/components/ImageGallery.vue Extends gallery to support a video item + embed modal.
frontend/src/components/form/AssociatedPublicationListField.vue New form field for managing/sorting DOI links and citation inclusion.
frontend/src/components/CodebaseEditForm.vue Replaces old textarea with the new structured associated publications field.
frontend/src/apps/image_gallery.ts Passes videoUrl from server-rendered data attributes into the Vue gallery app.
e2e/cypress/tests/codebase.spec.ts Updates Cypress selector for the renamed “add media” button.
django/library/serializers.py Adds validation/serialization for associated publications and exposes youtube_url + input_data_url.
django/library/permissions.py Whitespace-only change.
django/library/models.py Adds new DB fields + updates citation assembly and draft creation behavior.
django/library/migrations/0038_codebase_associated_publications_and_more.py Adds DB fields for associated publications, preferred citation, YouTube URL, and release input data URL.
django/library/metadata.py Updates CodeMeta conversion to include associated publication links and both input/output supporting data.
django/library/jinja2/library/codebases/releases/retrieve.jinja Updates release detail rendering for associated publications, YouTube gallery, input data URL, and DOI citation formatting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

initialValues: {},
showPlaceholder: isLoading,
onSubmit: async () => {
console.log(values);
Comment on lines +3 to +6
<slot name="label">
<FieldLabel v-if="label" :label="label" :id-for="id" :required="required" />
</slot>
<FormPlaceholder v-if="showPlaceholder" />
Comment on lines +9 to +13
<input
v-model="candidateDoi"
:id="`${id}-candidate-doi`"
:class="['form-control', { 'is-invalid': localErrors.doi }]"
:placeholder="placeholder"
Comment on lines +164 to +168
const mediaItems = computed<MediaItem[]>(() => {
const items: MediaItem[] = props.images.map(src => ({ type: "image", src }));
if (props.videoUrl) {
items.unshift({ type: "video", src: props.videoUrl });
}
Comment thread django/library/models.py
@@ -1529,7 +1569,6 @@ def get_or_create_draft(self, initial_version: str | None = None):
# reset fields that should not be copied over to a new draft
draft_release.doi = None
draft_release.release_notes = ""
Comment on lines +13 to +17
migrations.AddField(
model_name="codebase",
name="associated_publications",
field=models.JSONField(
blank=True,
Comment thread django/library/models.py
@@ -3378,10 +3420,9 @@ def __init__(self, release: CodebaseRelease):
release.citation_text,
codebase.references_text,
codebase.replication_text,
Comment on lines 80 to +82
<h2>Associated Publications</h2>
<p>{{ markdown(codebase.associated_publication_text) }}</p>
{% if codebase.associated_publications %}
<ul>
data-cy="codebase-associated-publications"
:rows="3"
help="Add DOI links for publications related to this model. Check the box to include a publication in the citation area alongside the main model citation."
placeholder="https://doi.org/10.1234/example"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants