trusty-cms 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +6 -6
- data/app/assets/javascripts/admin/assets_admin.js +0 -1
- data/app/assets/stylesheets/admin/main.scss +1 -1
- data/app/mailers/devise_mailer.rb +8 -0
- data/app/views/devise/sessions/new.html.haml +1 -1
- data/app/views/devise_mailer/reset_password_instructions.html.haml +5 -0
- data/config/initializers/devise.rb +1 -1
- data/config/routes.rb +3 -0
- data/lib/trusty_cms.rb +1 -1
- metadata +4 -3
- data/app/assets/javascripts/admin/jquery.ui.widget.js +0 -558
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cda63c816a2fcbf3b9ae3dbfc8c0a2be2ce50b9bc0b103780aaf85d8ad553840
|
4
|
+
data.tar.gz: abb18785e54c1ee6caf17e1f60e5d8521c494654da04d4fc4cacc10d56c39287
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 524fde7bdf413457452853b723302f0d055d6a207934f92b028a8a782b1ab8cb69780033128f9cd2a1b6e37e76455bf507a794bd5b56828e84e8ffc5ec8d6002
|
7
|
+
data.tar.gz: 92c35147763fdaaa09ee58636f3dd0d1d4a8f0a60d46cfc0e2d81c83de524e9112fd82218b5cd993b9f4c99ef5b0b8a9ea83457e139a9ee3a86337f3d18a3418
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
trusty-cms (4.0.
|
4
|
+
trusty-cms (4.0.1)
|
5
5
|
RedCloth (= 4.3.2)
|
6
6
|
acts_as_list (~> 0.9.5)
|
7
7
|
acts_as_tree (>= 2.6.1, < 2.9.0)
|
@@ -190,7 +190,7 @@ GEM
|
|
190
190
|
multipart-post (2.1.1)
|
191
191
|
mysql2 (0.5.3)
|
192
192
|
nio4r (2.5.2)
|
193
|
-
nokogiri (1.10.
|
193
|
+
nokogiri (1.10.9)
|
194
194
|
mini_portile2 (~> 2.4.0)
|
195
195
|
orm_adapter (0.5.0)
|
196
196
|
paperclip (6.1.0)
|
@@ -246,7 +246,7 @@ GEM
|
|
246
246
|
thor (>= 0.20.3, < 2.0)
|
247
247
|
rake (12.3.3)
|
248
248
|
rdoc (6.2.1)
|
249
|
-
regexp_parser (1.
|
249
|
+
regexp_parser (1.7.0)
|
250
250
|
responders (3.0.0)
|
251
251
|
actionpack (>= 5.0)
|
252
252
|
railties (>= 5.0)
|
@@ -284,10 +284,10 @@ GEM
|
|
284
284
|
sprockets-rails
|
285
285
|
tilt
|
286
286
|
sexp_processor (4.14.1)
|
287
|
-
simplecov (0.18.
|
287
|
+
simplecov (0.18.5)
|
288
288
|
docile (~> 1.1)
|
289
289
|
simplecov-html (~> 0.11)
|
290
|
-
simplecov-html (0.12.
|
290
|
+
simplecov-html (0.12.2)
|
291
291
|
sprockets (4.0.0)
|
292
292
|
concurrent-ruby (~> 1.0)
|
293
293
|
rack (> 1, < 3)
|
@@ -314,7 +314,7 @@ GEM
|
|
314
314
|
websocket-driver (0.7.1)
|
315
315
|
websocket-extensions (>= 0.1.0)
|
316
316
|
websocket-extensions (0.1.4)
|
317
|
-
will_paginate (3.
|
317
|
+
will_paginate (3.3.0)
|
318
318
|
xpath (3.2.0)
|
319
319
|
nokogiri (~> 1.8)
|
320
320
|
zeitwerk (2.2.2)
|
@@ -10,7 +10,6 @@
|
|
10
10
|
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
11
|
// GO AFTER THE REQUIRES BELOW.
|
12
12
|
//
|
13
|
-
//= require 'admin/jquery.ui.widget'
|
14
13
|
//= require 'admin/jquery.iframe-transport'
|
15
14
|
//= require 'admin/jquery.fileupload'
|
16
15
|
//= require 'admin/assets'
|
@@ -4,7 +4,7 @@
|
|
4
4
|
= image_tag('/assets/admin/default_safe_login.svg', alt: 'web browser with padlock on top')
|
5
5
|
.login
|
6
6
|
%h1 Log in
|
7
|
-
= form_for(resource, as: resource_name, url:
|
7
|
+
= form_for(resource, as: resource_name, url: authenticate_path) do |f|
|
8
8
|
.field
|
9
9
|
= f.label :email
|
10
10
|
%br/
|
@@ -0,0 +1,5 @@
|
|
1
|
+
%p
|
2
|
+
Hello #{@resource.email}!
|
3
|
+
%p Someone has requested a link to change your TrustyCMS password. You can do this through the link below.
|
4
|
+
%p= link_to 'Change my password', edit_user_password_url(@resource, reset_password_token: @token)
|
5
|
+
%p Your password won't change until you access the link above and create a new one.
|
@@ -29,7 +29,7 @@ Devise.setup do |config|
|
|
29
29
|
config.mailer_sender = ENV['ORG_FROM_EMAIL'] ||= 'admin@trustycms.org'
|
30
30
|
|
31
31
|
# Configure the class responsible to send e-mails.
|
32
|
-
|
32
|
+
config.mailer = 'DeviseMailer'
|
33
33
|
|
34
34
|
# Configure the parent class responsible to send e-mails.
|
35
35
|
# config.parent_mailer = 'ActionMailer::Base'
|
data/config/routes.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
TrustyCms::Application.routes.draw do
|
2
2
|
root to: 'site#show_page'
|
3
3
|
devise_for :users, module: :devise, :skip => :registration
|
4
|
+
as :user do
|
5
|
+
post 'authenticate', to: 'devise/sessions#create', as: :authenticate
|
6
|
+
end
|
4
7
|
get '/rad_social/mail' => 'social_mailer#social_mail_form', as: :rad_social_mail_form
|
5
8
|
post '/rad_social/mail' => 'social_mailer#create_social_mail', as: :rad_create_social_mail
|
6
9
|
TrustyCms::Application.config.enabled_extensions.each { |ext|
|
data/lib/trusty_cms.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trusty-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TrustyCms CMS dev team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: acts_as_list
|
@@ -571,7 +571,6 @@ files:
|
|
571
571
|
- app/assets/javascripts/admin/jquery.fileupload.js
|
572
572
|
- app/assets/javascripts/admin/jquery.iframe-transport.js
|
573
573
|
- app/assets/javascripts/admin/jquery.treetable.js
|
574
|
-
- app/assets/javascripts/admin/jquery.ui.widget.js
|
575
574
|
- app/assets/javascripts/admin/jquery.validate.min.js
|
576
575
|
- app/assets/javascripts/admin/modernizr.js
|
577
576
|
- app/assets/javascripts/admin/more-or-less.js
|
@@ -662,6 +661,7 @@ files:
|
|
662
661
|
- app/helpers/site_helper.rb
|
663
662
|
- app/helpers/sites_helper.rb
|
664
663
|
- app/mailers/application_mailer.rb
|
664
|
+
- app/mailers/devise_mailer.rb
|
665
665
|
- app/mailers/rad_social_mailer.rb
|
666
666
|
- app/models/asset.rb
|
667
667
|
- app/models/asset_type.rb
|
@@ -763,6 +763,7 @@ files:
|
|
763
763
|
- app/views/devise/passwords/new.html.haml
|
764
764
|
- app/views/devise/sessions/new.html.haml
|
765
765
|
- app/views/devise/shared/_links.html.haml
|
766
|
+
- app/views/devise_mailer/reset_password_instructions.html.haml
|
766
767
|
- app/views/layouts/application.html.haml
|
767
768
|
- app/views/layouts/mail.html.haml
|
768
769
|
- app/views/layouts/mailer.text.haml
|
@@ -1,558 +0,0 @@
|
|
1
|
-
/*! jQuery UI - v1.11.1 - 2014-09-17
|
2
|
-
* http://jqueryui.com
|
3
|
-
* Includes: widget.js
|
4
|
-
* Copyright 2014 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.1
|
19
|
-
* http://jqueryui.com
|
20
|
-
*
|
21
|
-
* Copyright 2014 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
|
-
// allow multiple hashes to be passed on init
|
200
|
-
options = !isMethodCall && args.length ?
|
201
|
-
$.widget.extend.apply( null, [ options ].concat(args) ) :
|
202
|
-
options;
|
203
|
-
|
204
|
-
if ( isMethodCall ) {
|
205
|
-
this.each(function() {
|
206
|
-
var methodValue,
|
207
|
-
instance = $.data( this, fullName );
|
208
|
-
if ( options === "instance" ) {
|
209
|
-
returnValue = instance;
|
210
|
-
return false;
|
211
|
-
}
|
212
|
-
if ( !instance ) {
|
213
|
-
return $.error( "cannot call methods on " + name + " prior to initialization; " +
|
214
|
-
"attempted to call method '" + options + "'" );
|
215
|
-
}
|
216
|
-
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
|
217
|
-
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
|
218
|
-
}
|
219
|
-
methodValue = instance[ options ].apply( instance, args );
|
220
|
-
if ( methodValue !== instance && methodValue !== undefined ) {
|
221
|
-
returnValue = methodValue && methodValue.jquery ?
|
222
|
-
returnValue.pushStack( methodValue.get() ) :
|
223
|
-
methodValue;
|
224
|
-
return false;
|
225
|
-
}
|
226
|
-
});
|
227
|
-
} else {
|
228
|
-
this.each(function() {
|
229
|
-
var instance = $.data( this, fullName );
|
230
|
-
if ( instance ) {
|
231
|
-
instance.option( options || {} );
|
232
|
-
if ( instance._init ) {
|
233
|
-
instance._init();
|
234
|
-
}
|
235
|
-
} else {
|
236
|
-
$.data( this, fullName, new object( options, this ) );
|
237
|
-
}
|
238
|
-
});
|
239
|
-
}
|
240
|
-
|
241
|
-
return returnValue;
|
242
|
-
};
|
243
|
-
};
|
244
|
-
|
245
|
-
$.Widget = function( /* options, element */ ) {};
|
246
|
-
$.Widget._childConstructors = [];
|
247
|
-
|
248
|
-
$.Widget.prototype = {
|
249
|
-
widgetName: "widget",
|
250
|
-
widgetEventPrefix: "",
|
251
|
-
defaultElement: "<div>",
|
252
|
-
options: {
|
253
|
-
disabled: false,
|
254
|
-
|
255
|
-
// callbacks
|
256
|
-
create: null
|
257
|
-
},
|
258
|
-
_createWidget: function( options, element ) {
|
259
|
-
element = $( element || this.defaultElement || this )[ 0 ];
|
260
|
-
this.element = $( element );
|
261
|
-
this.uuid = widget_uuid++;
|
262
|
-
this.eventNamespace = "." + this.widgetName + this.uuid;
|
263
|
-
this.options = $.widget.extend( {},
|
264
|
-
this.options,
|
265
|
-
this._getCreateOptions(),
|
266
|
-
options );
|
267
|
-
|
268
|
-
this.bindings = $();
|
269
|
-
this.hoverable = $();
|
270
|
-
this.focusable = $();
|
271
|
-
|
272
|
-
if ( element !== this ) {
|
273
|
-
$.data( element, this.widgetFullName, this );
|
274
|
-
this._on( true, this.element, {
|
275
|
-
remove: function( event ) {
|
276
|
-
if ( event.target === element ) {
|
277
|
-
this.destroy();
|
278
|
-
}
|
279
|
-
}
|
280
|
-
});
|
281
|
-
this.document = $( element.style ?
|
282
|
-
// element within the document
|
283
|
-
element.ownerDocument :
|
284
|
-
// element is window or document
|
285
|
-
element.document || element );
|
286
|
-
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
|
287
|
-
}
|
288
|
-
|
289
|
-
this._create();
|
290
|
-
this._trigger( "create", null, this._getCreateEventData() );
|
291
|
-
this._init();
|
292
|
-
},
|
293
|
-
_getCreateOptions: $.noop,
|
294
|
-
_getCreateEventData: $.noop,
|
295
|
-
_create: $.noop,
|
296
|
-
_init: $.noop,
|
297
|
-
|
298
|
-
destroy: function() {
|
299
|
-
this._destroy();
|
300
|
-
// we can probably remove the unbind calls in 2.0
|
301
|
-
// all event bindings should go through this._on()
|
302
|
-
this.element
|
303
|
-
.unbind( this.eventNamespace )
|
304
|
-
.removeData( this.widgetFullName )
|
305
|
-
// support: jquery <1.6.3
|
306
|
-
// http://bugs.jquery.com/ticket/9413
|
307
|
-
.removeData( $.camelCase( this.widgetFullName ) );
|
308
|
-
this.widget()
|
309
|
-
.unbind( this.eventNamespace )
|
310
|
-
.removeAttr( "aria-disabled" )
|
311
|
-
.removeClass(
|
312
|
-
this.widgetFullName + "-disabled " +
|
313
|
-
"ui-state-disabled" );
|
314
|
-
|
315
|
-
// clean up events and states
|
316
|
-
this.bindings.unbind( this.eventNamespace );
|
317
|
-
this.hoverable.removeClass( "ui-state-hover" );
|
318
|
-
this.focusable.removeClass( "ui-state-focus" );
|
319
|
-
},
|
320
|
-
_destroy: $.noop,
|
321
|
-
|
322
|
-
widget: function() {
|
323
|
-
return this.element;
|
324
|
-
},
|
325
|
-
|
326
|
-
option: function( key, value ) {
|
327
|
-
var options = key,
|
328
|
-
parts,
|
329
|
-
curOption,
|
330
|
-
i;
|
331
|
-
|
332
|
-
if ( arguments.length === 0 ) {
|
333
|
-
// don't return a reference to the internal hash
|
334
|
-
return $.widget.extend( {}, this.options );
|
335
|
-
}
|
336
|
-
|
337
|
-
if ( typeof key === "string" ) {
|
338
|
-
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
339
|
-
options = {};
|
340
|
-
parts = key.split( "." );
|
341
|
-
key = parts.shift();
|
342
|
-
if ( parts.length ) {
|
343
|
-
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
|
344
|
-
for ( i = 0; i < parts.length - 1; i++ ) {
|
345
|
-
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
|
346
|
-
curOption = curOption[ parts[ i ] ];
|
347
|
-
}
|
348
|
-
key = parts.pop();
|
349
|
-
if ( arguments.length === 1 ) {
|
350
|
-
return curOption[ key ] === undefined ? null : curOption[ key ];
|
351
|
-
}
|
352
|
-
curOption[ key ] = value;
|
353
|
-
} else {
|
354
|
-
if ( arguments.length === 1 ) {
|
355
|
-
return this.options[ key ] === undefined ? null : this.options[ key ];
|
356
|
-
}
|
357
|
-
options[ key ] = value;
|
358
|
-
}
|
359
|
-
}
|
360
|
-
|
361
|
-
this._setOptions( options );
|
362
|
-
|
363
|
-
return this;
|
364
|
-
},
|
365
|
-
_setOptions: function( options ) {
|
366
|
-
var key;
|
367
|
-
|
368
|
-
for ( key in options ) {
|
369
|
-
this._setOption( key, options[ key ] );
|
370
|
-
}
|
371
|
-
|
372
|
-
return this;
|
373
|
-
},
|
374
|
-
_setOption: function( key, value ) {
|
375
|
-
this.options[ key ] = value;
|
376
|
-
|
377
|
-
if ( key === "disabled" ) {
|
378
|
-
this.widget()
|
379
|
-
.toggleClass( this.widgetFullName + "-disabled", !!value );
|
380
|
-
|
381
|
-
// If the widget is becoming disabled, then nothing is interactive
|
382
|
-
if ( value ) {
|
383
|
-
this.hoverable.removeClass( "ui-state-hover" );
|
384
|
-
this.focusable.removeClass( "ui-state-focus" );
|
385
|
-
}
|
386
|
-
}
|
387
|
-
|
388
|
-
return this;
|
389
|
-
},
|
390
|
-
|
391
|
-
enable: function() {
|
392
|
-
return this._setOptions({ disabled: false });
|
393
|
-
},
|
394
|
-
disable: function() {
|
395
|
-
return this._setOptions({ disabled: true });
|
396
|
-
},
|
397
|
-
|
398
|
-
_on: function( suppressDisabledCheck, element, handlers ) {
|
399
|
-
var delegateElement,
|
400
|
-
instance = this;
|
401
|
-
|
402
|
-
// no suppressDisabledCheck flag, shuffle arguments
|
403
|
-
if ( typeof suppressDisabledCheck !== "boolean" ) {
|
404
|
-
handlers = element;
|
405
|
-
element = suppressDisabledCheck;
|
406
|
-
suppressDisabledCheck = false;
|
407
|
-
}
|
408
|
-
|
409
|
-
// no element argument, shuffle and use this.element
|
410
|
-
if ( !handlers ) {
|
411
|
-
handlers = element;
|
412
|
-
element = this.element;
|
413
|
-
delegateElement = this.widget();
|
414
|
-
} else {
|
415
|
-
element = delegateElement = $( element );
|
416
|
-
this.bindings = this.bindings.add( element );
|
417
|
-
}
|
418
|
-
|
419
|
-
$.each( handlers, function( event, handler ) {
|
420
|
-
function handlerProxy() {
|
421
|
-
// allow widgets to customize the disabled handling
|
422
|
-
// - disabled as an array instead of boolean
|
423
|
-
// - disabled class as method for disabling individual parts
|
424
|
-
if ( !suppressDisabledCheck &&
|
425
|
-
( instance.options.disabled === true ||
|
426
|
-
$( this ).hasClass( "ui-state-disabled" ) ) ) {
|
427
|
-
return;
|
428
|
-
}
|
429
|
-
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
430
|
-
.apply( instance, arguments );
|
431
|
-
}
|
432
|
-
|
433
|
-
// copy the guid so direct unbinding works
|
434
|
-
if ( typeof handler !== "string" ) {
|
435
|
-
handlerProxy.guid = handler.guid =
|
436
|
-
handler.guid || handlerProxy.guid || $.guid++;
|
437
|
-
}
|
438
|
-
|
439
|
-
var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
|
440
|
-
eventName = match[1] + instance.eventNamespace,
|
441
|
-
selector = match[2];
|
442
|
-
if ( selector ) {
|
443
|
-
delegateElement.delegate( selector, eventName, handlerProxy );
|
444
|
-
} else {
|
445
|
-
element.bind( eventName, handlerProxy );
|
446
|
-
}
|
447
|
-
});
|
448
|
-
},
|
449
|
-
|
450
|
-
_off: function( element, eventName ) {
|
451
|
-
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
|
452
|
-
element.unbind( eventName ).undelegate( eventName );
|
453
|
-
},
|
454
|
-
|
455
|
-
_delay: function( handler, delay ) {
|
456
|
-
function handlerProxy() {
|
457
|
-
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
458
|
-
.apply( instance, arguments );
|
459
|
-
}
|
460
|
-
var instance = this;
|
461
|
-
return setTimeout( handlerProxy, delay || 0 );
|
462
|
-
},
|
463
|
-
|
464
|
-
_hoverable: function( element ) {
|
465
|
-
this.hoverable = this.hoverable.add( element );
|
466
|
-
this._on( element, {
|
467
|
-
mouseenter: function( event ) {
|
468
|
-
$( event.currentTarget ).addClass( "ui-state-hover" );
|
469
|
-
},
|
470
|
-
mouseleave: function( event ) {
|
471
|
-
$( event.currentTarget ).removeClass( "ui-state-hover" );
|
472
|
-
}
|
473
|
-
});
|
474
|
-
},
|
475
|
-
|
476
|
-
_focusable: function( element ) {
|
477
|
-
this.focusable = this.focusable.add( element );
|
478
|
-
this._on( element, {
|
479
|
-
focusin: function( event ) {
|
480
|
-
$( event.currentTarget ).addClass( "ui-state-focus" );
|
481
|
-
},
|
482
|
-
focusout: function( event ) {
|
483
|
-
$( event.currentTarget ).removeClass( "ui-state-focus" );
|
484
|
-
}
|
485
|
-
});
|
486
|
-
},
|
487
|
-
|
488
|
-
_trigger: function( type, event, data ) {
|
489
|
-
var prop, orig,
|
490
|
-
callback = this.options[ type ];
|
491
|
-
|
492
|
-
data = data || {};
|
493
|
-
event = $.Event( event );
|
494
|
-
event.type = ( type === this.widgetEventPrefix ?
|
495
|
-
type :
|
496
|
-
this.widgetEventPrefix + type ).toLowerCase();
|
497
|
-
// the original event may come from any element
|
498
|
-
// so we need to reset the target on the new event
|
499
|
-
event.target = this.element[ 0 ];
|
500
|
-
|
501
|
-
// copy original event properties over to the new event
|
502
|
-
orig = event.originalEvent;
|
503
|
-
if ( orig ) {
|
504
|
-
for ( prop in orig ) {
|
505
|
-
if ( !( prop in event ) ) {
|
506
|
-
event[ prop ] = orig[ prop ];
|
507
|
-
}
|
508
|
-
}
|
509
|
-
}
|
510
|
-
|
511
|
-
this.element.trigger( event, data );
|
512
|
-
return !( $.isFunction( callback ) &&
|
513
|
-
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
|
514
|
-
event.isDefaultPrevented() );
|
515
|
-
}
|
516
|
-
};
|
517
|
-
|
518
|
-
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
|
519
|
-
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
|
520
|
-
if ( typeof options === "string" ) {
|
521
|
-
options = { effect: options };
|
522
|
-
}
|
523
|
-
var hasOptions,
|
524
|
-
effectName = !options ?
|
525
|
-
method :
|
526
|
-
options === true || typeof options === "number" ?
|
527
|
-
defaultEffect :
|
528
|
-
options.effect || defaultEffect;
|
529
|
-
options = options || {};
|
530
|
-
if ( typeof options === "number" ) {
|
531
|
-
options = { duration: options };
|
532
|
-
}
|
533
|
-
hasOptions = !$.isEmptyObject( options );
|
534
|
-
options.complete = callback;
|
535
|
-
if ( options.delay ) {
|
536
|
-
element.delay( options.delay );
|
537
|
-
}
|
538
|
-
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
|
539
|
-
element[ method ]( options );
|
540
|
-
} else if ( effectName !== method && element[ effectName ] ) {
|
541
|
-
element[ effectName ]( options.duration, options.easing, callback );
|
542
|
-
} else {
|
543
|
-
element.queue(function( next ) {
|
544
|
-
$( this )[ method ]();
|
545
|
-
if ( callback ) {
|
546
|
-
callback.call( element[ 0 ] );
|
547
|
-
}
|
548
|
-
next();
|
549
|
-
});
|
550
|
-
}
|
551
|
-
};
|
552
|
-
});
|
553
|
-
|
554
|
-
var widget = $.widget;
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
}));
|