View | Details | Raw Unified | Return to bug 13501
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery-ui-combobox.js (+115 lines)
Line 0 Link Here
1
(function($) {
2
  $.widget("custom.combobox", {
3
    _create: function() {
4
      this.wrapper = $("<span>")
5
        .addClass("custom-combobox")
6
        .insertAfter(this.element);
7
      this.element.hide();
8
      this._createAutocomplete();
9
      this._createShowAllButton();
10
    },
11
12
    _createAutocomplete: function() {
13
      var selected = this.element.children(":selected"),
14
          value = selected.val() ? selected.text() : "";
15
16
      this.input = $("<input>")
17
        .appendTo(this.wrapper)
18
        .val(value)
19
        .attr("title", "")
20
        .addClass("custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left")
21
        .autocomplete({
22
          delay: 0,
23
          minLength: 0,
24
          source: $.proxy(this, "_source")
25
        });
26
27
      this._on(this.input, {
28
        autocompleteselect: function(event, ui) {
29
          ui.item.option.selected = true;
30
          this._trigger("select", event, {
31
            item: ui.item.option
32
          });
33
        },
34
        autocompletechange: "_removeIfInvalid"
35
      });
36
    },
37
38
    _createShowAllButton: function() {
39
      var input = this.input,
40
        wasOpen = false;
41
42
      $("<a>")
43
        .append('&nbsp;')
44
        .attr("tabIndex", -1)
45
        .attr("title", "Show All Items")
46
        .appendTo(this.wrapper)
47
        .button({
48
          icons: {
49
            primary: "ui-icon-triangle-1-s"
50
          },
51
          text: false
52
        })
53
        .removeClass("ui-corner-all")
54
        .addClass("custom-combobox-toggle ui-corner-right")
55
        .mousedown(function() {
56
          wasOpen = input.autocomplete("widget").is(":visible");
57
        })
58
        .click(function() {
59
          input.focus();
60
          // Close if already visible
61
          if (wasOpen) {
62
            return;
63
          }
64
          // Pass empty string as value to search for, displaying all results
65
          input.autocomplete("search", "");
66
        });
67
    },
68
69
    _source: function(request, response) {
70
      var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
71
      response(this.element.children("option").map(function() {
72
        var text = $(this).text();
73
        if (this.value && (!request.term || matcher.test(text)))
74
          return {
75
            label: text,
76
            value: text,
77
            option: this
78
          };
79
      }));
80
    },
81
82
    _removeIfInvalid: function(event, ui) {
83
      // Selected an item, nothing to do
84
      if (ui.item) {
85
        return;
86
      }
87
88
      // Search for a match (case-insensitive)
89
      var value = this.input.val(),
90
          valueLowerCase = value.toLowerCase(),
91
          valid = false;
92
      this.element.children("option").each(function() {
93
        if ($(this).text().toLowerCase() === valueLowerCase) {
94
          this.selected = valid = true;
95
          return false;
96
        }
97
      });
98
99
      // Found a match, nothing to do
100
      if (valid) {
101
        return;
102
      }
103
104
      // Remove invalid value
105
      this.input.val("");
106
      this.element.val("");
107
      this.input.autocomplete("instance").term = "";
108
    },
109
110
    _destroy: function() {
111
      this.wrapper.remove();
112
      this.element.show();
113
    }
114
  });
115
})(jQuery);
(-)a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css (+26 lines)
Lines 2023-2028 div#acqui_order_supplierlist > div.supplier > div.baskets { Link Here
2023
    -webkit-box-shadow: 2px 2px 2px rgba(0,0,0,.3);
2023
    -webkit-box-shadow: 2px 2px 2px rgba(0,0,0,.3);
2024
    -moz-box-shadow: 2px 2px 2px rgba(0,0,0,.3);
2024
    -moz-box-shadow: 2px 2px 2px rgba(0,0,0,.3);
2025
    box-shadow: 2px 2px 2px rgba(0,0,0,.3);
2025
    box-shadow: 2px 2px 2px rgba(0,0,0,.3);
2026
    max-height: 300px;
2027
    overflow: auto;
2026
}
2028
}
2027
.ui-autocomplete.ui-widget-content .ui-state-hover {
2029
.ui-autocomplete.ui-widget-content .ui-state-hover {
2028
    border: 1px solid #B9D8D9;
2030
    border: 1px solid #B9D8D9;
Lines 2108-2113 ul.ui-tabs-nav li { Link Here
2108
    color: #538200;
2110
    color: #538200;
2109
}
2111
}
2110
2112
2113
/* jQuery UI Combobox */
2114
.custom-combobox {
2115
  display: inline-block;
2116
}
2117
2118
.custom-combobox > * {
2119
  vertical-align: middle;
2120
}
2121
2122
.custom-combobox-toggle {
2123
  margin-left: -1px;
2124
}
2125
2126
.custom-combobox-input,
2127
.custom-combobox-toggle .ui-button-text {
2128
  padding: 5px 10px;
2129
}
2130
2131
.custom-combobox-input:focus {
2132
  border-top-right-radius: 0;
2133
  border-bottom-right-radius: 0;
2134
}
2135
2136
2111
.statictabs ul {
2137
.statictabs ul {
2112
    background: none repeat scroll 0 0 transparent;
2138
    background: none repeat scroll 0 0 transparent;
2113
    border: 0 none;
2139
    border: 0 none;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc (-1 / +5 lines)
Lines 14-19 Link Here
14
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
14
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
15
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.highlight-3.js"></script>
15
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.highlight-3.js"></script>
16
<script type="text/javascript" src="[% interface %]/lib/bootstrap/bootstrap.min.js"></script>
16
<script type="text/javascript" src="[% interface %]/lib/bootstrap/bootstrap.min.js"></script>
17
<script type="text/javascript">
18
  /* Bootstrap overwrites jQuery UI button().
19
   * This line reverts button() to jQuery UI. */
20
  $.fn.button.noConflict();
21
</script>
17
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.validate.min.js"></script>
22
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.validate.min.js"></script>
18
23
19
[% IF ( login ) %]
24
[% IF ( login ) %]
20
- 

Return to bug 13501