Skip to content

Commit

Permalink
Adapted reference checkbox to new layout
Browse files Browse the repository at this point in the history
  • Loading branch information
nezbite committed Jun 22, 2022
1 parent 376e4c2 commit 2b09652
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 29 deletions.
61 changes: 32 additions & 29 deletions IHP/IDE/SchemaDesigner/View/Columns/New.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,36 +46,36 @@ instance View NewColumnView where

<div class="form-group">
{typeSelector Nothing enumNames}

<div class="mt-1 text-muted d-flex" id="column-options">
<div class="mt-1 text-muted" id="column-options">
{generateReferenceCheckboxes}
<div class="d-flex">
<div class="custom-control custom-checkbox">
<input id="allowNull" type="checkbox" name="allowNull" class="mr-1 custom-control-input"/>
<label class="custom-control-label mr-2" for="allowNull">
Nullable
</label>
</div>

<div class="custom-control custom-checkbox">
<input id="allowNull" type="checkbox" name="allowNull" class="mr-1 custom-control-input"/>
<label class="custom-control-label mr-2" for="allowNull">
Nullable
</label>
</div>

<div class="custom-control custom-checkbox">
<input type="checkbox" id="isUnique" name="isUnique" class="mr-1 custom-control-input"/>
<label class="mx-2 custom-control-label" for="isUnique">
Unique
</label>
</div>
<div class="custom-control custom-checkbox">
<input type="checkbox" id="isUnique" name="isUnique" class="mr-1 custom-control-input"/>
<label class="mx-2 custom-control-label" for="isUnique">
Unique
</label>
</div>

<div class="custom-control custom-checkbox">
<input type="checkbox" name="primaryKey" id="primaryKey" class="mr-1 custom-control-input"/>
<label class="mx-2 custom-control-label" for="primaryKey">
Primary Key
</label>
</div>
<div class="custom-control custom-checkbox">
<input type="checkbox" name="primaryKey" id="primaryKey" class="mr-1 custom-control-input"/>
<label class="mx-2 custom-control-label" for="primaryKey">
Primary Key
</label>
</div>

<div class="custom-control custom-checkbox">
<input id="isArray" type="checkbox" name="isArray" class="mr-1 custom-control-input"/>
<label class="mx-2 custom-control-label" for="isArray">
Array Type
</label>
<div class="custom-control custom-checkbox">
<input id="isArray" type="checkbox" name="isArray" class="mr-1 custom-control-input"/>
<label class="mx-2 custom-control-label" for="isArray">
Array Type
</label>
</div>
</div>
</div>
</div>
Expand All @@ -97,15 +97,18 @@ instance View NewColumnView where
</form>
|]
where
generateReferenceCheckboxes = [hsx|{forEach tableNames checkbox}|]
where checkbox tableName = [hsx|
generateReferenceCheckboxes = forEach tableNames checkbox
where
checkbox tableName = [hsx|
<div>
<div class="custom-control custom-checkbox ref" 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 custom-control-label" id="refText">
References {tableName}
</label>
</div>
|]
</div>
|]
defaultSelector = [hsx|
<select id="defaultSelector" name="defaultValue" class="form-control select2">
<option value="" selected={True}>no default</option>
Expand Down
7 changes: 7 additions & 0 deletions lib/IHP/static/IDE/schema-designer.css
Original file line number Diff line number Diff line change
Expand Up @@ -414,3 +414,10 @@
font-size: 14px;
font-weight: 400;
}

.ref {
justify-content: start !important;
padding-left: 1rem;
margin-bottom: .25rem;
margin-top: .4rem;
}

0 comments on commit 2b09652

Please sign in to comment.