Skip to content

Commit

Permalink
fixed design of reference checkbox in new column view
Browse files Browse the repository at this point in the history
  • Loading branch information
mpscholten committed May 11, 2022
1 parent d54575e commit 9b3e2c1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
13 changes: 8 additions & 5 deletions IHP/IDE/SchemaDesigner/View/Columns/New.hs
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,15 @@ instance View NewColumnView where
</form>
|]
where
generateReferenceCheckboxes = [hsx|<span id="checkboxes">{forEach tableNames checkbox}</span>|]
generateReferenceCheckboxes = [hsx|{forEach tableNames checkbox}|]
where checkbox tableName = [hsx|
<label class="mx-2 ref" style="font-size: 12px; display: none;" data-attribute={(singularize tableName) <> "_id"} data-table={tableName}>
<input id="reference" type="checkbox" name="isReference" class="mr-1"/>
<a id="refText">References {tableName}</a>
</label>|]
<div class="custom-control custom-checkbox" style="display: none;" data-attribute={(singularize tableName) <> "_id"} data-table={tableName} >
<input id="reference" type="checkbox" name="isReference" class="mr-1 custom-control-input"/>
<label class="mx-2 ref custom-control-label" id="refText">
References {tableName}
</label>
</div>
|]
defaultSelector = [hsx|
<select id="defaultSelector" name="defaultValue" class="form-control select2">
<option value="" selected={True}>no default</option>
Expand Down
8 changes: 4 additions & 4 deletions lib/IHP/static/IDE/ihp-schemadesigner.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function initSchemaDesigner() {
$('#typeSelector').change(function () {
switch (this.value) {
case "UUID":
if ($('label[data-attribute="' + $("#colName").val() +'"]').length == 0) {
if ($('div[data-attribute="' + $("#colName").val() +'"]').length == 0) {
$('#defaultSelector').empty()
.append(new Option("uuid_generate_v4()", 'uuid_generate_v4()', true, true))
.append(new Option("no default", "", false, false))
Expand Down Expand Up @@ -122,9 +122,9 @@ function initSchemaDesigner() {
$("#colName").on('input', function () {
$('.ref').hide();
$('.ref > input').prop('checked', false);
$('label[data-attribute="' + $("#colName").val() +'"]').show();
$('label[data-attribute="' + $("#colName").val() +'"] > input').prop('checked', true);
$('input[name="referenceTable"]').val($('label[style="font-size: 12px;"]').data("table"));
$('div[data-attribute="' + $("#colName").val() +'"]').show();
$('div[data-attribute="' + $("#colName").val() +'"] > input').prop('checked', true);
$('input[name="referenceTable"]').val($('div[data-attribute="' + $("#colName").val() +'"]').data("table"));
});

initEnumValueNameSnakeCaseCheck();
Expand Down

0 comments on commit 9b3e2c1

Please sign in to comment.