rasputin 0.9.1 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +19 -0
- data/lib/rasputin/handlebars/handlebars.js +5 -0
- data/lib/rasputin/version.rb +1 -1
- data/vendor/assets/javascripts/TransformJS.js +432 -0
- data/vendor/assets/javascripts/metamorph.js +298 -0
- data/vendor/assets/javascripts/sproutcore-datastore.js +0 -1
- data/vendor/assets/javascripts/sproutcore-i18n.js +0 -1
- data/vendor/assets/javascripts/sproutcore-routing.js +549 -0
- data/vendor/assets/javascripts/sproutcore-statechart.js +1 -0
- data/vendor/assets/javascripts/sproutcore-touch.js +63 -387
- data/vendor/assets/javascripts/sproutcore-utils.js +73 -0
- data/vendor/assets/javascripts/sproutcore.js +243 -110
- data/vendor/assets/stylesheets/normalize.css +10 -18
- metadata +12 -8
@@ -0,0 +1,73 @@
|
|
1
|
+
(function(exports) {
|
2
|
+
// ==========================================================================
|
3
|
+
// Project: SproutCore
|
4
|
+
// Copyright: ©2006-2011 Strobe Inc. and contributors.
|
5
|
+
// Portions ©2008-2011 Apple Inc. All rights reserved.
|
6
|
+
// License: Licensed under MIT license (see license.js)
|
7
|
+
// ==========================================================================
|
8
|
+
|
9
|
+
var slice = Array.prototype.slice;
|
10
|
+
|
11
|
+
var respondsTo = function(obj, methodName) {
|
12
|
+
return !!(obj[methodName] instanceof Function);
|
13
|
+
};
|
14
|
+
|
15
|
+
/**
|
16
|
+
@param {Object} obj The object to check for the method
|
17
|
+
@param {String} methodName The method name to check for
|
18
|
+
*/
|
19
|
+
SC.respondsTo = respondsTo;
|
20
|
+
|
21
|
+
SC.Object.reopen(
|
22
|
+
/** @scope SC.Object.prototype */{
|
23
|
+
|
24
|
+
respondsTo: function() {
|
25
|
+
var args = slice.call(arguments);
|
26
|
+
args.unshift(this);
|
27
|
+
return SC.respondsTo.apply(SC, args);
|
28
|
+
}
|
29
|
+
|
30
|
+
});
|
31
|
+
|
32
|
+
// ==========================================================================
|
33
|
+
// Project: SproutCore
|
34
|
+
// Copyright: ©2006-2011 Strobe Inc. and contributors.
|
35
|
+
// Portions ©2008-2011 Apple Inc. All rights reserved.
|
36
|
+
// License: Licensed under MIT license (see license.js)
|
37
|
+
// ==========================================================================
|
38
|
+
|
39
|
+
var slice = Array.prototype.slice;
|
40
|
+
|
41
|
+
var tryToPerform = function(obj, methodName) {
|
42
|
+
var args = slice.call(arguments);
|
43
|
+
args.shift(); args.shift();
|
44
|
+
return SC.respondsTo(obj, methodName) && (obj[methodName].apply(obj, args) !== false);
|
45
|
+
};
|
46
|
+
|
47
|
+
/**
|
48
|
+
Checks to see if the `methodName` exists on the `obj`,
|
49
|
+
and if it does, invokes it with the arguments passed.
|
50
|
+
|
51
|
+
@function
|
52
|
+
|
53
|
+
@param {Object} obj The object to check for the method
|
54
|
+
@param {String} methodName The method name to check for
|
55
|
+
@param {Object...} args The arguments to pass to the method
|
56
|
+
|
57
|
+
@returns {Boolean} true if the method does not return false
|
58
|
+
@returns {Boolean} false otherwise
|
59
|
+
*/
|
60
|
+
SC.tryToPerform = tryToPerform;
|
61
|
+
|
62
|
+
SC.Object.reopen(
|
63
|
+
/** @scope SC.Object.prototype */{
|
64
|
+
|
65
|
+
tryToPerform: function() {
|
66
|
+
var args = slice.call(arguments);
|
67
|
+
args.unshift(this);
|
68
|
+
return SC.tryToPerform.apply(SC, args);
|
69
|
+
}
|
70
|
+
|
71
|
+
});
|
72
|
+
|
73
|
+
})({})
|
@@ -1,3 +1,4 @@
|
|
1
|
+
//=require metamorph
|
1
2
|
|
2
3
|
(function(exports) {
|
3
4
|
// lib/handlebars/base.js
|
@@ -3579,8 +3580,10 @@ function beforeKey(eventName) {
|
|
3579
3580
|
function xformForArgs(args) {
|
3580
3581
|
return function (target, method, params) {
|
3581
3582
|
var obj = params[0], keyName = changeKey(params[1]), val;
|
3583
|
+
var copy_args = args.slice();
|
3582
3584
|
if (method.length>2) val = SC.getPath(obj, keyName);
|
3583
|
-
|
3585
|
+
copy_args.unshift(obj, keyName, val);
|
3586
|
+
method.apply(target, copy_args);
|
3584
3587
|
}
|
3585
3588
|
}
|
3586
3589
|
|
@@ -7989,7 +7992,7 @@ if (SC.EXTEND_PROTOTYPES) {
|
|
7989
7992
|
/**
|
7990
7993
|
@see SC.String.dasherize
|
7991
7994
|
*/
|
7992
|
-
String.prototype.
|
7995
|
+
String.prototype.dasherize = function() {
|
7993
7996
|
return dasherize(this);
|
7994
7997
|
};
|
7995
7998
|
}
|
@@ -10159,6 +10162,8 @@ SC._RenderBuffer = SC.Object.extend(
|
|
10159
10162
|
*/
|
10160
10163
|
replaceWithBuffer: function(newBuffer) {
|
10161
10164
|
var parent = get(this, 'parentBuffer');
|
10165
|
+
if (!parent) { return; }
|
10166
|
+
|
10162
10167
|
var childBuffers = get(parent, 'childBuffers');
|
10163
10168
|
|
10164
10169
|
var index = childBuffers.indexOf(this);
|
@@ -10259,37 +10264,43 @@ SC._RenderBuffer = SC.Object.extend(
|
|
10259
10264
|
content = '',
|
10260
10265
|
styleBuffer = [], prop;
|
10261
10266
|
|
10262
|
-
|
10267
|
+
if (tag) {
|
10268
|
+
var openTag = ["<" + tag];
|
10263
10269
|
|
10264
|
-
|
10265
|
-
|
10270
|
+
if (id) { openTag.push('id="' + id + '"'); }
|
10271
|
+
if (classes.length) { openTag.push('class="' + classes.join(" ") + '"'); }
|
10266
10272
|
|
10267
|
-
|
10268
|
-
|
10269
|
-
|
10270
|
-
|
10273
|
+
if (!jQuery.isEmptyObject(style)) {
|
10274
|
+
for (prop in style) {
|
10275
|
+
if (style.hasOwnProperty(prop)) {
|
10276
|
+
styleBuffer.push(prop + ':' + style[prop] + ';');
|
10277
|
+
}
|
10271
10278
|
}
|
10272
|
-
}
|
10273
10279
|
|
10274
|
-
|
10275
|
-
|
10280
|
+
openTag.push('style="' + styleBuffer.join("") + '"');
|
10281
|
+
}
|
10276
10282
|
|
10277
|
-
|
10278
|
-
|
10279
|
-
|
10283
|
+
for (prop in attrs) {
|
10284
|
+
if (attrs.hasOwnProperty(prop)) {
|
10285
|
+
openTag.push(prop + '="' + attrs[prop] + '"');
|
10286
|
+
}
|
10280
10287
|
}
|
10281
|
-
}
|
10282
10288
|
|
10283
|
-
|
10289
|
+
openTag = openTag.join(" ") + '>';
|
10290
|
+
}
|
10284
10291
|
|
10285
10292
|
var childBuffers = get(this, 'childBuffers');
|
10286
10293
|
|
10287
10294
|
childBuffers.forEach(function(buffer) {
|
10288
10295
|
var stringy = typeof buffer === 'string';
|
10289
|
-
content
|
10296
|
+
content += (stringy ? buffer : buffer.string());
|
10290
10297
|
});
|
10291
10298
|
|
10292
|
-
|
10299
|
+
if (tag) {
|
10300
|
+
return openTag + content + "</" + tag + ">";
|
10301
|
+
} else {
|
10302
|
+
return content;
|
10303
|
+
}
|
10293
10304
|
}
|
10294
10305
|
|
10295
10306
|
});
|
@@ -10610,6 +10621,22 @@ queues.insertAt(queues.indexOf('actions')+1, 'render');
|
|
10610
10621
|
var get = SC.get, set = SC.set, addObserver = SC.addObserver;
|
10611
10622
|
var getPath = SC.getPath, meta = SC.meta, fmt = SC.String.fmt;
|
10612
10623
|
|
10624
|
+
var childViewsProperty = SC.computed(function() {
|
10625
|
+
var childViews = get(this, '_childViews');
|
10626
|
+
|
10627
|
+
var ret = [];
|
10628
|
+
|
10629
|
+
childViews.forEach(function(view) {
|
10630
|
+
if (view.isVirtual) {
|
10631
|
+
ret = ret.concat(get(view, 'childViews'));
|
10632
|
+
} else {
|
10633
|
+
ret.push(view);
|
10634
|
+
}
|
10635
|
+
});
|
10636
|
+
|
10637
|
+
return ret;
|
10638
|
+
}).property('_childViews.@each').cacheable();
|
10639
|
+
|
10613
10640
|
/**
|
10614
10641
|
@static
|
10615
10642
|
|
@@ -10719,7 +10746,17 @@ SC.View = SC.Object.extend(
|
|
10719
10746
|
@type SC.View
|
10720
10747
|
@default null
|
10721
10748
|
*/
|
10722
|
-
|
10749
|
+
_parentView: null,
|
10750
|
+
|
10751
|
+
parentView: function() {
|
10752
|
+
var parent = get(this, '_parentView');
|
10753
|
+
|
10754
|
+
if (parent && parent.isVirtual) {
|
10755
|
+
return get(parent, 'parentView');
|
10756
|
+
} else {
|
10757
|
+
return parent;
|
10758
|
+
}
|
10759
|
+
}.property('_parentView'),
|
10723
10760
|
|
10724
10761
|
/**
|
10725
10762
|
If false, the view will appear hidden in DOM.
|
@@ -10737,7 +10774,9 @@ SC.View = SC.Object.extend(
|
|
10737
10774
|
@type Array
|
10738
10775
|
@default []
|
10739
10776
|
*/
|
10740
|
-
childViews:
|
10777
|
+
childViews: childViewsProperty,
|
10778
|
+
|
10779
|
+
_childViews: [],
|
10741
10780
|
|
10742
10781
|
/**
|
10743
10782
|
Return the nearest ancestor that is an instance of the provided
|
@@ -10747,11 +10786,11 @@ SC.View = SC.Object.extend(
|
|
10747
10786
|
@returns SC.View
|
10748
10787
|
*/
|
10749
10788
|
nearestInstanceOf: function(klass) {
|
10750
|
-
var view = this
|
10789
|
+
var view = get(this, 'parentView');
|
10751
10790
|
|
10752
10791
|
while (view) {
|
10753
10792
|
if(view instanceof klass) { return view; }
|
10754
|
-
view = view
|
10793
|
+
view = get(view, 'parentView');
|
10755
10794
|
}
|
10756
10795
|
},
|
10757
10796
|
|
@@ -10762,11 +10801,11 @@ SC.View = SC.Object.extend(
|
|
10762
10801
|
@returns SC.View
|
10763
10802
|
*/
|
10764
10803
|
nearestWithProperty: function(property) {
|
10765
|
-
var view = this
|
10804
|
+
var view = get(this, 'parentView');
|
10766
10805
|
|
10767
10806
|
while (view) {
|
10768
10807
|
if (property in view) { return view; }
|
10769
|
-
view = view
|
10808
|
+
view = get(view, 'parentView');
|
10770
10809
|
}
|
10771
10810
|
},
|
10772
10811
|
|
@@ -10778,11 +10817,11 @@ SC.View = SC.Object.extend(
|
|
10778
10817
|
@returns SC.View
|
10779
10818
|
*/
|
10780
10819
|
nearestChildOf: function(klass) {
|
10781
|
-
var view = this
|
10820
|
+
var view = get(this, 'parentView');
|
10782
10821
|
|
10783
10822
|
while (view) {
|
10784
|
-
if(view
|
10785
|
-
view = view
|
10823
|
+
if(get(view, 'parentView') instanceof klass) { return view; }
|
10824
|
+
view = get(view, 'parentView');
|
10786
10825
|
}
|
10787
10826
|
},
|
10788
10827
|
|
@@ -10827,7 +10866,7 @@ SC.View = SC.Object.extend(
|
|
10827
10866
|
view.propertyDidChange('itemView');
|
10828
10867
|
view.propertyDidChange('contentView');
|
10829
10868
|
});
|
10830
|
-
}.observes('
|
10869
|
+
}.observes('_parentView'),
|
10831
10870
|
|
10832
10871
|
/**
|
10833
10872
|
Called on your view when it should push strings of HTML into a
|
@@ -10911,9 +10950,9 @@ SC.View = SC.Object.extend(
|
|
10911
10950
|
// we re-render.
|
10912
10951
|
|
10913
10952
|
// VIEW-TODO: Unit test this path.
|
10914
|
-
var childViews = get(this, '
|
10953
|
+
var childViews = get(this, '_childViews');
|
10915
10954
|
for (var i=lengthAfter-1; i>=lengthBefore; i--) {
|
10916
|
-
childViews[i]
|
10955
|
+
if (childViews[i]) { childViews[i].destroy(); }
|
10917
10956
|
}
|
10918
10957
|
},
|
10919
10958
|
|
@@ -11084,7 +11123,7 @@ SC.View = SC.Object.extend(
|
|
11084
11123
|
} else {
|
11085
11124
|
return this.invokeForState('getElement');
|
11086
11125
|
}
|
11087
|
-
}.property('
|
11126
|
+
}.property('_parentView', 'state').cacheable(),
|
11088
11127
|
|
11089
11128
|
/**
|
11090
11129
|
Returns a jQuery object for this view's element. If you pass in a selector
|
@@ -11103,7 +11142,7 @@ SC.View = SC.Object.extend(
|
|
11103
11142
|
|
11104
11143
|
/** @private */
|
11105
11144
|
mutateChildViews: function(callback) {
|
11106
|
-
var childViews = get(this, '
|
11145
|
+
var childViews = get(this, '_childViews'),
|
11107
11146
|
idx = get(childViews, 'length'),
|
11108
11147
|
view;
|
11109
11148
|
|
@@ -11117,7 +11156,7 @@ SC.View = SC.Object.extend(
|
|
11117
11156
|
|
11118
11157
|
/** @private */
|
11119
11158
|
forEachChildView: function(callback) {
|
11120
|
-
var childViews = get(this, '
|
11159
|
+
var childViews = get(this, '_childViews'),
|
11121
11160
|
len = get(childViews, 'length'),
|
11122
11161
|
view, idx;
|
11123
11162
|
|
@@ -11240,7 +11279,10 @@ SC.View = SC.Object.extend(
|
|
11240
11279
|
@returns {SC.RenderBuffer}
|
11241
11280
|
*/
|
11242
11281
|
renderBuffer: function(tagName) {
|
11243
|
-
|
11282
|
+
tagName = tagName || get(this, 'tagName');
|
11283
|
+
if (tagName == null) { tagName = tagName || 'div'; }
|
11284
|
+
|
11285
|
+
return SC.RenderBuffer(tagName);
|
11244
11286
|
},
|
11245
11287
|
|
11246
11288
|
/**
|
@@ -11423,7 +11465,10 @@ SC.View = SC.Object.extend(
|
|
11423
11465
|
// provided buffer operation (for example, `insertAfter` will
|
11424
11466
|
// insert a new buffer after the "parent buffer").
|
11425
11467
|
if (parentBuffer) {
|
11426
|
-
|
11468
|
+
var tagName = get(this, 'tagName');
|
11469
|
+
tagName = tagName == null ? 'div' : tagName;
|
11470
|
+
|
11471
|
+
buffer = parentBuffer[bufferOperation](tagName);
|
11427
11472
|
} else {
|
11428
11473
|
buffer = this.renderBuffer();
|
11429
11474
|
}
|
@@ -11431,16 +11476,23 @@ SC.View = SC.Object.extend(
|
|
11431
11476
|
viewMeta.buffer = buffer;
|
11432
11477
|
this.transitionTo('inBuffer');
|
11433
11478
|
|
11434
|
-
viewMeta.lengthBeforeRender = getPath(this, '
|
11479
|
+
viewMeta.lengthBeforeRender = getPath(this, '_childViews.length');
|
11435
11480
|
|
11436
|
-
this.
|
11481
|
+
this.beforeRender(buffer);
|
11437
11482
|
this.render(buffer);
|
11483
|
+
this.afterRender(buffer);
|
11438
11484
|
|
11439
|
-
viewMeta.lengthAfterRender = getPath(this, '
|
11485
|
+
viewMeta.lengthAfterRender = getPath(this, '_childViews.length');
|
11440
11486
|
|
11441
11487
|
return buffer;
|
11442
11488
|
},
|
11443
11489
|
|
11490
|
+
beforeRender: function(buffer) {
|
11491
|
+
this.applyAttributesToBuffer(buffer);
|
11492
|
+
},
|
11493
|
+
|
11494
|
+
afterRender: SC.K,
|
11495
|
+
|
11444
11496
|
/**
|
11445
11497
|
@private
|
11446
11498
|
*/
|
@@ -11584,7 +11636,7 @@ SC.View = SC.Object.extend(
|
|
11584
11636
|
init: function() {
|
11585
11637
|
set(this, 'state', 'preRender');
|
11586
11638
|
|
11587
|
-
var parentView = get(this, '
|
11639
|
+
var parentView = get(this, '_parentView');
|
11588
11640
|
|
11589
11641
|
this._super();
|
11590
11642
|
|
@@ -11592,27 +11644,16 @@ SC.View = SC.Object.extend(
|
|
11592
11644
|
// SC.RootResponder to dispatch incoming events.
|
11593
11645
|
SC.View.views[get(this, 'elementId')] = this;
|
11594
11646
|
|
11595
|
-
var childViews = get(this, '
|
11647
|
+
var childViews = get(this, '_childViews').slice();
|
11596
11648
|
// setup child views. be sure to clone the child views array first
|
11597
|
-
set(this, '
|
11649
|
+
set(this, '_childViews', childViews);
|
11598
11650
|
|
11599
|
-
this.mutateChildViews(function(viewName, idx) {
|
11600
|
-
var view;
|
11601
|
-
|
11602
|
-
if ('string' === typeof viewName) {
|
11603
|
-
view = get(this, viewName);
|
11604
|
-
view = this.createChildView(view);
|
11605
|
-
childViews[idx] = view;
|
11606
|
-
set(this, viewName, view);
|
11607
|
-
} else if (viewName.isClass) {
|
11608
|
-
view = this.createChildView(viewName);
|
11609
|
-
childViews[idx] = view;
|
11610
|
-
}
|
11611
|
-
});
|
11612
11651
|
|
11613
11652
|
this.classNameBindings = get(this, 'classNameBindings').slice();
|
11614
11653
|
this.classNames = get(this, 'classNames').slice();
|
11615
11654
|
|
11655
|
+
this.set('domManager', this.domManagerClass.create({ view: this }));
|
11656
|
+
|
11616
11657
|
meta(this)["SC.View"] = {};
|
11617
11658
|
},
|
11618
11659
|
|
@@ -11628,10 +11669,10 @@ SC.View = SC.Object.extend(
|
|
11628
11669
|
*/
|
11629
11670
|
removeChild: function(view) {
|
11630
11671
|
// update parent node
|
11631
|
-
set(view, '
|
11672
|
+
set(view, '_parentView', null);
|
11632
11673
|
|
11633
11674
|
// remove view from childViews array.
|
11634
|
-
var childViews = get(this, '
|
11675
|
+
var childViews = get(this, '_childViews');
|
11635
11676
|
childViews.removeObject(view);
|
11636
11677
|
|
11637
11678
|
return this;
|
@@ -11661,7 +11702,7 @@ SC.View = SC.Object.extend(
|
|
11661
11702
|
@returns {SC.View} receiver
|
11662
11703
|
*/
|
11663
11704
|
removeFromParent: function() {
|
11664
|
-
var parent = get(this, '
|
11705
|
+
var parent = get(this, '_parentView');
|
11665
11706
|
|
11666
11707
|
// Remove DOM element from parent
|
11667
11708
|
this.remove();
|
@@ -11682,8 +11723,8 @@ SC.View = SC.Object.extend(
|
|
11682
11723
|
// calling this._super() will nuke computed properties and observers,
|
11683
11724
|
// so collect any information we need before calling super.
|
11684
11725
|
var viewMeta = meta(this)['SC.View'],
|
11685
|
-
childViews = get(this, '
|
11686
|
-
parent = get(this, '
|
11726
|
+
childViews = get(this, '_childViews'),
|
11727
|
+
parent = get(this, '_parentView'),
|
11687
11728
|
elementId = get(this, 'elementId'),
|
11688
11729
|
childLen = childViews.length;
|
11689
11730
|
|
@@ -11723,10 +11764,10 @@ SC.View = SC.Object.extend(
|
|
11723
11764
|
*/
|
11724
11765
|
createChildView: function(view, attrs) {
|
11725
11766
|
if (SC.View.detect(view)) {
|
11726
|
-
view = view.create(attrs || {}, {
|
11767
|
+
view = view.create(attrs || {}, { _parentView: this });
|
11727
11768
|
} else {
|
11728
11769
|
sc_assert('must pass instance of View', view instanceof SC.View);
|
11729
|
-
set(view, '
|
11770
|
+
set(view, '_parentView', this);
|
11730
11771
|
}
|
11731
11772
|
return view;
|
11732
11773
|
},
|
@@ -11785,12 +11826,41 @@ SC.View = SC.Object.extend(
|
|
11785
11826
|
// are done on the DOM element.
|
11786
11827
|
|
11787
11828
|
SC.View.reopen({
|
11788
|
-
states: SC.View.states
|
11829
|
+
states: SC.View.states,
|
11830
|
+
domManagerClass: SC.Object.extend({
|
11831
|
+
view: this,
|
11832
|
+
|
11833
|
+
replace: function() {
|
11834
|
+
var view = get(this, 'view');
|
11835
|
+
var element = get(view, 'element');
|
11836
|
+
|
11837
|
+
set(view, 'element', null);
|
11838
|
+
|
11839
|
+
view._insertElementLater(function() {
|
11840
|
+
SC.$(element).replaceWith(get(view, 'element'));
|
11841
|
+
});
|
11842
|
+
},
|
11843
|
+
|
11844
|
+
remove: function() {
|
11845
|
+
var view = get(this, 'view');
|
11846
|
+
var elem = get(view, 'element');
|
11847
|
+
|
11848
|
+
set(view, 'element', null);
|
11849
|
+
|
11850
|
+
SC.$(elem).remove();
|
11851
|
+
}
|
11852
|
+
})
|
11789
11853
|
});
|
11790
11854
|
|
11791
11855
|
// Create a global view hash.
|
11792
11856
|
SC.View.views = {};
|
11793
11857
|
|
11858
|
+
// If someone overrides the child views computed property when
|
11859
|
+
// defining their class, we want to be able to process the user's
|
11860
|
+
// supplied childViews and then restore the original computed property
|
11861
|
+
// at view initialization time. This happens in SC.ContainerView's init
|
11862
|
+
// method.
|
11863
|
+
SC.View.childViewsProperty = childViewsProperty;
|
11794
11864
|
|
11795
11865
|
})({});
|
11796
11866
|
|
@@ -11914,7 +11984,7 @@ SC.View.states.inBuffer = {
|
|
11914
11984
|
var buffer = meta(view)['SC.View'].buffer;
|
11915
11985
|
|
11916
11986
|
childView = this.createChildView(childView, options);
|
11917
|
-
view.
|
11987
|
+
get(view, '_childViews').pushObject(childView);
|
11918
11988
|
childView.renderToBuffer(buffer);
|
11919
11989
|
return childView;
|
11920
11990
|
},
|
@@ -11974,7 +12044,7 @@ SC.View.states.inDOM = {
|
|
11974
12044
|
getElement: function(view) {
|
11975
12045
|
var parent = get(view, 'parentView');
|
11976
12046
|
if (parent) { parent = get(parent, 'element'); }
|
11977
|
-
if (parent) { return
|
12047
|
+
if (parent) { return view.findElementInParentElement(parent); }
|
11978
12048
|
},
|
11979
12049
|
|
11980
12050
|
setElement: function(view, value) {
|
@@ -11983,7 +12053,7 @@ SC.View.states.inDOM = {
|
|
11983
12053
|
view.invalidateRecursively('element');
|
11984
12054
|
view.transitionTo('preRender');
|
11985
12055
|
} else {
|
11986
|
-
throw "You cannot set an element to a non-null value when the element is already in the DOM."
|
12056
|
+
throw "You cannot set an element to a non-null value when the element is already in the DOM.";
|
11987
12057
|
}
|
11988
12058
|
|
11989
12059
|
return value;
|
@@ -11992,29 +12062,21 @@ SC.View.states.inDOM = {
|
|
11992
12062
|
// once the view has been inserted into the DOM, rerendering is
|
11993
12063
|
// deferred to allow bindings to synchronize.
|
11994
12064
|
rerender: function(view) {
|
11995
|
-
var element = get(view, 'element');
|
11996
|
-
|
11997
12065
|
view.clearRenderedChildren();
|
11998
|
-
set(view, 'element', null);
|
11999
12066
|
|
12000
|
-
view.
|
12001
|
-
|
12002
|
-
});
|
12067
|
+
get(view, 'domManager').replace();
|
12068
|
+
return view;
|
12003
12069
|
},
|
12004
12070
|
|
12005
12071
|
// once the view is already in the DOM, destroying it removes it
|
12006
12072
|
// from the DOM, nukes its element, and puts it back into the
|
12007
12073
|
// preRender state.
|
12008
12074
|
destroyElement: function(view) {
|
12009
|
-
var elem = get(this, 'element');
|
12010
|
-
|
12011
12075
|
view.invokeRecursively(function(view) {
|
12012
12076
|
this.willDestroyElement();
|
12013
12077
|
});
|
12014
12078
|
|
12015
|
-
|
12016
|
-
|
12017
|
-
SC.$(elem).remove();
|
12079
|
+
get(view, 'domManager').remove();
|
12018
12080
|
return view;
|
12019
12081
|
},
|
12020
12082
|
|
@@ -12087,7 +12149,35 @@ SC.View.states.destroyed = {
|
|
12087
12149
|
|
12088
12150
|
var get = SC.get, set = SC.set, meta = SC.meta;
|
12089
12151
|
|
12152
|
+
var childViewsProperty = SC.computed(function() {
|
12153
|
+
return get(this, '_childViews');
|
12154
|
+
}).property('_childViews').cacheable();
|
12155
|
+
|
12090
12156
|
SC.ContainerView = SC.View.extend({
|
12157
|
+
|
12158
|
+
init: function() {
|
12159
|
+
var childViews = get(this, 'childViews');
|
12160
|
+
SC.defineProperty(this, 'childViews', childViewsProperty);
|
12161
|
+
|
12162
|
+
this._super();
|
12163
|
+
|
12164
|
+
var _childViews = get(this, '_childViews');
|
12165
|
+
|
12166
|
+
childViews.forEach(function(viewName, idx) {
|
12167
|
+
var view;
|
12168
|
+
|
12169
|
+
if ('string' === typeof viewName) {
|
12170
|
+
view = get(this, viewName);
|
12171
|
+
view = this.createChildView(view);
|
12172
|
+
set(this, viewName, view);
|
12173
|
+
} else {
|
12174
|
+
view = this.createChildView(viewName);
|
12175
|
+
}
|
12176
|
+
|
12177
|
+
_childViews[idx] = view;
|
12178
|
+
}, this);
|
12179
|
+
},
|
12180
|
+
|
12091
12181
|
/**
|
12092
12182
|
Extends SC.View's implementation of renderToBuffer to
|
12093
12183
|
set up an array observer on the child views array. This
|
@@ -12901,6 +12991,57 @@ SC.TextArea.KEY_EVENTS = {
|
|
12901
12991
|
|
12902
12992
|
|
12903
12993
|
|
12994
|
+
})({});
|
12995
|
+
|
12996
|
+
|
12997
|
+
(function(exports) {
|
12998
|
+
|
12999
|
+
|
13000
|
+
var set = SC.set, get = SC.get, getPath = SC.getPath;
|
13001
|
+
|
13002
|
+
SC.MetamorphView = SC.View.extend({
|
13003
|
+
isVirtual: true,
|
13004
|
+
tagName: '',
|
13005
|
+
|
13006
|
+
init: function() {
|
13007
|
+
this._super();
|
13008
|
+
set(this, 'morph', Metamorph());
|
13009
|
+
},
|
13010
|
+
|
13011
|
+
beforeRender: function(buffer) {
|
13012
|
+
var morph = get(this, 'morph');
|
13013
|
+
buffer.push(morph.startTag());
|
13014
|
+
},
|
13015
|
+
|
13016
|
+
afterRender: function(buffer) {
|
13017
|
+
var morph = get(this, 'morph');
|
13018
|
+
buffer.push(morph.endTag());
|
13019
|
+
},
|
13020
|
+
|
13021
|
+
domManagerClass: SC.Object.extend({
|
13022
|
+
// It is not possible for a user to directly remove
|
13023
|
+
// a metamorph view as it is not in the view hierarchy.
|
13024
|
+
remove: SC.K,
|
13025
|
+
|
13026
|
+
replace: function() {
|
13027
|
+
var view = get(this, 'view');
|
13028
|
+
var morph = getPath(this, 'view.morph');
|
13029
|
+
|
13030
|
+
view.transitionTo('preRender');
|
13031
|
+
view.clearRenderedChildren();
|
13032
|
+
var buffer = view.renderToBuffer();
|
13033
|
+
|
13034
|
+
SC.run.schedule('render', this, function() {
|
13035
|
+
// FIXME: patch metamorph
|
13036
|
+
morph.html(buffer.string());
|
13037
|
+
//morph.replaceWith(buffer.string());
|
13038
|
+
view.transitionTo('inDOM');
|
13039
|
+
});
|
13040
|
+
}
|
13041
|
+
})
|
13042
|
+
});
|
13043
|
+
|
13044
|
+
|
12904
13045
|
})({});
|
12905
13046
|
|
12906
13047
|
|
@@ -12914,6 +13055,7 @@ SC.TextArea.KEY_EVENTS = {
|
|
12914
13055
|
|
12915
13056
|
var get = SC.get, set = SC.set, getPath = SC.getPath;
|
12916
13057
|
|
13058
|
+
|
12917
13059
|
/**
|
12918
13060
|
@ignore
|
12919
13061
|
@private
|
@@ -12927,19 +13069,9 @@ var get = SC.get, set = SC.set, getPath = SC.getPath;
|
|
12927
13069
|
context set up. When the associated property changes, just the template for
|
12928
13070
|
this view will re-render.
|
12929
13071
|
*/
|
12930
|
-
SC._BindableSpanView = SC.
|
13072
|
+
SC._BindableSpanView = SC.MetamorphView.extend(
|
12931
13073
|
/** @scope SC._BindableSpanView.prototype */{
|
12932
13074
|
|
12933
|
-
/**
|
12934
|
-
The type of HTML tag to use. To ensure compatibility with
|
12935
|
-
Internet Explorer 7, a `<span>` tag is used to ensure that inline elements are
|
12936
|
-
not rendered with display: block.
|
12937
|
-
|
12938
|
-
@type String
|
12939
|
-
@default 'span'
|
12940
|
-
*/
|
12941
|
-
tagName: 'span',
|
12942
|
-
|
12943
13075
|
/**
|
12944
13076
|
The function used to determine if the `displayTemplate` or
|
12945
13077
|
`inverseTemplate` should be rendered. This should be a function that takes
|
@@ -13061,6 +13193,13 @@ SC._BindableSpanView = SC.View.extend(
|
|
13061
13193
|
}
|
13062
13194
|
|
13063
13195
|
return this._super(buffer);
|
13196
|
+
},
|
13197
|
+
|
13198
|
+
destroy: function() {
|
13199
|
+
var removeObserver = get(this, 'removeObserver');
|
13200
|
+
removeObserver();
|
13201
|
+
|
13202
|
+
this._super();
|
13064
13203
|
}
|
13065
13204
|
});
|
13066
13205
|
|
@@ -13076,7 +13215,8 @@ SC._BindableSpanView = SC.View.extend(
|
|
13076
13215
|
/*globals Handlebars */
|
13077
13216
|
|
13078
13217
|
|
13079
|
-
|
13218
|
+
|
13219
|
+
var get = SC.get, getPath = SC.getPath, set = SC.set, fmt = SC.String.fmt;
|
13080
13220
|
|
13081
13221
|
(function() {
|
13082
13222
|
// Binds a property into the DOM. This will create a hook in DOM that the
|
@@ -13100,32 +13240,22 @@ var get = SC.get, getPath = SC.getPath, fmt = SC.String.fmt;
|
|
13100
13240
|
inverseTemplate: inverse,
|
13101
13241
|
property: property,
|
13102
13242
|
previousContext: ctx,
|
13103
|
-
isEscaped: options.hash.escaped
|
13104
|
-
tagName: options.hash.tagName || 'span'
|
13243
|
+
isEscaped: options.hash.escaped
|
13105
13244
|
});
|
13106
13245
|
|
13107
|
-
var observer, invoker;
|
13108
|
-
|
13109
13246
|
view.appendChild(bindView);
|
13110
13247
|
|
13111
|
-
observer = function() {
|
13112
|
-
|
13113
|
-
bindView.rerender();
|
13114
|
-
} else {
|
13115
|
-
// If no layer can be found, we can assume somewhere
|
13116
|
-
// above it has been re-rendered, so remove the
|
13117
|
-
// observer.
|
13118
|
-
SC.removeObserver(ctx, property, invoker);
|
13119
|
-
}
|
13248
|
+
var observer = function() {
|
13249
|
+
SC.run.once(function() { bindView.rerender(); });
|
13120
13250
|
};
|
13121
13251
|
|
13122
|
-
|
13123
|
-
SC.
|
13124
|
-
};
|
13252
|
+
set(bindView, 'removeObserver', function() {
|
13253
|
+
SC.removeObserver(ctx, property, observer);
|
13254
|
+
});
|
13125
13255
|
|
13126
13256
|
// Observes the given property on the context and
|
13127
13257
|
// tells the SC._BindableSpan to re-render.
|
13128
|
-
SC.addObserver(ctx, property,
|
13258
|
+
SC.addObserver(ctx, property, observer);
|
13129
13259
|
} else {
|
13130
13260
|
// The object is not observable, so just render it out and
|
13131
13261
|
// be done with it.
|
@@ -13782,9 +13912,9 @@ Handlebars.registerHelper('debugger', function() {
|
|
13782
13912
|
/*globals Handlebars */
|
13783
13913
|
|
13784
13914
|
// Find templates stored in the head tag as script tags and make them available
|
13785
|
-
// to SC.CoreView in the global SC.TEMPLATES object.
|
13786
|
-
|
13787
|
-
SC
|
13915
|
+
// to SC.CoreView in the global SC.TEMPLATES object. This will be run as as
|
13916
|
+
// jQuery DOM-ready callback.
|
13917
|
+
SC.Handlebars.bootstrap = function() {
|
13788
13918
|
SC.$('script[type="text/html"], script[type="text/x-handlebars"]')
|
13789
13919
|
.each(function() {
|
13790
13920
|
// Get a reference to the script tag
|
@@ -13831,7 +13961,9 @@ SC.$(document).ready(function() {
|
|
13831
13961
|
});
|
13832
13962
|
}
|
13833
13963
|
});
|
13834
|
-
}
|
13964
|
+
};
|
13965
|
+
|
13966
|
+
SC.$(document).ready(SC.Handlebars.bootstrap);
|
13835
13967
|
|
13836
13968
|
})({});
|
13837
13969
|
|
@@ -13843,6 +13975,7 @@ SC.$(document).ready(function() {
|
|
13843
13975
|
// License: Licensed under MIT license (see license.js)
|
13844
13976
|
// ==========================================================================
|
13845
13977
|
|
13978
|
+
|
13846
13979
|
})({});
|
13847
13980
|
|
13848
13981
|
|