Bug 20456: (follow-up) Fix number of subscriptions and position display
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / select2.inc
1 [% USE Asset %]
2 <script src="[% interface %]/lib/select2/js/select2.min.js"></script>
3 [% Asset.css("lib/select2/css/select2.min.css") %]
4 [% Asset.css("css/select2.css") %]
5 <script>
6   jQuery.extend($.fn.select2.defaults, {
7     allowClear: true,
8     width: function() {
9       var width = this.element.outerWidth();
10
11       // 18 is the width of .select2-arrow
12       width -= 18;
13
14       if (this.allowClear) {
15         // 42 is the margin-right of .select2-chosen when allowClear is true
16         width += 42;
17       } else {
18         // 26 is the margin-right of .select2-chosen when allowClear is false
19         width += 26;
20       }
21
22       return width;
23     },
24
25     // Internationalization
26     formatMatches: function (matches) {
27       if (matches === 1) {
28         return _("One result is available, press enter to select it.");
29       }
30       return _("%s results are available, use up and down arrow keys to navigate.").format(matches);
31     },
32     formatNoMatches: function () {
33       return _("No matches found");
34     },
35     formatInputTooShort: function (input, min) {
36       var n = min - input.length;
37       return _("Please enter %n or more characters").format(n);
38     },
39     formatInputTooLong: function (input, max) {
40       var n = input.length - max;
41       return _("Please delete %d character(s)").format(n);
42     },
43     formatSelectionTooBig: function (limit) {
44       return _("You can only select %s item(s)").format(limit);
45     },
46     formatLoadMore: function (pageNumber) {
47       return _("Loading more results…");
48     },
49     formatSearching: function () {
50       return _("Searching…");
51     }
52   });
53 </script>