rasputin 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.md +22 -0
- data/Rakefile +1 -0
- data/lib/rasputin.rb +3 -0
- data/lib/rasputin/engine.rb +4 -0
- data/lib/rasputin/handlebars_template.rb +32 -0
- data/lib/rasputin/version.rb +3 -0
- data/rasputin.gemspec +23 -0
- data/vendor/assets/javascripts/jquery-ui.js +13804 -0
- data/vendor/assets/javascripts/sproutcore-ajax.js +1071 -0
- data/vendor/assets/javascripts/sproutcore-datastore.js +11758 -0
- data/vendor/assets/javascripts/sproutcore-i18n.js +40 -0
- data/vendor/assets/javascripts/sproutcore-jui.js +732 -0
- data/vendor/assets/javascripts/sproutcore-statechart.js +3264 -0
- data/vendor/assets/javascripts/sproutcore-throbber.js +258 -0
- data/vendor/assets/javascripts/sproutcore.js +13225 -0
- data/vendor/assets/stylesheets/aristo.css +480 -0
- data/vendor/assets/stylesheets/jquery-ui.css +1444 -0
- metadata +105 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
(function(exports) {
|
3
|
+
|
4
|
+
if ('I18n' in window) {
|
5
|
+
|
6
|
+
SC.I18n = I18n;
|
7
|
+
|
8
|
+
SC.String.loc = function(scope, options) {
|
9
|
+
return SC.I18n.translate(scope, options);
|
10
|
+
};
|
11
|
+
|
12
|
+
SC.STRINGS = SC.I18n.translations;
|
13
|
+
|
14
|
+
Handlebars.registerHelper('loc', function(property) {
|
15
|
+
return SC.String.loc(property);
|
16
|
+
});
|
17
|
+
|
18
|
+
if (SC.EXTEND_PROTOTYPES) {
|
19
|
+
|
20
|
+
String.prototype.loc = function(options) {
|
21
|
+
return SC.String.loc(this, options);
|
22
|
+
};
|
23
|
+
|
24
|
+
}
|
25
|
+
|
26
|
+
}
|
27
|
+
|
28
|
+
})({});
|
29
|
+
|
30
|
+
|
31
|
+
(function(exports) {
|
32
|
+
// ==========================================================================
|
33
|
+
// Project: SproutCore I18N
|
34
|
+
// Copyright: ©2011 Paul Chavard
|
35
|
+
// License: Licensed under MIT license (see license.js)
|
36
|
+
// ==========================================================================
|
37
|
+
|
38
|
+
if ('undefined' === typeof I18n) require('i18n');
|
39
|
+
|
40
|
+
})({});
|
@@ -0,0 +1,732 @@
|
|
1
|
+
|
2
|
+
(function(exports) {
|
3
|
+
if ('undefined' === typeof JUI) {
|
4
|
+
|
5
|
+
/**
|
6
|
+
@namespace
|
7
|
+
@name JUI
|
8
|
+
@version 1.0.alpha
|
9
|
+
*/
|
10
|
+
JUI = {};
|
11
|
+
|
12
|
+
// aliases needed to keep minifiers from removing the global context
|
13
|
+
if ('undefined' !== typeof window) {
|
14
|
+
window.JUI = JUI;
|
15
|
+
}
|
16
|
+
|
17
|
+
}
|
18
|
+
|
19
|
+
/**
|
20
|
+
@static
|
21
|
+
@type String
|
22
|
+
@default '1.0.alpha'
|
23
|
+
@constant
|
24
|
+
*/
|
25
|
+
JUI.VERSION = '1.0.alpha';
|
26
|
+
|
27
|
+
})({});
|
28
|
+
|
29
|
+
|
30
|
+
(function(exports) {
|
31
|
+
|
32
|
+
var get = SC.get, set = SC.set, none = SC.none;
|
33
|
+
|
34
|
+
/**
|
35
|
+
@mixin
|
36
|
+
@since SproutCore JUI 1.0
|
37
|
+
@extends JUI.Widget
|
38
|
+
*/
|
39
|
+
JUI.Widget = SC.Mixin.create({
|
40
|
+
|
41
|
+
uiWidget: function() {
|
42
|
+
return jQuery.ui[this.get('uiType')];
|
43
|
+
}.property().cacheable(),
|
44
|
+
|
45
|
+
didInsertElement: function() {
|
46
|
+
this._super();
|
47
|
+
var options = this._gatherOptions();
|
48
|
+
this._gatherEvents(options);
|
49
|
+
|
50
|
+
var ui = get(this, 'uiWidget')(options, get(this, 'element'));
|
51
|
+
set(this, 'ui', ui);
|
52
|
+
|
53
|
+
this._defineMethods();
|
54
|
+
},
|
55
|
+
|
56
|
+
willDestroyElement: function() {
|
57
|
+
var ui = get(this, 'ui');
|
58
|
+
if (ui) {
|
59
|
+
var observers = this._observers;
|
60
|
+
for (var prop in observers) {
|
61
|
+
if (observers.hasOwnProperty(prop)) {
|
62
|
+
this.removeObserver(prop, observers[prop]);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
ui._destroy();
|
66
|
+
}
|
67
|
+
},
|
68
|
+
|
69
|
+
didCreateWidget: SC.K,
|
70
|
+
|
71
|
+
concatenatedProperties: ['uiEvents', 'uiOptions', 'uiMethods'],
|
72
|
+
|
73
|
+
uiEvents: ['create'],
|
74
|
+
uiOptions: ['disabled'],
|
75
|
+
uiMethods: [],
|
76
|
+
|
77
|
+
_gatherEvents: function(options) {
|
78
|
+
var uiEvents = get(this, 'uiEvents');
|
79
|
+
|
80
|
+
uiEvents.forEach(function(eventType) {
|
81
|
+
var eventHandler = eventType === 'create' ? this.didCreateWidget : this[eventType];
|
82
|
+
if (eventHandler) {
|
83
|
+
options[eventType] = $.proxy(function(event, ui) {
|
84
|
+
eventHandler.call(this, event, ui);
|
85
|
+
}, this);
|
86
|
+
}
|
87
|
+
}, this);
|
88
|
+
},
|
89
|
+
|
90
|
+
_gatherOptions: function() {
|
91
|
+
var uiOptions = get(this, 'uiOptions'),
|
92
|
+
options = {},
|
93
|
+
defaultOptions = get(this, 'uiWidget').prototype.options;
|
94
|
+
|
95
|
+
uiOptions.forEach(function(key) {
|
96
|
+
var value = get(this, key),
|
97
|
+
uiKey = key.replace(/^_/, '');
|
98
|
+
if (!none(value)) {
|
99
|
+
options[uiKey] = value;
|
100
|
+
} else {
|
101
|
+
set(this, key, defaultOptions[uiKey]);
|
102
|
+
}
|
103
|
+
|
104
|
+
var observer = function() {
|
105
|
+
var value = get(this, key);
|
106
|
+
ui = get(this, 'ui');
|
107
|
+
if (ui.options[uiKey] != value) {
|
108
|
+
ui._setOption(uiKey, value);
|
109
|
+
}
|
110
|
+
};
|
111
|
+
|
112
|
+
this.addObserver(key, observer);
|
113
|
+
this._observers = this._observers || {};
|
114
|
+
this._observers[key] = observer;
|
115
|
+
}, this);
|
116
|
+
|
117
|
+
return options;
|
118
|
+
},
|
119
|
+
|
120
|
+
_defineMethods: function() {
|
121
|
+
var uiMethods = get(this, 'uiMethods'),
|
122
|
+
methods = {};
|
123
|
+
uiMethods.forEach(function(methodName) {
|
124
|
+
methods[methodName] = function() {
|
125
|
+
var ui = get(this, 'ui');
|
126
|
+
return ui[methodName].apply(ui, arguments);
|
127
|
+
};
|
128
|
+
});
|
129
|
+
this.reopen(methods);
|
130
|
+
}
|
131
|
+
});
|
132
|
+
|
133
|
+
})({});
|
134
|
+
|
135
|
+
|
136
|
+
(function(exports) {
|
137
|
+
|
138
|
+
/**
|
139
|
+
@class
|
140
|
+
@since SproutCore JUI 1.0
|
141
|
+
@extends JUI.Button
|
142
|
+
*/
|
143
|
+
JUI.Button = SC.Button.extend(JUI.Widget, {
|
144
|
+
uiType: 'button',
|
145
|
+
uiOptions: ['label'],
|
146
|
+
|
147
|
+
isActiveBinding: SC.Binding.oneWay('.disabled')
|
148
|
+
});
|
149
|
+
|
150
|
+
})({});
|
151
|
+
|
152
|
+
|
153
|
+
(function(exports) {
|
154
|
+
|
155
|
+
var set = SC.set;
|
156
|
+
|
157
|
+
/**
|
158
|
+
@class
|
159
|
+
@since SproutCore JUI 1.0
|
160
|
+
@extends JUI.Slider
|
161
|
+
*/
|
162
|
+
JUI.Slider = SC.View.extend(JUI.Widget, {
|
163
|
+
uiType: 'slider',
|
164
|
+
uiOptions: ['value', 'min', 'max', 'step', 'orientation', 'range'],
|
165
|
+
uiEvents: ['slide', 'start', 'stop'],
|
166
|
+
|
167
|
+
slide: function(event, ui) {
|
168
|
+
set(this, 'value', ui.value);
|
169
|
+
}
|
170
|
+
});
|
171
|
+
|
172
|
+
})({});
|
173
|
+
|
174
|
+
|
175
|
+
(function(exports) {
|
176
|
+
|
177
|
+
var set = SC.set;
|
178
|
+
|
179
|
+
/**
|
180
|
+
@class
|
181
|
+
@since SproutCore JUI 1.0
|
182
|
+
@extends JUI.Spinner
|
183
|
+
*/
|
184
|
+
JUI.Spinner = SC.TextField.extend(JUI.Widget, {
|
185
|
+
uiType: 'spinner',
|
186
|
+
uiOptions: ['value', 'min', 'max', 'step'],
|
187
|
+
uiEvents: ['spin', 'start', 'stop'],
|
188
|
+
uiMethods: ['pageDown', 'pageUp', 'stepDown', 'stepUp'],
|
189
|
+
|
190
|
+
spin: function(event, ui) {
|
191
|
+
set(this, 'value', ui.value);
|
192
|
+
}
|
193
|
+
});
|
194
|
+
|
195
|
+
})({});
|
196
|
+
|
197
|
+
|
198
|
+
(function(exports) {
|
199
|
+
|
200
|
+
var get = SC.get, set = SC.set, none = SC.none;
|
201
|
+
|
202
|
+
/**
|
203
|
+
@class
|
204
|
+
@since SproutCore JUI 1.0
|
205
|
+
@extends JUI.ProgressBar
|
206
|
+
*/
|
207
|
+
JUI.ProgressBar = SC.View.extend(JUI.Widget, {
|
208
|
+
uiType: 'progressbar',
|
209
|
+
uiOptions: ['_value', 'max'],
|
210
|
+
uiEvents: ['change', 'complete'],
|
211
|
+
|
212
|
+
_value: function(key, value) {
|
213
|
+
if (!none(value)) {
|
214
|
+
set(this, 'value', parseInt(value));
|
215
|
+
}
|
216
|
+
return parseInt(get(this, 'value'));
|
217
|
+
}.property('value').cacheable()
|
218
|
+
});
|
219
|
+
|
220
|
+
})({});
|
221
|
+
|
222
|
+
|
223
|
+
(function(exports) {
|
224
|
+
|
225
|
+
var get = SC.get;
|
226
|
+
|
227
|
+
/**
|
228
|
+
@class
|
229
|
+
@since SproutCore JUI 1.0
|
230
|
+
@extends JUI.Menu
|
231
|
+
*/
|
232
|
+
JUI.Menu = SC.CollectionView.extend(JUI.Widget, {
|
233
|
+
uiType: 'menu',
|
234
|
+
uiEvents: ['select'],
|
235
|
+
|
236
|
+
tagName: 'ul',
|
237
|
+
|
238
|
+
arrayDidChange: function(content, start, removed, added) {
|
239
|
+
this._super(content, start, removed, added);
|
240
|
+
|
241
|
+
var ui = get(this, 'ui');
|
242
|
+
if (ui) { ui.refresh(); }
|
243
|
+
}
|
244
|
+
});
|
245
|
+
|
246
|
+
})({});
|
247
|
+
|
248
|
+
|
249
|
+
(function(exports) {
|
250
|
+
/*
|
251
|
+
* jQuery UI Dialog Auto Reposition Extension
|
252
|
+
*
|
253
|
+
* Copyright 2010, Scott González (http://scottgonzalez.com)
|
254
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
255
|
+
*
|
256
|
+
* http://github.com/scottgonzalez/jquery-ui-extensions
|
257
|
+
*/
|
258
|
+
|
259
|
+
$.ui.dialog.prototype.options.autoReposition = true;
|
260
|
+
jQuery(window).resize(function() {
|
261
|
+
$('.ui-dialog-content:visible').each(function() {
|
262
|
+
var dialog = $(this).data('dialog');
|
263
|
+
if (dialog.options.autoReposition) {
|
264
|
+
dialog.option('position', dialog.options.position);
|
265
|
+
}
|
266
|
+
});
|
267
|
+
});
|
268
|
+
|
269
|
+
})({});
|
270
|
+
|
271
|
+
|
272
|
+
(function(exports) {
|
273
|
+
|
274
|
+
var get = SC.get;
|
275
|
+
|
276
|
+
/**
|
277
|
+
@mixin
|
278
|
+
@since SproutCore JUI 1.0
|
279
|
+
@extends JUI.TargetSupport
|
280
|
+
*/
|
281
|
+
JUI.TargetSupport = SC.Mixin.create({
|
282
|
+
|
283
|
+
// @private
|
284
|
+
targetObject: function() {
|
285
|
+
var target = get(this, 'target');
|
286
|
+
|
287
|
+
if (SC.typeOf(target) === 'string') {
|
288
|
+
return SC.getPath(this, target);
|
289
|
+
} else {
|
290
|
+
return target;
|
291
|
+
}
|
292
|
+
}.property('target').cacheable(),
|
293
|
+
|
294
|
+
// @private
|
295
|
+
executeAction: function() {
|
296
|
+
var args = SC.$.makeArray(arguments),
|
297
|
+
action = args.shift(),
|
298
|
+
target = get(this, 'targetObject');
|
299
|
+
if (target && action) {
|
300
|
+
if (SC.typeOf(action) === 'string') {
|
301
|
+
action = target[action];
|
302
|
+
}
|
303
|
+
action.apply(target, args);
|
304
|
+
}
|
305
|
+
}
|
306
|
+
|
307
|
+
});
|
308
|
+
|
309
|
+
})({});
|
310
|
+
|
311
|
+
|
312
|
+
(function(exports) {
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
var get = SC.get, set = SC.set;
|
317
|
+
|
318
|
+
/**
|
319
|
+
@class
|
320
|
+
@since SproutCore JUI 1.0
|
321
|
+
@extends JUI.Dialog
|
322
|
+
*/
|
323
|
+
JUI.Dialog = SC.View.extend(JUI.Widget, JUI.TargetSupport, {
|
324
|
+
uiType: 'dialog',
|
325
|
+
uiEvents: ['beforeClose'],
|
326
|
+
uiOptions: ['title', '_buttons', 'position', 'closeOnEscape',
|
327
|
+
'modal', 'draggable', 'resizable', 'autoReposition',
|
328
|
+
'width', 'height', 'maxWidth', 'maxHeight', 'minWidth', 'minHeight'],
|
329
|
+
uiMethods: ['open', 'close'],
|
330
|
+
|
331
|
+
isOpen: false,
|
332
|
+
|
333
|
+
message: '',
|
334
|
+
icon: null,
|
335
|
+
buttons: [],
|
336
|
+
|
337
|
+
_iconClassNames: function() {
|
338
|
+
var icon = get(this, 'icon');
|
339
|
+
if (icon) {
|
340
|
+
return "ui-icon ui-icon-%@".fmt(icon === 'error' ? 'alert' : icon);
|
341
|
+
}
|
342
|
+
return '';
|
343
|
+
}.property('icon').cacheable(),
|
344
|
+
|
345
|
+
_stateClassNames: function() {
|
346
|
+
var icon = get(this, 'icon');
|
347
|
+
if (icon === 'error') {
|
348
|
+
return 'ui-state-error';
|
349
|
+
} else if (icon === 'info') {
|
350
|
+
return 'ui-state-highlight';
|
351
|
+
}
|
352
|
+
return '';
|
353
|
+
}.property('icon').cacheable(),
|
354
|
+
|
355
|
+
defaultTemplate: SC.Handlebars.compile('<p {{bindAttr class="_stateClassNames"}}>\
|
356
|
+
<span {{bindAttr class="_iconClassNames"}}></span>{{message}}</p>'),
|
357
|
+
|
358
|
+
_buttons: function() {
|
359
|
+
var buttons = [],
|
360
|
+
target = get(this, 'targetObject');
|
361
|
+
get(this, 'buttons').forEach(function(button) {
|
362
|
+
var action = button.action,
|
363
|
+
context = this;
|
364
|
+
if (!this[action] && target) {
|
365
|
+
context = target;
|
366
|
+
}
|
367
|
+
buttons.push({
|
368
|
+
text: button.label,
|
369
|
+
click: function(event) {
|
370
|
+
if (context && context[action]) {
|
371
|
+
context[action].call(context, event);
|
372
|
+
}
|
373
|
+
}
|
374
|
+
});
|
375
|
+
}, this);
|
376
|
+
return buttons;
|
377
|
+
}.property('buttons').cacheable(),
|
378
|
+
|
379
|
+
_open: function() {
|
380
|
+
set(this, 'isOpen', true);
|
381
|
+
this.didOpenDialog();
|
382
|
+
},
|
383
|
+
|
384
|
+
_close: function() {
|
385
|
+
set(this, 'isOpen', false);
|
386
|
+
this.didCloseDialog();
|
387
|
+
},
|
388
|
+
|
389
|
+
open: function() {
|
390
|
+
this._insertElementLater(SC.K);
|
391
|
+
this._open();
|
392
|
+
},
|
393
|
+
|
394
|
+
didInsertElement: function() {
|
395
|
+
this._super();
|
396
|
+
get(this, 'ui')._bind({
|
397
|
+
dialogopen: $.proxy(this._open, this),
|
398
|
+
dialogclose: $.proxy(this._close, this)
|
399
|
+
});
|
400
|
+
},
|
401
|
+
|
402
|
+
close: SC.K,
|
403
|
+
didOpenDialog: SC.K,
|
404
|
+
didCloseDialog: SC.K
|
405
|
+
});
|
406
|
+
|
407
|
+
JUI.Dialog.close = function() {
|
408
|
+
$('.ui-dialog-content:visible').dialog('close');
|
409
|
+
};
|
410
|
+
|
411
|
+
var alertDialog, confirmDialog;
|
412
|
+
|
413
|
+
JUI.AlertDialog = JUI.Dialog.extend({
|
414
|
+
buttons: [{label: 'OK', action: 'close'}],
|
415
|
+
resizable: false,
|
416
|
+
draggable: false,
|
417
|
+
modal: true
|
418
|
+
});
|
419
|
+
|
420
|
+
JUI.AlertDialog.reopenClass({
|
421
|
+
open: function(message, title, type) {
|
422
|
+
if (!alertDialog) {
|
423
|
+
alertDialog = JUI.AlertDialog.create();
|
424
|
+
}
|
425
|
+
set(alertDialog, 'title', title ? title : null);
|
426
|
+
set(alertDialog, 'message', message);
|
427
|
+
set(alertDialog, 'icon', type);
|
428
|
+
alertDialog.open();
|
429
|
+
},
|
430
|
+
|
431
|
+
info: function(message, title) {
|
432
|
+
JUI.AlertDialog.open(message, title, 'info');
|
433
|
+
},
|
434
|
+
|
435
|
+
error: function(message, title) {
|
436
|
+
JUI.AlertDialog.open(message, title, 'error');
|
437
|
+
}
|
438
|
+
});
|
439
|
+
|
440
|
+
JUI.ConfirmDialog = JUI.AlertDialog.extend({
|
441
|
+
buttons: [
|
442
|
+
{label: 'YES', action: 'didConfirm'},
|
443
|
+
{label: 'NO', action: 'close'}
|
444
|
+
],
|
445
|
+
didConfirm: function() {
|
446
|
+
get(this, 'answer').resolve();
|
447
|
+
this.close();
|
448
|
+
},
|
449
|
+
didCloseDialog: function() {
|
450
|
+
var answer = get(this, 'answer');
|
451
|
+
if (answer && !answer.isResolved()) {
|
452
|
+
answer.reject();
|
453
|
+
}
|
454
|
+
set(this, 'answer', null);
|
455
|
+
}
|
456
|
+
});
|
457
|
+
|
458
|
+
JUI.ConfirmDialog.reopenClass({
|
459
|
+
open: function(message, title) {
|
460
|
+
if (!confirmDialog) {
|
461
|
+
confirmDialog = JUI.ConfirmDialog.create();
|
462
|
+
}
|
463
|
+
var answer = SC.$.Deferred();
|
464
|
+
set(confirmDialog, 'answer', answer);
|
465
|
+
set(confirmDialog, 'title', title ? title : null);
|
466
|
+
set(confirmDialog, 'message', message);
|
467
|
+
confirmDialog.open();
|
468
|
+
return answer.promise();
|
469
|
+
}
|
470
|
+
});
|
471
|
+
|
472
|
+
})({});
|
473
|
+
|
474
|
+
|
475
|
+
(function(exports) {
|
476
|
+
|
477
|
+
var get = SC.get, set = SC.set, none = SC.none;
|
478
|
+
|
479
|
+
/**
|
480
|
+
@class
|
481
|
+
@since SproutCore JUI 1.0
|
482
|
+
@extends JUI.Datepicker
|
483
|
+
*/
|
484
|
+
JUI.Datepicker = SC.TextField.extend(JUI.Widget, {
|
485
|
+
uiType: 'datepicker',
|
486
|
+
uiOptions: ['dateFormat', 'maxDate', 'minDate', 'defaultDate'],
|
487
|
+
uiEvents: ['onSelect'],
|
488
|
+
|
489
|
+
date: function(key, value) {
|
490
|
+
var ui = get(this, 'ui');
|
491
|
+
if (!none(value)) {
|
492
|
+
ui.setDate(value);
|
493
|
+
}
|
494
|
+
return ui.getDate();
|
495
|
+
}.property('value').cacheable(),
|
496
|
+
|
497
|
+
open: function() {
|
498
|
+
get(this, 'ui').show();
|
499
|
+
},
|
500
|
+
|
501
|
+
close: function() {
|
502
|
+
get(this, 'ui').hide();
|
503
|
+
},
|
504
|
+
|
505
|
+
// @private
|
506
|
+
uiWidget: function() {
|
507
|
+
var datepicker = function(options, elem) {
|
508
|
+
return SC.$(elem).datepicker(options).datepicker('widget');
|
509
|
+
};
|
510
|
+
datepicker.prototype.options = SC.$.datepicker._defaults;
|
511
|
+
return datepicker;
|
512
|
+
}.property().cacheable(),
|
513
|
+
|
514
|
+
// @private
|
515
|
+
onSelect: function(dateText, ui) {
|
516
|
+
this.select();
|
517
|
+
},
|
518
|
+
|
519
|
+
select: SC.K
|
520
|
+
});
|
521
|
+
|
522
|
+
JUI.Datepicker.formatDate = SC.$.datepicker.formatDate;
|
523
|
+
JUI.Datepicker.parseDate = SC.$.datepicker.parseDate;
|
524
|
+
|
525
|
+
})({});
|
526
|
+
|
527
|
+
|
528
|
+
(function(exports) {
|
529
|
+
|
530
|
+
var get = SC.get, set = SC.set;
|
531
|
+
|
532
|
+
/**
|
533
|
+
@mixin
|
534
|
+
@since SproutCore JUI 1.0
|
535
|
+
@extends JUI.Tooltip
|
536
|
+
*/
|
537
|
+
JUI.Tooltip = SC.Mixin.create({
|
538
|
+
tooltip: '',
|
539
|
+
hasTooltip: false,
|
540
|
+
|
541
|
+
// @private
|
542
|
+
toggleTooltip: function() {
|
543
|
+
var flag = get(this, 'hasTooltip'),
|
544
|
+
ui = get(this, 'tooltipWidget');
|
545
|
+
if (flag && !ui) {
|
546
|
+
ui = this.$().tooltip({
|
547
|
+
content: get(this, 'tooltipTemplate')
|
548
|
+
}).tooltip('widget');
|
549
|
+
set(this, 'tooltipWidget', ui);
|
550
|
+
} else if (ui) {
|
551
|
+
ui._destroy();
|
552
|
+
}
|
553
|
+
}.observes('hasTooltip'),
|
554
|
+
|
555
|
+
// @private
|
556
|
+
tooltipTemplate: function() {
|
557
|
+
return SC.Handlebars.compile(get(this, 'tooltip'));
|
558
|
+
}.property('tooltip').cacheable()
|
559
|
+
|
560
|
+
});
|
561
|
+
|
562
|
+
})({});
|
563
|
+
|
564
|
+
|
565
|
+
(function(exports) {
|
566
|
+
|
567
|
+
var get = SC.get, set = SC.set;
|
568
|
+
|
569
|
+
/**
|
570
|
+
@class
|
571
|
+
@since SproutCore JUI 1.0
|
572
|
+
@extends JUI.SortableCollectionView
|
573
|
+
*/
|
574
|
+
JUI.SortableCollectionView = SC.CollectionView.extend(JUI.Widget, {
|
575
|
+
uiType: 'sortable',
|
576
|
+
uiEvents: ['start', 'stop'],
|
577
|
+
|
578
|
+
draggedStartPos: null,
|
579
|
+
|
580
|
+
start: function(event, ui) {
|
581
|
+
set(this, 'dragging', true);
|
582
|
+
set(this, 'draggedStartPos', ui.item.index());
|
583
|
+
},
|
584
|
+
|
585
|
+
stop: function(event, ui) {
|
586
|
+
var oldIdx = get(this, 'draggedStartPos');
|
587
|
+
var newIdx = ui.item.index();
|
588
|
+
if (oldIdx != newIdx) {
|
589
|
+
var content = get(this, 'content');
|
590
|
+
content.beginPropertyChanges();
|
591
|
+
var el = content.objectAt(oldIdx);
|
592
|
+
content.removeAt(oldIdx);
|
593
|
+
content.insertAt(newIdx, el);
|
594
|
+
content.endPropertyChanges();
|
595
|
+
}
|
596
|
+
set(this, 'dragging', false);
|
597
|
+
},
|
598
|
+
|
599
|
+
// @private
|
600
|
+
// Overriding these to prevent CollectionView from reapplying content array modifications
|
601
|
+
arrayWillChange: function(content, start, removedCount, addedCount) {
|
602
|
+
if (get(this, 'dragging')) {
|
603
|
+
//this._super(content, 0, 0, 0);
|
604
|
+
} else {
|
605
|
+
this._super(content, start, removedCount, addedCount);
|
606
|
+
}
|
607
|
+
},
|
608
|
+
|
609
|
+
// @private
|
610
|
+
arrayDidChange: function(content, start, removedCount, addedCount) {
|
611
|
+
if (get(this, 'dragging')) {
|
612
|
+
//this._super(content, 0, 0, 0);
|
613
|
+
} else {
|
614
|
+
this._super(content, start, removedCount, addedCount);
|
615
|
+
}
|
616
|
+
}
|
617
|
+
});
|
618
|
+
|
619
|
+
})({});
|
620
|
+
|
621
|
+
|
622
|
+
(function(exports) {
|
623
|
+
|
624
|
+
/**
|
625
|
+
@class
|
626
|
+
@since SproutCore JUI 1.0
|
627
|
+
@extends JUI.ResizableView
|
628
|
+
*/
|
629
|
+
JUI.ResizableView = SC.View.extend(JUI.Widget, {
|
630
|
+
uiType: 'resizable',
|
631
|
+
uiEvents: ['start', 'stop', 'resize'],
|
632
|
+
uiOptions: ['aspectRatio', 'maxHeight', 'maxWidth', 'minHeight', 'minWidth', 'containment', 'autoHide']
|
633
|
+
});
|
634
|
+
|
635
|
+
})({});
|
636
|
+
|
637
|
+
|
638
|
+
(function(exports) {
|
639
|
+
|
640
|
+
|
641
|
+
|
642
|
+
|
643
|
+
|
644
|
+
|
645
|
+
|
646
|
+
|
647
|
+
|
648
|
+
|
649
|
+
})({});
|
650
|
+
|
651
|
+
|
652
|
+
(function(exports) {
|
653
|
+
/*
|
654
|
+
* jQuery UI Autocomplete HTML Extension
|
655
|
+
*
|
656
|
+
* Copyright 2010, Scott González (http://scottgonzalez.com)
|
657
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
658
|
+
*
|
659
|
+
* http://github.com/scottgonzalez/jquery-ui-extensions
|
660
|
+
*/
|
661
|
+
|
662
|
+
var proto = jQuery.ui.autocomplete.prototype,
|
663
|
+
initSource = proto._initSource,
|
664
|
+
escapeRegex = jQuery.ui.autocomplete.escapeRegex;
|
665
|
+
|
666
|
+
function filter(array, term) {
|
667
|
+
var matcher = new RegExp(escapeRegex(term), 'i');
|
668
|
+
return jQuery.grep(array, function(value) {
|
669
|
+
return matcher.test(jQuery('<div>').html(value.label || value.value || value).text());
|
670
|
+
});
|
671
|
+
}
|
672
|
+
|
673
|
+
jQuery.extend(proto, {
|
674
|
+
_initSource: function() {
|
675
|
+
if (this.options.html && jQuery.isArray(this.options.source)) {
|
676
|
+
this.source = function(request, response) {
|
677
|
+
response(filter( this.options.source, request.term));
|
678
|
+
};
|
679
|
+
} else {
|
680
|
+
initSource.call(this);
|
681
|
+
}
|
682
|
+
},
|
683
|
+
|
684
|
+
_renderItem: function(ul, item) {
|
685
|
+
return jQuery('<li></li>')
|
686
|
+
.data('item.autocomplete', item)
|
687
|
+
.append(jQuery('<a></a>')[this.options.html ? 'html' : 'text'](item.label))
|
688
|
+
.appendTo(ul);
|
689
|
+
}
|
690
|
+
});
|
691
|
+
|
692
|
+
})({});
|
693
|
+
|
694
|
+
|
695
|
+
(function(exports) {
|
696
|
+
|
697
|
+
|
698
|
+
|
699
|
+
var get = SC.get;
|
700
|
+
|
701
|
+
/**
|
702
|
+
@class
|
703
|
+
@since SproutCore JUI 1.0
|
704
|
+
@extends JUI.AutocompleteTextField
|
705
|
+
*/
|
706
|
+
JUI.AutocompleteTextField = SC.TextField.extend(JUI.Widget, JUI.TargetSupport, {
|
707
|
+
uiType: 'autocomplete',
|
708
|
+
uiOptions: ['source', 'delay', 'position', 'minLength', 'html'],
|
709
|
+
uiEvents: ['select', 'focus', 'open', 'close'],
|
710
|
+
|
711
|
+
select: function(event, ui) {
|
712
|
+
if (ui.item) {
|
713
|
+
this.executeAction(get(this, 'action'), ui.item.value);
|
714
|
+
event.target.value = '';
|
715
|
+
event.preventDefault();
|
716
|
+
}
|
717
|
+
}
|
718
|
+
});
|
719
|
+
|
720
|
+
})({});
|
721
|
+
|
722
|
+
|
723
|
+
(function(exports) {
|
724
|
+
// ==========================================================================
|
725
|
+
// Project: SproutCore JUI
|
726
|
+
// Copyright: ©2011 Paul Chavard
|
727
|
+
// License: Licensed under MIT license (see license.js)
|
728
|
+
// ==========================================================================
|
729
|
+
|
730
|
+
|
731
|
+
|
732
|
+
})({});
|