recordselect 3.4.6 → 3.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/jquery/record_select.js +26 -25
- data/lib/record_select/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: ed771a7ed354634ca037874a20894a164598f61d
         | 
| 4 | 
            +
              data.tar.gz: a9d52d7bf8a39ae8cd3a93e30836779654c1a01c
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 3736a19d08e171c73916650ea0d0db6e0bc6df246d4f5829dff13748ea5842208a9090f7da9082b8ec67050541fd7aef56492775563a6ebc78f12369bef3ff7e
         | 
| 7 | 
            +
              data.tar.gz: aae171c3ad9c9d491ccb2d9f04061860f3bccfd9a7f94fe4da77e99115aea5466f5bb5c077d62521f0dad7624f20e0185cc14479a401e8561d81ed561ae233ac
         | 
| @@ -4,20 +4,20 @@ if (typeof(Class) === 'undefined') { | |
| 4 4 | 
             
              */
         | 
| 5 5 | 
             
              (function(){
         | 
| 6 6 | 
             
                var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
         | 
| 7 | 
            -
             | 
| 7 | 
            +
             | 
| 8 8 | 
             
                // The base Class implementation (does nothing)
         | 
| 9 9 | 
             
                this.Class = function(){};
         | 
| 10 | 
            -
             | 
| 10 | 
            +
             | 
| 11 11 | 
             
                // Create a new Class that inherits from this class
         | 
| 12 12 | 
             
                Class.extend = function(prop) {
         | 
| 13 13 | 
             
                  var _super = this.prototype;
         | 
| 14 | 
            -
             | 
| 14 | 
            +
             | 
| 15 15 | 
             
                  // Instantiate a base class (but only create the instance,
         | 
| 16 16 | 
             
                  // don't run the init constructor)
         | 
| 17 17 | 
             
                  initializing = true;
         | 
| 18 18 | 
             
                  var prototype = new this();
         | 
| 19 19 | 
             
                  initializing = false;
         | 
| 20 | 
            -
             | 
| 20 | 
            +
             | 
| 21 21 | 
             
                  // Copy the properties over onto the new prototype
         | 
| 22 22 | 
             
                  for (var name in prop) {
         | 
| 23 23 | 
             
                    // Check if we're overwriting an existing function
         | 
| @@ -26,38 +26,38 @@ if (typeof(Class) === 'undefined') { | |
| 26 26 | 
             
                      (function(name, fn){
         | 
| 27 27 | 
             
                        return function() {
         | 
| 28 28 | 
             
                          var tmp = this._super;
         | 
| 29 | 
            -
             | 
| 29 | 
            +
             | 
| 30 30 | 
             
                          // Add a new ._super() method that is the same method
         | 
| 31 31 | 
             
                          // but on the super-class
         | 
| 32 32 | 
             
                          this._super = _super[name];
         | 
| 33 | 
            -
             | 
| 33 | 
            +
             | 
| 34 34 | 
             
                          // The method only need to be bound temporarily, so we
         | 
| 35 35 | 
             
                          // remove it when we're done executing
         | 
| 36 | 
            -
                          var ret = fn.apply(this, arguments); | 
| 36 | 
            +
                          var ret = fn.apply(this, arguments);
         | 
| 37 37 | 
             
                          this._super = tmp;
         | 
| 38 | 
            -
             | 
| 38 | 
            +
             | 
| 39 39 | 
             
                          return ret;
         | 
| 40 40 | 
             
                        };
         | 
| 41 41 | 
             
                      })(name, prop[name]) :
         | 
| 42 42 | 
             
                      prop[name];
         | 
| 43 43 | 
             
                  }
         | 
| 44 | 
            -
             | 
| 44 | 
            +
             | 
| 45 45 | 
             
                  // The dummy class constructor
         | 
| 46 46 | 
             
                  function Class() {
         | 
| 47 47 | 
             
                    // All construction is actually done in the init method
         | 
| 48 48 | 
             
                    if ( !initializing && this.init )
         | 
| 49 49 | 
             
                      this.init.apply(this, arguments);
         | 
| 50 50 | 
             
                  }
         | 
| 51 | 
            -
             | 
| 51 | 
            +
             | 
| 52 52 | 
             
                  // Populate our constructed prototype object
         | 
| 53 53 | 
             
                  Class.prototype = prototype;
         | 
| 54 | 
            -
             | 
| 54 | 
            +
             | 
| 55 55 | 
             
                  // Enforce the constructor to be what we expect
         | 
| 56 56 | 
             
                  Class.constructor = Class;
         | 
| 57 | 
            -
             | 
| 57 | 
            +
             | 
| 58 58 | 
             
                  // And make this class extendable
         | 
| 59 59 | 
             
                  Class.extend = arguments.callee;
         | 
| 60 | 
            -
             | 
| 60 | 
            +
             | 
| 61 61 | 
             
                  return Class;
         | 
| 62 62 | 
             
                };
         | 
| 63 63 | 
             
              })();
         | 
| @@ -66,9 +66,9 @@ if (typeof(Class) === 'undefined') { | |
| 66 66 | 
             
            /*
         | 
| 67 67 | 
             
             jQuery delayed observer
         | 
| 68 68 | 
             
             (c) 2007 - Maxime Haineault (max@centdessin.com)
         | 
| 69 | 
            -
             | 
| 69 | 
            +
             | 
| 70 70 | 
             
             Special thanks to Stephen Goguen & Tane Piper.
         | 
| 71 | 
            -
             | 
| 71 | 
            +
             | 
| 72 72 | 
             
             Slight modifications by Elliot Winkler
         | 
| 73 73 | 
             
            */
         | 
| 74 74 |  | 
| @@ -116,13 +116,12 @@ var RecordSelect = new Object(); | |
| 116 116 | 
             
            RecordSelect.document_loaded = false;
         | 
| 117 117 |  | 
| 118 118 | 
             
            RecordSelect.select_item = function(item) {
         | 
| 119 | 
            -
              var rs = item.closest('.record-select-handler');
         | 
| 120 | 
            -
               | 
| 121 | 
            -
              if (typeof onselect != 'function') onselect = eval(onselect);
         | 
| 122 | 
            -
              if (onselect) {
         | 
| 119 | 
            +
              var rs = item.closest('.record-select-handler').data('recordselect');
         | 
| 120 | 
            +
              if (rs) {
         | 
| 123 121 | 
             
                try {
         | 
| 124 122 | 
             
                  var label = item.find('label').first().text().trim(), text = item.text().trim();
         | 
| 125 | 
            -
                   | 
| 123 | 
            +
                  rs.obj.focus();
         | 
| 124 | 
            +
                  rs.onselect(item.attr('id').substr(2), label || text, text, item);
         | 
| 126 125 | 
             
                } catch(e) {
         | 
| 127 126 | 
             
                  alert(e);
         | 
| 128 127 | 
             
                }
         | 
| @@ -215,7 +214,7 @@ RecordSelect.Abstract = Class.extend({ | |
| 215 214 | 
             
                var offset = this.obj.offset(), scroll = jQuery(window).scrollTop(), window_height = jQuery(window).height();
         | 
| 216 215 | 
             
                if (this.fixed) offset.top -= scroll; // get fixed position
         | 
| 217 216 | 
             
                var top = this.obj.outerHeight() + offset.top, document_height = jQuery(document).height();
         | 
| 218 | 
            -
             | 
| 217 | 
            +
             | 
| 219 218 | 
             
                this.container.show();
         | 
| 220 219 | 
             
                var height = this.container.outerHeight();
         | 
| 221 220 | 
             
                this.container.css('left', offset.left);
         | 
| @@ -285,6 +284,7 @@ RecordSelect.Abstract = Class.extend({ | |
| 285 284 | 
             
              create_container: function() {
         | 
| 286 285 | 
             
                var e = jQuery("<div />", {'class': "record-select-container record-select-handler"}), rs = this;
         | 
| 287 286 | 
             
                e.css('display', 'none');
         | 
| 287 | 
            +
                e.data('recordselect', rs);
         | 
| 288 288 | 
             
                jQuery(this.obj).add(this.obj.parents()).each(function() {
         | 
| 289 289 | 
             
                  if (jQuery(this).css('position') == 'fixed') {
         | 
| 290 290 | 
             
                    rs.fixed = jQuery(this);
         | 
| @@ -297,7 +297,7 @@ RecordSelect.Abstract = Class.extend({ | |
| 297 297 | 
             
                e.get(0).onselect = jQuery.proxy(this, "onselect")
         | 
| 298 298 | 
             
                return e;
         | 
| 299 299 | 
             
              },
         | 
| 300 | 
            -
             | 
| 300 | 
            +
             | 
| 301 301 | 
             
              onkeyup: function(event) {
         | 
| 302 302 | 
             
                if (!this.is_open()) return;
         | 
| 303 303 | 
             
                this.container.find('.text-input').val(this.obj.val()).trigger(event);
         | 
| @@ -418,6 +418,7 @@ RecordSelect.Single = RecordSelect.Abstract.extend({ | |
| 418 418 | 
             
                this.container.submit(function() {
         | 
| 419 419 | 
             
                  rs.hidden_input.val('');
         | 
| 420 420 | 
             
                  rs.obj.removeClass('selected');
         | 
| 421 | 
            +
                  rs.obj.trigger('recordselect:unset', [rs]);
         | 
| 421 422 | 
             
                });
         | 
| 422 423 |  | 
| 423 424 | 
             
                // create the hidden input
         | 
| @@ -447,7 +448,7 @@ RecordSelect.Single = RecordSelect.Abstract.extend({ | |
| 447 448 | 
             
               */
         | 
| 448 449 | 
             
              set: function(id, label) {
         | 
| 449 450 | 
             
                // unescaped html missing for label
         | 
| 450 | 
            -
                this.obj.val(label); | 
| 451 | 
            +
                this.obj.val(label);
         | 
| 451 452 | 
             
                this.hidden_input.val(id);
         | 
| 452 453 | 
             
                this.obj.addClass('selected');
         | 
| 453 454 | 
             
              }
         | 
| @@ -490,7 +491,7 @@ RecordSelect.Autocomplete = RecordSelect.Abstract.extend({ | |
| 490 491 | 
             
               */
         | 
| 491 492 | 
             
              set: function(label) {
         | 
| 492 493 | 
             
                // unescaped html missing for label
         | 
| 493 | 
            -
                this.obj.val(label); | 
| 494 | 
            +
                this.obj.val(label);
         | 
| 494 495 | 
             
              }
         | 
| 495 496 | 
             
            });
         | 
| 496 497 |  | 
| @@ -516,7 +517,7 @@ RecordSelect.Multiple = RecordSelect.Abstract.extend({ | |
| 516 517 |  | 
| 517 518 | 
             
                // initialize the list
         | 
| 518 519 | 
             
                for(var i = 0, length = this.options.current.length; i < length; i++) {
         | 
| 519 | 
            -
                  this.add(this.options.current[i].id, this.options.current[i].label); | 
| 520 | 
            +
                  this.add(this.options.current[i].id, this.options.current[i].label);
         | 
| 520 521 | 
             
                }
         | 
| 521 522 |  | 
| 522 523 | 
             
                this._respond_to_text_field(this.obj);
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: recordselect
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 3.4. | 
| 4 | 
            +
              version: 3.4.7
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Sergio Cambra
         | 
| @@ -10,7 +10,7 @@ authors: | |
| 10 10 | 
             
            autorequire: 
         | 
| 11 11 | 
             
            bindir: bin
         | 
| 12 12 | 
             
            cert_chain: []
         | 
| 13 | 
            -
            date: 2015-07- | 
| 13 | 
            +
            date: 2015-07-30 00:00:00.000000000 Z
         | 
| 14 14 | 
             
            dependencies:
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 16 16 | 
             
              name: shoulda
         |