Skip to content
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

Allow user to specify default value #48

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arches_references/media/js/viewmodels/reference-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ define([
var ReferenceSelectViewModel = function(params) {
var self = this;

params.configKeys = ['placeholder'];
params.configKeys = ['placeholder', 'defaultValue'];
this.multiple = !!ko.unwrap(params.node.config.multiValue);
this.displayName = ko.observable('');
this.selectionValue = ko.observable([]); // formatted version of this.value that select2 can use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@
>
</div>
</div>
<div class="control-label">
<span data-bind="text: $root.translations.defaultValue"></span>
</div>
<div class="col-xs-12 resource-instance-wrapper" data-bind="class: nodeCssClasses">
<select style="display:inline-block;"
data-bind="
select2Query: {
select2Config: select2Config
},
attr: {'data-label': label, 'aria-label': label}
">
</div>
{% endblock config_form %}

{% block report %}
Expand Down
3 changes: 3 additions & 0 deletions tests/cli_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ class MigrateConceptNodesToReferenceDatatypeTests(TestCase):
# - `Collection Not Migrated`, with one concept node but the collection hasn't been migrated
# - `No concept nodes`, only has a string and a number node
# Contains a Collection "Top Concept", which has been migrated to a controlled list

# To create test fixtures run:
# python manage.py dumpdata models.CardModel models.CardComponent models.CardXNodeXWidget models.Concept models.Edge models.GraphModel models.GraphXPublishedGraph models.PublishedGraphEdit models.Language models.NodeGroup models.Node models.Relation models.ResourceXResource models.ResourceInstance models.TileModel models.Value models.Widget arches_references.List arches_references.ListItem arches_references.ListItemValue --format json --output concept_node_migration_test_data.json
fixtures = ["concept_node_migration_test_data"]

def test_migrate_concept_nodes_to_reference_datatype(self):
Expand Down
Loading
Loading