-
Notifications
You must be signed in to change notification settings - Fork 479
feat(personas): introduce new keytag custom field implementation #34625
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
base: main
Are you sure you want to change the base?
Changes from all commits
9322af1
7666427
0f126fe
ec68e33
948c21c
1794f67
cd058a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -108,5 +108,188 @@ | |||||
| cursor: not-allowed; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| /* Shared custom dropdown/select styles (template field, tag storage field, etc.) */ | ||||||
| .custom-field-wrapper, | ||||||
| .tag-storage-field-wrapper { | ||||||
| font-family: $font-default; | ||||||
| display: flex; | ||||||
| flex-direction: column; | ||||||
| gap: 0.5rem; | ||||||
| max-width: 100%; | ||||||
| min-height: 2.5rem; | ||||||
| } | ||||||
|
|
||||||
| .select-wrapper, | ||||||
| .tag-storage-select-wrapper { | ||||||
| position: relative; | ||||||
| width: 100%; | ||||||
| } | ||||||
|
|
||||||
| .custom-select-button, | ||||||
| .tag-storage-custom-select-button { | ||||||
| width: 100%; | ||||||
| padding: 0.5rem 3rem 0.5rem 0.75rem; | ||||||
| font-size: 0.875rem; | ||||||
| line-height: 1.5; | ||||||
| color: $color-palette-gray-700; | ||||||
| background-color: $white; | ||||||
| border: 1px solid; | ||||||
| border-radius: 6px; | ||||||
| cursor: pointer; | ||||||
| outline: none; | ||||||
| transition: border-color 0.2s; | ||||||
| text-align: left; | ||||||
| position: relative; | ||||||
| box-shadow: inset 0 0 0 1px | ||||||
| color-mix(in srgb, $color-palette-primary-500 20%, transparent); | ||||||
| min-height: 2.5rem; | ||||||
|
|
||||||
| &::after { | ||||||
| content: ""; | ||||||
| position: absolute; | ||||||
| right: 0; | ||||||
| top: 0; | ||||||
| bottom: 0; | ||||||
| width: 40px; | ||||||
| background-color: $color-palette-gray-100; | ||||||
| border-top-right-radius: 6px; | ||||||
| border-bottom-right-radius: 6px; | ||||||
| background-image: | ||||||
| linear-gradient(45deg, transparent 50%, $color-palette-primary-500 50%), | ||||||
| linear-gradient(135deg, $color-palette-primary-500 50%, transparent 50%); | ||||||
| background-position: | ||||||
| calc(50% - 3px) calc(50% + 1px), | ||||||
| calc(50% + 2px) calc(50% + 1px); | ||||||
| background-size: | ||||||
| 5px 5px, | ||||||
| 5px 5px; | ||||||
| background-repeat: no-repeat; | ||||||
| pointer-events: none; | ||||||
| } | ||||||
|
|
||||||
| &:focus { | ||||||
| border-color: $color-palette-primary-500; | ||||||
| box-shadow: | ||||||
| inset 0 0 0 1px color-mix(in srgb, $color-palette-primary-500 30%, transparent), | ||||||
| 0 0 0 2px color-mix(in srgb, $color-palette-primary-500 10%, transparent); | ||||||
| } | ||||||
|
|
||||||
| &:hover { | ||||||
| border-color: $color-palette-primary-500; | ||||||
| } | ||||||
|
|
||||||
| &.placeholder { | ||||||
| color: $color-palette-gray-500; | ||||||
| } | ||||||
|
|
||||||
| &:disabled { | ||||||
| opacity: 0.6; | ||||||
| cursor: not-allowed; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| .custom-dropdown, | ||||||
| .tag-storage-custom-dropdown { | ||||||
| position: absolute; | ||||||
| top: 100%; | ||||||
| left: 0; | ||||||
| right: 0; | ||||||
| background-color: $white; | ||||||
| border: 1px solid $color-palette-gray-400; | ||||||
| border-radius: 6px; | ||||||
| box-shadow: | ||||||
| 0 4px 6px -1px rgba(0, 0, 0, 0.1), | ||||||
| 0 2px 4px -1px rgba(0, 0, 0, 0.06); | ||||||
| margin-top: 0.25rem; | ||||||
| max-height: 400px; | ||||||
| overflow-y: auto; | ||||||
| z-index: 1000; | ||||||
| display: none; | ||||||
|
|
||||||
| &.open { | ||||||
| display: block; | ||||||
| } | ||||||
|
|
||||||
| &::-webkit-scrollbar { | ||||||
| width: 8px; | ||||||
| } | ||||||
|
|
||||||
| &::-webkit-scrollbar-track { | ||||||
| background: $color-palette-gray-100; | ||||||
| } | ||||||
|
|
||||||
| &::-webkit-scrollbar-thumb { | ||||||
| background: $color-palette-gray-400; | ||||||
| border-radius: 4px; | ||||||
| } | ||||||
|
|
||||||
| &::-webkit-scrollbar-thumb:hover { | ||||||
| background: $color-palette-gray-500; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| .custom-option, | ||||||
| .tag-storage-custom-option { | ||||||
| padding: 0.75rem 1rem; | ||||||
| cursor: pointer; | ||||||
| border-bottom: 1px solid $color-palette-gray-100; | ||||||
| transition: background-color 0.15s; | ||||||
|
|
||||||
| &:last-child { | ||||||
| border-bottom: none; | ||||||
| } | ||||||
|
|
||||||
| &:hover { | ||||||
| background-color: $color-palette-gray-200; | ||||||
| } | ||||||
|
|
||||||
| &.selected { | ||||||
| background-color: #dbeafe; | ||||||
|
||||||
| background-color: #dbeafe; | |
| background-color: $color-palette-blue-tint; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,5 @@ | ||
| <script language="Javascript"> | ||
| dojo.require('dotcms.dijit.FileBrowserDialog'); | ||
|
|
||
| function browseFiles() { | ||
| fileSelector.show(); | ||
| } | ||
|
|
||
| function fileSelected(file) { | ||
| var path = file.pageURI; | ||
| if (!path) { | ||
| path = file.path + file.fileName; | ||
| } | ||
| dojo.byId('vlUri').value = path; | ||
| dojo.byId('${field.velocityVarName}').value = path; | ||
| } | ||
|
|
||
| function setValue(e) { | ||
| dojo.byId('${field.velocityVarName}').value = e.target.value; | ||
| } | ||
|
|
||
| dojo.ready(function() { | ||
| dojo.byId('vlUri').value = dojo.byId('${field.velocityVarName}').value; | ||
|
|
||
| dojo.require('dojo.on')(dojo.byId('vlUri'), 'change', setValue); | ||
| }); | ||
|
|
||
| </script> | ||
| <div class="inline-form"> | ||
| <input id="vlUri" type="text" name="uri" dojoType="dijit.form.TextBox" | ||
| trim="true" invalidMessage="$text.get('Invalid-option-selected')" /> | ||
| <button dojoType="dijit.form.Button" | ||
| onClick="browseFiles();return false;" iconClass="browseIcon"> | ||
| $text.get('click-here-to-browse')</button> | ||
| </div> | ||
| <div dojoAttachPoint="fileBrowser" jsId="fileSelector" includeDotAssets="false" | ||
| onFileSelected="fileSelected" dojoType="dotcms.dijit.FileBrowserDialog"> | ||
| </div> | ||
| #if( $structures.isNewEditModeEnabled() ) | ||
| #parse('/static/content/file_browser_field_render_new.vtl') | ||
| #else | ||
| #parse('/static/content/file_browser_field_render_old.vtl') | ||
| #end |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,55 @@ | ||||||||||||
| <script type="application/javascript"> | ||||||||||||
| DotCustomFieldApi.ready(() => { | ||||||||||||
| const field = DotCustomFieldApi.getField("${field.velocityVarName}"); | ||||||||||||
| const vlUriInput = document.getElementById("vlUri"); | ||||||||||||
| const browseButton = document.getElementById("browseButton"); | ||||||||||||
|
||||||||||||
| const browseButton = document.getElementById("browseButton"); | |
| const browseButton = document.getElementById("browseButton"); | |
| if (!vlUriInput || !browseButton) { | |
| return; | |
| } |
adrianjm-dotCMS marked this conversation as resolved.
Show resolved
Hide resolved
adrianjm-dotCMS marked this conversation as resolved.
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| <script language="Javascript"> | ||
| dojo.require('dotcms.dijit.FileBrowserDialog'); | ||
|
|
||
| function browseFiles() { | ||
| fileSelector.show(); | ||
| } | ||
|
|
||
| function fileSelected(file) { | ||
| var path = file.pageURI; | ||
| if (!path) { | ||
| path = file.path + file.fileName; | ||
| } | ||
| dojo.byId('vlUri').value = path; | ||
| dojo.byId('${field.velocityVarName}').value = path; | ||
| } | ||
|
|
||
| function setValue(e) { | ||
| dojo.byId('${field.velocityVarName}').value = e.target.value; | ||
| } | ||
|
|
||
| dojo.ready(function() { | ||
| dojo.byId('vlUri').value = dojo.byId('${field.velocityVarName}').value; | ||
|
|
||
| dojo.require('dojo.on')(dojo.byId('vlUri'), 'change', setValue); | ||
| }); | ||
|
|
||
| </script> | ||
| <div class="inline-form"> | ||
| <input id="vlUri" type="text" name="uri" dojoType="dijit.form.TextBox" | ||
| trim="true" invalidMessage="$text.get('Invalid-option-selected')" /> | ||
| <button dojoType="dijit.form.Button" | ||
| onClick="browseFiles();return false;" iconClass="browseIcon"> | ||
| $text.get('click-here-to-browse')</button> | ||
| </div> | ||
| <div dojoAttachPoint="fileBrowser" jsId="fileSelector" includeDotAssets="false" | ||
| onFileSelected="fileSelected" dojoType="dotcms.dijit.FileBrowserDialog"> | ||
| </div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incomplete border declaration missing color value. The border property is set to "1px solid" without specifying a color, which will result in the browser using the default color (usually black). Based on the removed code from template_custom_field_new.vtl which had "border: 2px solid var(--color-palette-primary-500)", this should specify a border color. Consider adding a color such as "$color-palette-primary-500" to match the previous implementation and the hover/focus styles on lines 172 and 179.