Koha/koha-tmpl/intranet-tmpl/prog/en/includes/select2.inc
Owen Leonard 9ea7fbcb30
Bug 25002: JS Includes should be wrapped with template comments
This patch adds HTML comments to Template::Toolkit include files which
contain <script> tags so that it is clear where the embedded scripts can
be found in the code.

To test, apply the patch and view source on the following pages to
verify the presence of the comments:

Acquisitions home page:
  - acquisitions-toolbar.inc
  - validtor-strings.inc
  - js_includes.inc
  - format-price.inc
Acquisitions -> Add order from new record,
Acquisitions -> Receive order:
  - additem.js.inc
Cataloging -> Add/Edit item:
  - columns_settings.inc
  - strings.inc
  - select2.inc
  - calendar.inc
  - str/cataloging_additem.inc
Authorities home page:
  - authorities_js.inc
Bibliographic detail page:
  - catalog-strings.inc
Cataloging -> Advanced editor:
  - cateditor-ui.inc
  - cateditor-widgets-marc21.inc
Administration -> Item types:
  - greybox.inc
ILL requests:
  - ill-list-table-strings.inc
Web installer
  - installer-intranet-bottom.inc
Web installer -> Onboarding
  - installer-strings.inc
Lists -> List contents -> Merge records
  - merge-record-strings.inc
Patrons -> Patron -> Change password
  - password_check.inc
  - str/members-menu.inc
Patrons -> Patron -> Print summary
  - slip-print.inc
Circulation -> Check out
  - timepicker.inc
Administration -> System preferences:
  - str/tinymce_i18n.inc
  - wysiwyg-systempreferences.inc
Cataloging -> Z39.50 Search:
  - z3950_search.inc

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-04-29 17:15:20 +01:00

56 lines
1.6 KiB
C++

[% USE raw %]
[% USE Asset %]
[% Asset.js("lib/select2/js/select2.min.js") | $raw %]
[% Asset.css("lib/select2/css/select2.min.css") | $raw %]
[% Asset.css("css/select2.css") | $raw %]
<!-- select2.inc -->
<script>
jQuery.extend($.fn.select2.defaults, {
allowClear: true,
width: function() {
var width = this.element.outerWidth();
// 18 is the width of .select2-arrow
width -= 18;
if (this.allowClear) {
// 42 is the margin-right of .select2-chosen when allowClear is true
width += 42;
} else {
// 26 is the margin-right of .select2-chosen when allowClear is false
width += 26;
}
return width;
},
// Internationalization
formatMatches: function (matches) {
if (matches === 1) {
return _("One result is available, press enter to select it.");
}
return _("%s results are available, use up and down arrow keys to navigate.").format(matches);
},
formatNoMatches: function () {
return _("No matches found");
},
formatInputTooShort: function (input, min) {
var n = min - input.length;
return _("Please enter %n or more characters").format(n);
},
formatInputTooLong: function (input, max) {
var n = input.length - max;
return _("Please delete %d character(s)").format(n);
},
formatSelectionTooBig: function (limit) {
return _("You can only select %s item(s)").format(limit);
},
formatLoadMore: function (pageNumber) {
return _("Loading more results…");
},
formatSearching: function () {
return _("Searching…");
}
});
</script>
<!-- / select2.inc -->