solidus_json_api 0.3.0

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.
Files changed (140) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.rspec +2 -0
  4. data/CHANGELOG.md +224 -0
  5. data/Gemfile +6 -0
  6. data/LICENSE +26 -0
  7. data/README.md +94 -0
  8. data/Rakefile +38 -0
  9. data/app/controllers/concerns/spree/api/v2/renderable.rb +63 -0
  10. data/app/controllers/spree/api/v2/base_controller.rb +9 -0
  11. data/app/controllers/spree/api/v2/children_controller.rb +29 -0
  12. data/app/controllers/spree/api/v2/countries_controller.rb +21 -0
  13. data/app/controllers/spree/api/v2/images_controller.rb +29 -0
  14. data/app/controllers/spree/api/v2/line_items_controller.rb +36 -0
  15. data/app/controllers/spree/api/v2/option_types_controller.rb +31 -0
  16. data/app/controllers/spree/api/v2/option_values_controller.rb +29 -0
  17. data/app/controllers/spree/api/v2/orders_controller.rb +21 -0
  18. data/app/controllers/spree/api/v2/prices_controller.rb +27 -0
  19. data/app/controllers/spree/api/v2/products_controller.rb +37 -0
  20. data/app/controllers/spree/api/v2/states_controller.rb +29 -0
  21. data/app/controllers/spree/api/v2/taxonomies_controller.rb +21 -0
  22. data/app/controllers/spree/api/v2/taxons_controller.rb +40 -0
  23. data/app/controllers/spree/api/v2/variants_controller.rb +35 -0
  24. data/app/models/spree/base_decorator.rb +5 -0
  25. data/app/models/spree/image_decorator.rb +3 -0
  26. data/app/models/spree/line_item_decorator.rb +3 -0
  27. data/app/models/spree/order_decorator.rb +3 -0
  28. data/app/models/spree/price_decorator.rb +3 -0
  29. data/app/models/spree/state_decorator.rb +3 -0
  30. data/app/serializers/spree/address_serializer.rb +9 -0
  31. data/app/serializers/spree/base_serializer.rb +13 -0
  32. data/app/serializers/spree/country_serializer.rb +7 -0
  33. data/app/serializers/spree/error_serializer.rb +55 -0
  34. data/app/serializers/spree/image_serializer.rb +13 -0
  35. data/app/serializers/spree/line_item_serializer.rb +13 -0
  36. data/app/serializers/spree/option_type_serializer.rb +8 -0
  37. data/app/serializers/spree/option_value_serializer.rb +8 -0
  38. data/app/serializers/spree/order_serializer.rb +20 -0
  39. data/app/serializers/spree/price_serializer.rb +7 -0
  40. data/app/serializers/spree/product_serializer.rb +12 -0
  41. data/app/serializers/spree/role_serializer.rb +5 -0
  42. data/app/serializers/spree/state_serializer.rb +7 -0
  43. data/app/serializers/spree/store_serializer.rb +6 -0
  44. data/app/serializers/spree/taxon_serializer.rb +16 -0
  45. data/app/serializers/spree/taxonomy_serializer.rb +7 -0
  46. data/app/serializers/spree/user_serializer.rb +5 -0
  47. data/app/serializers/spree/variant_serializer.rb +12 -0
  48. data/circle.yml +12 -0
  49. data/config/locales/en.yml +25 -0
  50. data/config/routes.rb +53 -0
  51. data/docs/.nojekyll +0 -0
  52. data/docs/Dockerfile +12 -0
  53. data/docs/Gemfile +14 -0
  54. data/docs/README.md +12 -0
  55. data/docs/Rakefile +9 -0
  56. data/docs/config.rb +39 -0
  57. data/docs/font-selection.json +148 -0
  58. data/docs/source/CNAME +1 -0
  59. data/docs/source/fonts/slate.eot +0 -0
  60. data/docs/source/fonts/slate.svg +14 -0
  61. data/docs/source/fonts/slate.ttf +0 -0
  62. data/docs/source/fonts/slate.woff +0 -0
  63. data/docs/source/fonts/slate.woff2 +0 -0
  64. data/docs/source/images/favicon.ico +0 -0
  65. data/docs/source/images/navbar.png +0 -0
  66. data/docs/source/includes/_countries.md +133 -0
  67. data/docs/source/includes/_errors.md +17 -0
  68. data/docs/source/includes/_filtering.md +11 -0
  69. data/docs/source/includes/_images.md +201 -0
  70. data/docs/source/includes/_line_items.md +143 -0
  71. data/docs/source/includes/_option_types.md +267 -0
  72. data/docs/source/includes/_option_values.md +227 -0
  73. data/docs/source/includes/_orders.md +150 -0
  74. data/docs/source/includes/_pagination.md +10 -0
  75. data/docs/source/includes/_prices.md +188 -0
  76. data/docs/source/includes/_products.md +407 -0
  77. data/docs/source/includes/_states.md +96 -0
  78. data/docs/source/includes/_taxonomies.md +325 -0
  79. data/docs/source/includes/_taxons.md +414 -0
  80. data/docs/source/includes/_variants.md +430 -0
  81. data/docs/source/index.md +51 -0
  82. data/docs/source/javascripts/all.js +4 -0
  83. data/docs/source/javascripts/all_nosearch.js +3 -0
  84. data/docs/source/javascripts/app/_lang.js +162 -0
  85. data/docs/source/javascripts/app/_search.js +74 -0
  86. data/docs/source/javascripts/app/_toc.js +55 -0
  87. data/docs/source/javascripts/lib/_energize.js +169 -0
  88. data/docs/source/javascripts/lib/_imagesloaded.min.js +7 -0
  89. data/docs/source/javascripts/lib/_jquery.highlight.js +108 -0
  90. data/docs/source/javascripts/lib/_jquery.tocify.js +1042 -0
  91. data/docs/source/javascripts/lib/_jquery_ui.js +566 -0
  92. data/docs/source/javascripts/lib/_lunr.js +1910 -0
  93. data/docs/source/layouts/layout.erb +110 -0
  94. data/docs/source/stylesheets/_icon-font.scss +38 -0
  95. data/docs/source/stylesheets/_normalize.css +427 -0
  96. data/docs/source/stylesheets/_syntax.scss.erb +27 -0
  97. data/docs/source/stylesheets/_variables.scss +109 -0
  98. data/docs/source/stylesheets/print.css.scss +142 -0
  99. data/docs/source/stylesheets/screen.css.scss +622 -0
  100. data/lib/solidus_json_api/config.rb +8 -0
  101. data/lib/solidus_json_api/engine.rb +21 -0
  102. data/lib/solidus_json_api.rb +5 -0
  103. data/solidus_json_api.gemspec +36 -0
  104. data/spec/controllers/spree/api/v2/base_controller_spec.rb +46 -0
  105. data/spec/controllers/spree/api/v2/children_controller_spec.rb +28 -0
  106. data/spec/controllers/spree/api/v2/countries_controller_spec.rb +25 -0
  107. data/spec/controllers/spree/api/v2/images_controller_spec.rb +91 -0
  108. data/spec/controllers/spree/api/v2/line_items_controller_spec.rb +101 -0
  109. data/spec/controllers/spree/api/v2/option_types_controller_spec.rb +71 -0
  110. data/spec/controllers/spree/api/v2/option_values_controller_spec.rb +88 -0
  111. data/spec/controllers/spree/api/v2/orders_controller_spec.rb +61 -0
  112. data/spec/controllers/spree/api/v2/prices_controller_spec.rb +55 -0
  113. data/spec/controllers/spree/api/v2/products_controller_spec.rb +99 -0
  114. data/spec/controllers/spree/api/v2/states_controller_spec.rb +42 -0
  115. data/spec/controllers/spree/api/v2/taxonomies_controller_spec.rb +31 -0
  116. data/spec/controllers/spree/api/v2/taxons_controller_spec.rb +54 -0
  117. data/spec/controllers/spree/api/v2/variants_controller_spec.rb +106 -0
  118. data/spec/lib/solidus_json_api/config_spec.rb +10 -0
  119. data/spec/models/spree/base_decorator_spec.rb +9 -0
  120. data/spec/models/spree/price_decorator_spec.rb +3 -0
  121. data/spec/serializers/spree/address_serializer_spec.rb +35 -0
  122. data/spec/serializers/spree/country_serializer_spec.rb +27 -0
  123. data/spec/serializers/spree/error_serializer_spec.rb +141 -0
  124. data/spec/serializers/spree/image_serializer_spec.rb +30 -0
  125. data/spec/serializers/spree/line_item_serializer_spec.rb +40 -0
  126. data/spec/serializers/spree/option_type_serializer_spec.rb +27 -0
  127. data/spec/serializers/spree/option_value_serializer_spec.rb +29 -0
  128. data/spec/serializers/spree/order_serializer_spec.rb +68 -0
  129. data/spec/serializers/spree/price_serializer_spec.rb +28 -0
  130. data/spec/serializers/spree/product_serializer_spec.rb +47 -0
  131. data/spec/serializers/spree/role_serializer_spec.rb +17 -0
  132. data/spec/serializers/spree/state_serializer_spec.rb +25 -0
  133. data/spec/serializers/spree/store_serializer_spec.rb +25 -0
  134. data/spec/serializers/spree/taxon_serializer_spec.rb +44 -0
  135. data/spec/serializers/spree/taxonomy_serializer_spec.rb +27 -0
  136. data/spec/serializers/spree/user_serializer_spec.rb +17 -0
  137. data/spec/serializers/spree/variant_serializer_spec.rb +55 -0
  138. data/spec/spec_helper.rb +57 -0
  139. data/spec/support/shoulda_matchers.rb +6 -0
  140. metadata +442 -0
@@ -0,0 +1,566 @@
1
+ /*! jQuery UI - v1.11.3 - 2015-02-12
2
+ * http://jqueryui.com
3
+ * Includes: widget.js
4
+ * Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
5
+
6
+ (function( factory ) {
7
+ if ( typeof define === "function" && define.amd ) {
8
+
9
+ // AMD. Register as an anonymous module.
10
+ define([ "jquery" ], factory );
11
+ } else {
12
+
13
+ // Browser globals
14
+ factory( jQuery );
15
+ }
16
+ }(function( $ ) {
17
+ /*!
18
+ * jQuery UI Widget 1.11.3
19
+ * http://jqueryui.com
20
+ *
21
+ * Copyright jQuery Foundation and other contributors
22
+ * Released under the MIT license.
23
+ * http://jquery.org/license
24
+ *
25
+ * http://api.jqueryui.com/jQuery.widget/
26
+ */
27
+
28
+
29
+ var widget_uuid = 0,
30
+ widget_slice = Array.prototype.slice;
31
+
32
+ $.cleanData = (function( orig ) {
33
+ return function( elems ) {
34
+ var events, elem, i;
35
+ for ( i = 0; (elem = elems[i]) != null; i++ ) {
36
+ try {
37
+
38
+ // Only trigger remove when necessary to save time
39
+ events = $._data( elem, "events" );
40
+ if ( events && events.remove ) {
41
+ $( elem ).triggerHandler( "remove" );
42
+ }
43
+
44
+ // http://bugs.jquery.com/ticket/8235
45
+ } catch ( e ) {}
46
+ }
47
+ orig( elems );
48
+ };
49
+ })( $.cleanData );
50
+
51
+ $.widget = function( name, base, prototype ) {
52
+ var fullName, existingConstructor, constructor, basePrototype,
53
+ // proxiedPrototype allows the provided prototype to remain unmodified
54
+ // so that it can be used as a mixin for multiple widgets (#8876)
55
+ proxiedPrototype = {},
56
+ namespace = name.split( "." )[ 0 ];
57
+
58
+ name = name.split( "." )[ 1 ];
59
+ fullName = namespace + "-" + name;
60
+
61
+ if ( !prototype ) {
62
+ prototype = base;
63
+ base = $.Widget;
64
+ }
65
+
66
+ // create selector for plugin
67
+ $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
68
+ return !!$.data( elem, fullName );
69
+ };
70
+
71
+ $[ namespace ] = $[ namespace ] || {};
72
+ existingConstructor = $[ namespace ][ name ];
73
+ constructor = $[ namespace ][ name ] = function( options, element ) {
74
+ // allow instantiation without "new" keyword
75
+ if ( !this._createWidget ) {
76
+ return new constructor( options, element );
77
+ }
78
+
79
+ // allow instantiation without initializing for simple inheritance
80
+ // must use "new" keyword (the code above always passes args)
81
+ if ( arguments.length ) {
82
+ this._createWidget( options, element );
83
+ }
84
+ };
85
+ // extend with the existing constructor to carry over any static properties
86
+ $.extend( constructor, existingConstructor, {
87
+ version: prototype.version,
88
+ // copy the object used to create the prototype in case we need to
89
+ // redefine the widget later
90
+ _proto: $.extend( {}, prototype ),
91
+ // track widgets that inherit from this widget in case this widget is
92
+ // redefined after a widget inherits from it
93
+ _childConstructors: []
94
+ });
95
+
96
+ basePrototype = new base();
97
+ // we need to make the options hash a property directly on the new instance
98
+ // otherwise we'll modify the options hash on the prototype that we're
99
+ // inheriting from
100
+ basePrototype.options = $.widget.extend( {}, basePrototype.options );
101
+ $.each( prototype, function( prop, value ) {
102
+ if ( !$.isFunction( value ) ) {
103
+ proxiedPrototype[ prop ] = value;
104
+ return;
105
+ }
106
+ proxiedPrototype[ prop ] = (function() {
107
+ var _super = function() {
108
+ return base.prototype[ prop ].apply( this, arguments );
109
+ },
110
+ _superApply = function( args ) {
111
+ return base.prototype[ prop ].apply( this, args );
112
+ };
113
+ return function() {
114
+ var __super = this._super,
115
+ __superApply = this._superApply,
116
+ returnValue;
117
+
118
+ this._super = _super;
119
+ this._superApply = _superApply;
120
+
121
+ returnValue = value.apply( this, arguments );
122
+
123
+ this._super = __super;
124
+ this._superApply = __superApply;
125
+
126
+ return returnValue;
127
+ };
128
+ })();
129
+ });
130
+ constructor.prototype = $.widget.extend( basePrototype, {
131
+ // TODO: remove support for widgetEventPrefix
132
+ // always use the name + a colon as the prefix, e.g., draggable:start
133
+ // don't prefix for widgets that aren't DOM-based
134
+ widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
135
+ }, proxiedPrototype, {
136
+ constructor: constructor,
137
+ namespace: namespace,
138
+ widgetName: name,
139
+ widgetFullName: fullName
140
+ });
141
+
142
+ // If this widget is being redefined then we need to find all widgets that
143
+ // are inheriting from it and redefine all of them so that they inherit from
144
+ // the new version of this widget. We're essentially trying to replace one
145
+ // level in the prototype chain.
146
+ if ( existingConstructor ) {
147
+ $.each( existingConstructor._childConstructors, function( i, child ) {
148
+ var childPrototype = child.prototype;
149
+
150
+ // redefine the child widget using the same prototype that was
151
+ // originally used, but inherit from the new version of the base
152
+ $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
153
+ });
154
+ // remove the list of existing child constructors from the old constructor
155
+ // so the old child constructors can be garbage collected
156
+ delete existingConstructor._childConstructors;
157
+ } else {
158
+ base._childConstructors.push( constructor );
159
+ }
160
+
161
+ $.widget.bridge( name, constructor );
162
+
163
+ return constructor;
164
+ };
165
+
166
+ $.widget.extend = function( target ) {
167
+ var input = widget_slice.call( arguments, 1 ),
168
+ inputIndex = 0,
169
+ inputLength = input.length,
170
+ key,
171
+ value;
172
+ for ( ; inputIndex < inputLength; inputIndex++ ) {
173
+ for ( key in input[ inputIndex ] ) {
174
+ value = input[ inputIndex ][ key ];
175
+ if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
176
+ // Clone objects
177
+ if ( $.isPlainObject( value ) ) {
178
+ target[ key ] = $.isPlainObject( target[ key ] ) ?
179
+ $.widget.extend( {}, target[ key ], value ) :
180
+ // Don't extend strings, arrays, etc. with objects
181
+ $.widget.extend( {}, value );
182
+ // Copy everything else by reference
183
+ } else {
184
+ target[ key ] = value;
185
+ }
186
+ }
187
+ }
188
+ }
189
+ return target;
190
+ };
191
+
192
+ $.widget.bridge = function( name, object ) {
193
+ var fullName = object.prototype.widgetFullName || name;
194
+ $.fn[ name ] = function( options ) {
195
+ var isMethodCall = typeof options === "string",
196
+ args = widget_slice.call( arguments, 1 ),
197
+ returnValue = this;
198
+
199
+ if ( isMethodCall ) {
200
+ this.each(function() {
201
+ var methodValue,
202
+ instance = $.data( this, fullName );
203
+ if ( options === "instance" ) {
204
+ returnValue = instance;
205
+ return false;
206
+ }
207
+ if ( !instance ) {
208
+ return $.error( "cannot call methods on " + name + " prior to initialization; " +
209
+ "attempted to call method '" + options + "'" );
210
+ }
211
+ if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
212
+ return $.error( "no such method '" + options + "' for " + name + " widget instance" );
213
+ }
214
+ methodValue = instance[ options ].apply( instance, args );
215
+ if ( methodValue !== instance && methodValue !== undefined ) {
216
+ returnValue = methodValue && methodValue.jquery ?
217
+ returnValue.pushStack( methodValue.get() ) :
218
+ methodValue;
219
+ return false;
220
+ }
221
+ });
222
+ } else {
223
+
224
+ // Allow multiple hashes to be passed on init
225
+ if ( args.length ) {
226
+ options = $.widget.extend.apply( null, [ options ].concat(args) );
227
+ }
228
+
229
+ this.each(function() {
230
+ var instance = $.data( this, fullName );
231
+ if ( instance ) {
232
+ instance.option( options || {} );
233
+ if ( instance._init ) {
234
+ instance._init();
235
+ }
236
+ } else {
237
+ $.data( this, fullName, new object( options, this ) );
238
+ }
239
+ });
240
+ }
241
+
242
+ return returnValue;
243
+ };
244
+ };
245
+
246
+ $.Widget = function( /* options, element */ ) {};
247
+ $.Widget._childConstructors = [];
248
+
249
+ $.Widget.prototype = {
250
+ widgetName: "widget",
251
+ widgetEventPrefix: "",
252
+ defaultElement: "<div>",
253
+ options: {
254
+ disabled: false,
255
+
256
+ // callbacks
257
+ create: null
258
+ },
259
+ _createWidget: function( options, element ) {
260
+ element = $( element || this.defaultElement || this )[ 0 ];
261
+ this.element = $( element );
262
+ this.uuid = widget_uuid++;
263
+ this.eventNamespace = "." + this.widgetName + this.uuid;
264
+
265
+ this.bindings = $();
266
+ this.hoverable = $();
267
+ this.focusable = $();
268
+
269
+ if ( element !== this ) {
270
+ $.data( element, this.widgetFullName, this );
271
+ this._on( true, this.element, {
272
+ remove: function( event ) {
273
+ if ( event.target === element ) {
274
+ this.destroy();
275
+ }
276
+ }
277
+ });
278
+ this.document = $( element.style ?
279
+ // element within the document
280
+ element.ownerDocument :
281
+ // element is window or document
282
+ element.document || element );
283
+ this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
284
+ }
285
+
286
+ this.options = $.widget.extend( {},
287
+ this.options,
288
+ this._getCreateOptions(),
289
+ options );
290
+
291
+ this._create();
292
+ this._trigger( "create", null, this._getCreateEventData() );
293
+ this._init();
294
+ },
295
+ _getCreateOptions: $.noop,
296
+ _getCreateEventData: $.noop,
297
+ _create: $.noop,
298
+ _init: $.noop,
299
+
300
+ destroy: function() {
301
+ this._destroy();
302
+ // we can probably remove the unbind calls in 2.0
303
+ // all event bindings should go through this._on()
304
+ this.element
305
+ .unbind( this.eventNamespace )
306
+ .removeData( this.widgetFullName )
307
+ // support: jquery <1.6.3
308
+ // http://bugs.jquery.com/ticket/9413
309
+ .removeData( $.camelCase( this.widgetFullName ) );
310
+ this.widget()
311
+ .unbind( this.eventNamespace )
312
+ .removeAttr( "aria-disabled" )
313
+ .removeClass(
314
+ this.widgetFullName + "-disabled " +
315
+ "ui-state-disabled" );
316
+
317
+ // clean up events and states
318
+ this.bindings.unbind( this.eventNamespace );
319
+ this.hoverable.removeClass( "ui-state-hover" );
320
+ this.focusable.removeClass( "ui-state-focus" );
321
+ },
322
+ _destroy: $.noop,
323
+
324
+ widget: function() {
325
+ return this.element;
326
+ },
327
+
328
+ option: function( key, value ) {
329
+ var options = key,
330
+ parts,
331
+ curOption,
332
+ i;
333
+
334
+ if ( arguments.length === 0 ) {
335
+ // don't return a reference to the internal hash
336
+ return $.widget.extend( {}, this.options );
337
+ }
338
+
339
+ if ( typeof key === "string" ) {
340
+ // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
341
+ options = {};
342
+ parts = key.split( "." );
343
+ key = parts.shift();
344
+ if ( parts.length ) {
345
+ curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
346
+ for ( i = 0; i < parts.length - 1; i++ ) {
347
+ curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
348
+ curOption = curOption[ parts[ i ] ];
349
+ }
350
+ key = parts.pop();
351
+ if ( arguments.length === 1 ) {
352
+ return curOption[ key ] === undefined ? null : curOption[ key ];
353
+ }
354
+ curOption[ key ] = value;
355
+ } else {
356
+ if ( arguments.length === 1 ) {
357
+ return this.options[ key ] === undefined ? null : this.options[ key ];
358
+ }
359
+ options[ key ] = value;
360
+ }
361
+ }
362
+
363
+ this._setOptions( options );
364
+
365
+ return this;
366
+ },
367
+ _setOptions: function( options ) {
368
+ var key;
369
+
370
+ for ( key in options ) {
371
+ this._setOption( key, options[ key ] );
372
+ }
373
+
374
+ return this;
375
+ },
376
+ _setOption: function( key, value ) {
377
+ this.options[ key ] = value;
378
+
379
+ if ( key === "disabled" ) {
380
+ this.widget()
381
+ .toggleClass( this.widgetFullName + "-disabled", !!value );
382
+
383
+ // If the widget is becoming disabled, then nothing is interactive
384
+ if ( value ) {
385
+ this.hoverable.removeClass( "ui-state-hover" );
386
+ this.focusable.removeClass( "ui-state-focus" );
387
+ }
388
+ }
389
+
390
+ return this;
391
+ },
392
+
393
+ enable: function() {
394
+ return this._setOptions({ disabled: false });
395
+ },
396
+ disable: function() {
397
+ return this._setOptions({ disabled: true });
398
+ },
399
+
400
+ _on: function( suppressDisabledCheck, element, handlers ) {
401
+ var delegateElement,
402
+ instance = this;
403
+
404
+ // no suppressDisabledCheck flag, shuffle arguments
405
+ if ( typeof suppressDisabledCheck !== "boolean" ) {
406
+ handlers = element;
407
+ element = suppressDisabledCheck;
408
+ suppressDisabledCheck = false;
409
+ }
410
+
411
+ // no element argument, shuffle and use this.element
412
+ if ( !handlers ) {
413
+ handlers = element;
414
+ element = this.element;
415
+ delegateElement = this.widget();
416
+ } else {
417
+ element = delegateElement = $( element );
418
+ this.bindings = this.bindings.add( element );
419
+ }
420
+
421
+ $.each( handlers, function( event, handler ) {
422
+ function handlerProxy() {
423
+ // allow widgets to customize the disabled handling
424
+ // - disabled as an array instead of boolean
425
+ // - disabled class as method for disabling individual parts
426
+ if ( !suppressDisabledCheck &&
427
+ ( instance.options.disabled === true ||
428
+ $( this ).hasClass( "ui-state-disabled" ) ) ) {
429
+ return;
430
+ }
431
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
432
+ .apply( instance, arguments );
433
+ }
434
+
435
+ // copy the guid so direct unbinding works
436
+ if ( typeof handler !== "string" ) {
437
+ handlerProxy.guid = handler.guid =
438
+ handler.guid || handlerProxy.guid || $.guid++;
439
+ }
440
+
441
+ var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
442
+ eventName = match[1] + instance.eventNamespace,
443
+ selector = match[2];
444
+ if ( selector ) {
445
+ delegateElement.delegate( selector, eventName, handlerProxy );
446
+ } else {
447
+ element.bind( eventName, handlerProxy );
448
+ }
449
+ });
450
+ },
451
+
452
+ _off: function( element, eventName ) {
453
+ eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
454
+ this.eventNamespace;
455
+ element.unbind( eventName ).undelegate( eventName );
456
+
457
+ // Clear the stack to avoid memory leaks (#10056)
458
+ this.bindings = $( this.bindings.not( element ).get() );
459
+ this.focusable = $( this.focusable.not( element ).get() );
460
+ this.hoverable = $( this.hoverable.not( element ).get() );
461
+ },
462
+
463
+ _delay: function( handler, delay ) {
464
+ function handlerProxy() {
465
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
466
+ .apply( instance, arguments );
467
+ }
468
+ var instance = this;
469
+ return setTimeout( handlerProxy, delay || 0 );
470
+ },
471
+
472
+ _hoverable: function( element ) {
473
+ this.hoverable = this.hoverable.add( element );
474
+ this._on( element, {
475
+ mouseenter: function( event ) {
476
+ $( event.currentTarget ).addClass( "ui-state-hover" );
477
+ },
478
+ mouseleave: function( event ) {
479
+ $( event.currentTarget ).removeClass( "ui-state-hover" );
480
+ }
481
+ });
482
+ },
483
+
484
+ _focusable: function( element ) {
485
+ this.focusable = this.focusable.add( element );
486
+ this._on( element, {
487
+ focusin: function( event ) {
488
+ $( event.currentTarget ).addClass( "ui-state-focus" );
489
+ },
490
+ focusout: function( event ) {
491
+ $( event.currentTarget ).removeClass( "ui-state-focus" );
492
+ }
493
+ });
494
+ },
495
+
496
+ _trigger: function( type, event, data ) {
497
+ var prop, orig,
498
+ callback = this.options[ type ];
499
+
500
+ data = data || {};
501
+ event = $.Event( event );
502
+ event.type = ( type === this.widgetEventPrefix ?
503
+ type :
504
+ this.widgetEventPrefix + type ).toLowerCase();
505
+ // the original event may come from any element
506
+ // so we need to reset the target on the new event
507
+ event.target = this.element[ 0 ];
508
+
509
+ // copy original event properties over to the new event
510
+ orig = event.originalEvent;
511
+ if ( orig ) {
512
+ for ( prop in orig ) {
513
+ if ( !( prop in event ) ) {
514
+ event[ prop ] = orig[ prop ];
515
+ }
516
+ }
517
+ }
518
+
519
+ this.element.trigger( event, data );
520
+ return !( $.isFunction( callback ) &&
521
+ callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
522
+ event.isDefaultPrevented() );
523
+ }
524
+ };
525
+
526
+ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
527
+ $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
528
+ if ( typeof options === "string" ) {
529
+ options = { effect: options };
530
+ }
531
+ var hasOptions,
532
+ effectName = !options ?
533
+ method :
534
+ options === true || typeof options === "number" ?
535
+ defaultEffect :
536
+ options.effect || defaultEffect;
537
+ options = options || {};
538
+ if ( typeof options === "number" ) {
539
+ options = { duration: options };
540
+ }
541
+ hasOptions = !$.isEmptyObject( options );
542
+ options.complete = callback;
543
+ if ( options.delay ) {
544
+ element.delay( options.delay );
545
+ }
546
+ if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
547
+ element[ method ]( options );
548
+ } else if ( effectName !== method && element[ effectName ] ) {
549
+ element[ effectName ]( options.duration, options.easing, callback );
550
+ } else {
551
+ element.queue(function( next ) {
552
+ $( this )[ method ]();
553
+ if ( callback ) {
554
+ callback.call( element[ 0 ] );
555
+ }
556
+ next();
557
+ });
558
+ }
559
+ };
560
+ });
561
+
562
+ var widget = $.widget;
563
+
564
+
565
+
566
+ }));