Skip to content

Commit

Permalink
Allow user to specify default value (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
chiatt authored Nov 8, 2024
1 parent 946d014 commit be14368
Show file tree
Hide file tree
Showing 4 changed files with 3,405 additions and 1,359 deletions.
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

0 comments on commit be14368

Please sign in to comment.