-
Notifications
You must be signed in to change notification settings - Fork 9
[OSDEV-2268] Add base_url and display_text for object partner field #819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 18 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
ef01013
Add base_url and display_text
VadimKovalenkoSNF a283c22
Update Release protocol
VadimKovalenkoSNF 8c7953e
Merge branch 'main' into OSDEV-2268-add-uri-reference-support
VadimKovalenkoSNF b1a1528
Merge branch 'main' into OSDEV-2268-add-uri-reference-support
VadimKovalenkoSNF af42780
Adjust UI (partial impl)
VadimKovalenkoSNF ee419b4
Refactor partner fields parsing (partial impl)
VadimKovalenkoSNF 3c4adfb
Pass base_url and display_text down to the URI reference component
VadimKovalenkoSNF 43262a8
Refactor render logic if display text is not present
VadimKovalenkoSNF 152dd5e
Merge branch 'main' into OSDEV-2268-add-uri-reference-support
VadimKovalenkoSNF 0261c59
Refine partner config fields rendering
VadimKovalenkoSNF c185273
Add unit tests, minor fixes
VadimKovalenkoSNF 18408d3
Show base url and display text only for object partner field type
VadimKovalenkoSNF 58f47aa
Merge branch 'main' into OSDEV-2268-add-uri-reference-support
VadimKovalenkoSNF d4d5492
Add prop types, minor fixes
VadimKovalenkoSNF 72db3da
Minor fixes for broken variable checks
VadimKovalenkoSNF 27e73fa
Minor fix with null check for srtingValue in showFieldDefaultDisplayText
VadimKovalenkoSNF 79cf2e2
Fix Typography component
VadimKovalenkoSNF 4514ab4
Merge branch 'main' into OSDEV-2268-add-uri-reference-support
VadimKovalenkoSNF e018b72
Fix proptypes for multiple components
VadimKovalenkoSNF b557ed7
Abstract link text rendering
VadimKovalenkoSNF 27b6311
Minor base_url and display_text attribute fix
VadimKovalenkoSNF File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/django/api/migrations/0189_add_base_url_and_text_field_to_partner_field.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Generated by Django 3.2.17 on 2025-12-03 12:18 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('api', '0188_introduce_indexing_for_new_operational_and_environmental_data'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name='partnerfield', | ||
| name='base_url', | ||
| field=models.URLField(blank=True, max_length=2000, null=True), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='partnerfield', | ||
| name='display_text', | ||
| field=models.CharField(blank=True, max_length=500), | ||
| ), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,63 +1,83 @@ | ||
| (function($) { | ||
| 'use strict'; | ||
|
|
||
| function findJsonSchemaFieldRow() { | ||
| const jsonSchemaField = $('#id_json_schema'); | ||
|
|
||
| if (jsonSchemaField.length) { | ||
| return jsonSchemaField.closest('.field-json_schema, tr, .form-row').first(); | ||
| } | ||
|
|
||
| return $('.field-json_schema').first(); | ||
| } | ||
| function findFieldRow(fieldSelector, fieldClassSelector) { | ||
| const field = $(fieldSelector); | ||
|
|
||
| function toggleJsonSchemaField() { | ||
| const typeField = $('#id_type'); | ||
| const jsonSchemaFieldRow = findJsonSchemaFieldRow(); | ||
|
|
||
| if (!typeField.length) { | ||
| return false; | ||
| if (field.length) { | ||
| const row = field | ||
| .closest(`${fieldClassSelector}, tr, .form-row`) | ||
| .first(); | ||
| if (row.length) { | ||
| return row; | ||
| } | ||
| } | ||
|
|
||
| if (!jsonSchemaFieldRow.length) { | ||
| return false; | ||
| } | ||
|
|
||
| const currentType = typeField.val(); | ||
|
|
||
| if (currentType === 'object') { | ||
| jsonSchemaFieldRow.show(); | ||
| return true; | ||
| } else { | ||
| jsonSchemaFieldRow.hide(); | ||
| return true; | ||
|
|
||
| if (fieldClassSelector) { | ||
| const fallbackRow = $(fieldClassSelector).first(); | ||
| if (fallbackRow.length) { | ||
| return fallbackRow; | ||
| } | ||
| } | ||
|
|
||
| return $(); | ||
| } | ||
|
|
||
| function setupJsonSchemaToggle() { | ||
| function setupPartnerFieldOptionsToggle() { | ||
| const typeField = $('#id_type'); | ||
| const jsonSchemaField = $('#id_json_schema'); | ||
|
|
||
| if (!typeField.length || !jsonSchemaField.length) { | ||
|
|
||
| if (!typeField.length) { | ||
| return false; | ||
| } | ||
|
|
||
| const jsonSchemaFieldRow = findJsonSchemaFieldRow(); | ||
| if (!jsonSchemaFieldRow.length) { | ||
|
|
||
| const jsonSchemaFieldRow = findFieldRow( | ||
| '#id_json_schema', | ||
| '.field-json_schema' | ||
| ); | ||
| const baseUrlFieldRow = findFieldRow( | ||
| '#id_base_url', | ||
| '.field-base_url' | ||
| ); | ||
| const displayTextFieldRow = findFieldRow( | ||
| '#id_display_text', | ||
| '.field-display_text' | ||
| ); | ||
|
|
||
| if ( | ||
| !jsonSchemaFieldRow.length && | ||
| !baseUrlFieldRow.length && | ||
| !displayTextFieldRow.length | ||
| ) { | ||
| return false; | ||
| } | ||
|
|
||
| toggleJsonSchemaField(); | ||
|
|
||
|
|
||
| const toggleFields = function() { | ||
| const shouldShow = typeField.val() === 'object'; | ||
| [jsonSchemaFieldRow, baseUrlFieldRow, displayTextFieldRow].forEach( | ||
| function(row) { | ||
| if (!row.length) { | ||
| return; | ||
| } | ||
| if (shouldShow) { | ||
| row.show(); | ||
| } else { | ||
| row.hide(); | ||
| } | ||
| } | ||
| ); | ||
| }; | ||
|
|
||
| toggleFields(); | ||
|
|
||
| typeField.on('change', function() { | ||
| toggleJsonSchemaField(); | ||
| toggleFields(); | ||
| }); | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| $(document).ready(function() { | ||
| setupJsonSchemaToggle(); | ||
| setupPartnerFieldOptionsToggle(); | ||
| }); | ||
| })(django.jQuery || jQuery); | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.