Skip to content

Commit

Permalink
Merge pull request #10 from phyzical/feature/adjusting-quote-escaping
Browse files Browse the repository at this point in the history
Feature/adjusting quote escaping
  • Loading branch information
phyzical authored Oct 29, 2024
2 parents deeb66e + 880739c commit c249da5
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 327 deletions.
5 changes: 5 additions & 0 deletions docker.labelInjector.plg
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

<PLUGIN name="&name;" author="&author;" version="&version;" launch="&launch;" pluginURL="&pluginURL;" min="6.12.3">
<CHANGES>
###2024.10.29
!!!! BREAKING CHANGE !!!!
- Changed the way the default labels are stored.
- If any of your exisiting default labels use ` -> " Going forward these must be escaped \` -> "

###2024.10.05
- Fix visibility of changes in the summary when dark mode
- Add remove all button during edit mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Icon="server"

<link type="text/css" rel="stylesheet" href="<?autov("/plugins/docker.labelInjector/styles/styles.css")?>">

<script defer src="<?autov('/plugins/docker.labelInjector/scripts/dropdown.js')?>"></script>
<script defer src="<?autov('/plugins/docker.labelInjector/scripts/docker.js')?>"></script>

<?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ Markdown="false"

<link type="text/css" rel="stylesheet" href="<?autov("/plugins/docker.labelInjector/styles/styles.css")?>">

<script src="<?autov('/plugins/docker.labelInjector/scripts/config.js')?>"></script>
<script defer src="<?autov('/plugins/docker.labelInjector/scripts/dropdown.js')?>"></script>
<script defer src="<?autov('/plugins/docker.labelInjector/scripts/config.js')?>"></script>

<?
require_once("$documentRoot/plugins/docker.labelInjector/server/config/DefaultLabels.php");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,100 +1,8 @@

$(document).ready(function () {
// Passing options (with default options)
new Choices($('#labels')[0], {
silent: false,
items: [],
choices: [],
renderChoiceLimit: -1,
maxItemCount: -1,
closeDropdownOnSelect: 'auto',
singleModeForMultiSelect: false,
addChoices: true,
addItems: true,
generateDropdown('#labels', {
addItemFilter: (value) => {
return !!value && value !== '' && value.includes('=')
},
removeItems: true,
removeItemButton: true,
removeItemButtonAlignLeft: false,
editItems: true,
allowHTML: false,
allowHtmlUserInput: false,
duplicateItemsAllowed: true,
delimiter: ',',
paste: true,
searchEnabled: true,
searchChoices: true,
searchFloor: 1,
searchResultLimit: 4,
searchFields: ['label', 'value'],
position: 'auto',
resetScrollPosition: true,
shouldSort: true,
shouldSortItems: false,
shadowRoot: null,
placeholder: true,
placeholderValue: null,
searchPlaceholderValue: null,
prependValue: null,
appendValue: null,
renderSelectedChoices: 'auto',
loadingText: 'Loading...',
noResultsText: 'No results found',
noChoicesText: 'No choices to choose from',
itemSelectText: 'Press to select',
uniqueItemText: 'Only unique values can be added',
customAddItemText: 'Only values containing "=" can be added, i.e `LABEL_A=VALUE_A',
addItemText: (value) => {
return `Press Enter to add <b>"${value}"</b>`;
},
removeItemIconText: () => `Remove item`,
removeItemLabelText: (value) => `Remove item: ${value}`,
maxItemText: (maxItemCount) => {
return `Only ${maxItemCount} values can be added`;
},
valueComparer: (value1, value2) => {
return value1 === value2;
},
classNames: {
containerOuter: ['choices'],
containerInner: ['choices__inner'],
input: ['choices__input'],
inputCloned: ['choices__input--cloned'],
list: ['choices__list'],
listItems: ['choices__list--multiple'],
listSingle: ['choices__list--single'],
listDropdown: ['choices__list--dropdown'],
item: ['choices__item'],
itemSelectable: ['choices__item--selectable'],
itemDisabled: ['choices__item--disabled'],
itemChoice: ['choices__item--choice'],
description: ['choices__description'],
placeholder: ['choices__placeholder'],
group: ['choices__group'],
groupHeading: ['choices__heading'],
button: ['choices__button'],
activeState: ['is-active'],
focusState: ['is-focused'],
openState: ['is-open'],
disabledState: ['is-disabled'],
highlightedState: ['is-highlighted'],
selectedState: ['is-selected'],
flippedState: ['is-flipped'],
loadingState: ['is-loading'],
notice: ['choices__notice'],
addChoice: ['choices__item--selectable', 'add-choice'],
noResults: ['has-no-results'],
noChoices: ['has-no-choices'],
},
// Choices uses the great Fuse library for searching. You
// can find more options here: https://fusejs.io/api/options.html
fuseOptions: {
includeScore: true
},
labelId: '',
callbackOnInit: null,
callbackOnCreateTemplates: null,
appendGroupInSearch: false,
});
})
});
Loading

0 comments on commit c249da5

Please sign in to comment.