sproutcore 1.5.0.pre.4.1 → 1.5.0.pre.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/VERSION.yml +1 -1
- data/lib/buildtasks/manifest.rake +4 -3
- data/lib/frameworks/sproutcore/Buildfile +1 -2
- data/lib/frameworks/sproutcore/CHANGELOG.md +8 -3
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/app-selector.css +19 -23
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/button.css +139 -135
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/dock.css +5 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/general.css +0 -1
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/menu.css +10 -13
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/modal.css +9 -8
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/picker.css +19 -12
- data/lib/frameworks/sproutcore/apps/greenhouse/models/design.js +2 -2
- data/lib/frameworks/sproutcore/apps/greenhouse/states/modals.js +1 -1
- data/lib/frameworks/sproutcore/apps/greenhouse/theme.js +2 -2
- data/lib/frameworks/sproutcore/apps/greenhouse/views/plist_item.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/animation/core.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +31 -20
- data/lib/frameworks/sproutcore/frameworks/bootstrap/tests/system/browser.js +15 -9
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/responder_context.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js +23 -45
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/device.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +60 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/ready.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/ready/done.js +32 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/utils/offset.js +5 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/append_remove.js +8 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/layout.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/collection.js +51 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/core.js +18 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/handlebars.js +261 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/animation.js +55 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +2 -19
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/convertFrames.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/insertBefore.js +17 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +96 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/prepareContext.js +15 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/updateLayerLocation.js +19 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/collection.js +8 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +179 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +8 -14
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/cursor.js +7 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +51 -114
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +84 -36
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +4 -67
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +244 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +7 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +23 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChanges.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChangesFromNestedStore.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/discardChanges.js +4 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/registered_comparisons.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/registered_query_extensions.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/createRecord.js +5 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/destroyRecord.js +5 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/loadRecord.js +64 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/recordDidChange.js +38 -35
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/unloadRecords.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/system/datetime.js +7 -4
- data/lib/frameworks/sproutcore/frameworks/datetime/tests/system/datetime.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/debug/core.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/debug/invoke_once_last_debugging.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/designer/coders/object.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/designer/designers/view_designer.js +11 -3
- data/lib/frameworks/sproutcore/frameworks/designer/ext/binding.js +33 -0
- data/lib/frameworks/sproutcore/frameworks/designer/ext/object.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/designer/ext/page.js +5 -33
- data/lib/frameworks/sproutcore/frameworks/designer/ext/view.js +0 -27
- data/lib/frameworks/sproutcore/frameworks/designer/tests/coders/page.js +54 -0
- data/lib/frameworks/sproutcore/frameworks/designer/tests/designers/view_designer.js +47 -0
- data/lib/frameworks/sproutcore/frameworks/designer/views/drawing.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +19 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/navigation_builder.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +133 -39
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/mixins/border.js +6 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/ui.js +8 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/select_button/ui.js +10 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/button/ui.js +8 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/ui.js +10 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/ui_diagram.js +15 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +8 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/radio/ui.js +8 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +10 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select/ui.js +10 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +31 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/ui.js +10 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/separator.js +10 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/ui.js +10 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/stacked/ui_comments.js +15 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/ui.js +10 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/file.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +1 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +10 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/toolbar.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/collection_content.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +17 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inner_frame.js +60 -27
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/system/cookie.js +29 -18
- data/lib/frameworks/sproutcore/frameworks/foundation/system/module.js +18 -18
- data/lib/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/misc.js +62 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/integration/creating_views.js +8 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js +4 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/editable/ui.js +5 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/ui.js +5 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/cookie.js +20 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/utils/pointInElement.js +235 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +0 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/label/ui.js +8 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/views/image.js +19 -11
- data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +6 -13
- data/lib/frameworks/sproutcore/frameworks/handlebars/extensions.js +23 -117
- data/lib/frameworks/sproutcore/frameworks/handlebars/extensions/bind.js +136 -0
- data/lib/frameworks/sproutcore/frameworks/handlebars/extensions/collection.js +75 -0
- data/lib/frameworks/sproutcore/frameworks/handlebars/extensions/localization.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/handlebars/extensions/view.js +115 -0
- data/lib/frameworks/sproutcore/frameworks/handlebars/handlebars.js +143 -80
- data/lib/frameworks/sproutcore/frameworks/jquery/jquery-buffer.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/media/views/video.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array.js +14 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +13 -13
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +25 -17
- data/lib/frameworks/sproutcore/themes/ace/designs/psds/panel/pointers.psd +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/18px/button.css +18 -12
- data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/24px/button.css +30 -16
- data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/30px/button.css +27 -15
- data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/44px/button.css +5 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/button.css +8 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/button/dark/24px/button.css +25 -16
- data/lib/frameworks/sproutcore/themes/ace/resources/button/dark/30px/button.css +21 -15
- data/lib/frameworks/sproutcore/themes/ace/resources/imagebutton/ace/imagebutton.css +11 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/ace/panel.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/ace/picker.css +41 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/ace/pointers.png +0 -0
- data/lib/sproutcore.rb +2 -0
- data/lib/sproutcore/buildfile.rb +17 -17
- data/lib/sproutcore/buildfile/task.rb +4 -12
- data/lib/sproutcore/buildfile/task_manager.rb +13 -4
- data/lib/sproutcore/models/manifest.rb +3 -3
- data/lib/sproutcore/models/target.rb +1 -1
- data/spec/fixtures/real_world/Buildfile +1 -1
- data/vendor/chance/lib/chance/imagers/data_url.rb +38 -19
- data/vendor/chance/lib/chance/instance.rb +4 -7
- data/vendor/chance/lib/chance/slicing.rb +6 -10
- metadata +18 -5
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/tabbed.css +0 -68
- data/lib/frameworks/sproutcore/frameworks/designer/coders/localization.js +0 -19
- data/lib/sproutcore/buildfile/cloneable.rb +0 -34
@@ -8,8 +8,6 @@
|
|
8
8
|
/*global module test htmlbody ok equals same stop start */
|
9
9
|
|
10
10
|
|
11
|
-
htmlbody('<style> .sc-static-layout { border: 1px red dotted; } </style>');
|
12
|
-
|
13
11
|
(function() {
|
14
12
|
var iconURL= "http://www.freeiconsweb.com/Icons/16x16_people_icons/People_046.gif";
|
15
13
|
|
@@ -63,7 +61,16 @@ htmlbody('<style> .sc-static-layout { border: 1px red dotted; } </style>');
|
|
63
61
|
// ..........................................................
|
64
62
|
// TEST VIEWS
|
65
63
|
//
|
66
|
-
module('SC.TabView ui',
|
64
|
+
module('SC.TabView ui', {
|
65
|
+
setup: function(){
|
66
|
+
htmlbody('<style> .sc-static-layout { border: 1px red dotted; } </style>');
|
67
|
+
pane.standardSetup().setup();
|
68
|
+
},
|
69
|
+
teardown: function(){
|
70
|
+
pane.standardSetup().teardown();
|
71
|
+
clearHtmlbody();
|
72
|
+
}
|
73
|
+
});
|
67
74
|
|
68
75
|
test("Check that all tabViews are visible", function() {
|
69
76
|
ok(pane.view('tabView1').get('isVisibleInWindow'), 'tabView1.isVisibleInWindow should be YES');
|
@@ -524,7 +524,7 @@ SC.ButtonView = SC.View.extend(SC.Control, SC.Button,
|
|
524
524
|
paddingLeft = parseInt(label.css('paddingLeft'),0),
|
525
525
|
marginRight = parseInt(label.css('marginRight'),0),
|
526
526
|
marginLeft = parseInt(label.css('marginLeft'),0);
|
527
|
-
if(marginRight=='auto')
|
527
|
+
if(marginRight=='auto') SC.Logger.log(marginRight+","+marginLeft+","+paddingRight+","+paddingLeft);
|
528
528
|
if(!paddingRight && isNaN(paddingRight)) paddingRight = 0;
|
529
529
|
if(!paddingLeft && isNaN(paddingLeft)) paddingLeft = 0;
|
530
530
|
if(!marginRight && isNaN(marginRight)) marginRight = 0;
|
@@ -97,7 +97,7 @@ SC.FileView = SC.FieldView.extend(
|
|
97
97
|
|
98
98
|
*/
|
99
99
|
setFieldValue: function(newValue) {
|
100
|
-
|
100
|
+
SC.Logger.log("SC.FileView: setFieldValue: %@ does nothing".fmt(newValue));
|
101
101
|
//if (newValue) throw SC.$error('SC.FileView can not set the value of the file field');
|
102
102
|
},
|
103
103
|
|
@@ -27,6 +27,7 @@ SC.LIST_ITEM_ACTION_EJECT = 'sc-list-item-cancel-eject';
|
|
27
27
|
@since SproutCore 1.0
|
28
28
|
*/
|
29
29
|
SC.ListItemView = SC.View.extend(
|
30
|
+
SC.InlineEditable,
|
30
31
|
SC.Control,
|
31
32
|
/** @scope SC.ListItemView.prototype */ {
|
32
33
|
|
@@ -604,13 +605,6 @@ SC.ListItemView = SC.View.extend(
|
|
604
605
|
return YES ;
|
605
606
|
},
|
606
607
|
|
607
|
-
/** @private
|
608
|
-
Set editing to true so edits will no longer be allowed.
|
609
|
-
*/
|
610
|
-
inlineEditorWillBeginEditing: function(inlineEditor) {
|
611
|
-
this.set('isEditing', YES);
|
612
|
-
},
|
613
|
-
|
614
608
|
/** @private
|
615
609
|
Hide the label view while the inline editor covers it.
|
616
610
|
*/
|
@@ -251,6 +251,14 @@ SC.SelectFieldView = SC.FieldView.extend(
|
|
251
251
|
} else return sc_super();
|
252
252
|
},
|
253
253
|
|
254
|
+
touchStart: function(evt) {
|
255
|
+
return this.mouseDown(evt);
|
256
|
+
},
|
257
|
+
|
258
|
+
touchEnd: function(evt) {
|
259
|
+
return this.mouseUp(evt);
|
260
|
+
},
|
261
|
+
|
254
262
|
// when fetching the raw value, convert back to an object if needed...
|
255
263
|
/** @private */
|
256
264
|
getFieldValue: function() {
|
@@ -323,12 +331,14 @@ SC.SelectFieldView = SC.FieldView.extend(
|
|
323
331
|
if (this.get('isEnabled') === false) this.$()[0].disabled = true;
|
324
332
|
SC.Event.add(input, 'blur', this, this.fieldDidBlur);
|
325
333
|
SC.Event.add(input, 'focus',this, this.fieldDidFocus);
|
334
|
+
SC.Event.add(input, 'change',this, this._field_fieldValueDidChange);
|
326
335
|
},
|
327
336
|
|
328
337
|
willDestroyLayer: function() {
|
329
338
|
var input = this.$input();
|
330
339
|
SC.Event.remove(input, 'focus', this, this.fieldDidFocus);
|
331
340
|
SC.Event.remove(input, 'blur', this, this.fieldDidBlur);
|
341
|
+
SC.Event.remove(input, 'change',this, this._field_fieldValueDidChange);
|
332
342
|
}
|
333
343
|
|
334
344
|
});
|
@@ -38,8 +38,7 @@ SC.ANCHOR_BOTTOM_RIGHT = { bottom: 0, right: 0 };
|
|
38
38
|
/** @class
|
39
39
|
|
40
40
|
A toolbar view can be anchored at the top or bottom of the window to contain
|
41
|
-
your main toolbar buttons.
|
42
|
-
a leftView, rightView, and centerView, which will be properly laid out.
|
41
|
+
your main toolbar buttons.
|
43
42
|
|
44
43
|
You can also override the layout property yourself or simply set the
|
45
44
|
anchorLocation to SC.ANCHOR_TOP or SC.ANCHOR_BOTTOM. This will configure
|
@@ -49,7 +48,7 @@ SC.ANCHOR_BOTTOM_RIGHT = { bottom: 0, right: 0 };
|
|
49
48
|
@since SproutCore 1.0
|
50
49
|
*/
|
51
50
|
SC.ToolbarView = SC.View.extend(
|
52
|
-
|
51
|
+
/** @scope SC.ToolbarView.prototype */ {
|
53
52
|
|
54
53
|
classNames: ['sc-toolbar-view'],
|
55
54
|
|
@@ -60,6 +59,7 @@ SC.ToolbarView = SC.View.extend(
|
|
60
59
|
@property {String}
|
61
60
|
*/
|
62
61
|
ariaRole: 'toolbar',
|
62
|
+
|
63
63
|
/**
|
64
64
|
Default anchor location. This will be applied automatically to the
|
65
65
|
toolbar layout if you set it.
|
@@ -159,7 +159,7 @@ SC.CollectionContent = {
|
|
159
159
|
@returns {void}
|
160
160
|
*/
|
161
161
|
contentIndexExpand: function(view, content, idx) {
|
162
|
-
|
162
|
+
SC.Logger.log('contentIndexExpand(%@, %@, %@)'.fmt(view,content,idx));
|
163
163
|
},
|
164
164
|
|
165
165
|
/**
|
@@ -172,7 +172,7 @@ SC.CollectionContent = {
|
|
172
172
|
@returns {void}
|
173
173
|
*/
|
174
174
|
contentIndexCollapse: function(view, content, idx) {
|
175
|
-
|
175
|
+
SC.Logger.log('contentIndexCollapse(%@, %@, %@)'.fmt(view,content,idx));
|
176
176
|
}
|
177
177
|
|
178
178
|
};
|
@@ -125,10 +125,12 @@ SC.InlineTextFieldView = SC.TextFieldView.extend(
|
|
125
125
|
if (!this._optframe || !del) {
|
126
126
|
throw "At least frame and delegate options are required for inline editor";
|
127
127
|
}
|
128
|
-
|
128
|
+
|
129
129
|
this._originalValue = options.value;
|
130
|
-
|
130
|
+
|
131
|
+
if (SC.none(this._originalValue)){
|
131
132
|
this._originalValue = "";
|
133
|
+
}
|
132
134
|
this._multiline = (options.multiline !== undefined) ? options.multiline : NO ;
|
133
135
|
if (this._multiline) {
|
134
136
|
this.set('isTextArea', YES);
|
@@ -141,15 +143,25 @@ SC.InlineTextFieldView = SC.TextFieldView.extend(
|
|
141
143
|
this.set('validator', options.validator) ;
|
142
144
|
this.set('value', this._originalValue) ;
|
143
145
|
//this.set('selectedRange', options.selectedRange || { start: this._originalValue.length, length: 0 }) ;
|
144
|
-
|
146
|
+
|
145
147
|
// add to window.
|
146
|
-
|
148
|
+
|
149
|
+
|
150
|
+
// First try to find the pane in the options hash.
|
151
|
+
// If it's not available, ask the delegate for it.
|
147
152
|
pane = options.pane;
|
153
|
+
if (!pane) {
|
154
|
+
pane = del.get('pane');
|
155
|
+
}
|
156
|
+
paneElem = pane.$()[0];
|
148
157
|
|
149
158
|
layout.height = this._optframe.height;
|
150
159
|
layout.width=this._optframe.width;
|
160
|
+
|
151
161
|
tarLayout = options.layout;
|
152
|
-
|
162
|
+
if (!tarLayout) {
|
163
|
+
tarLayout = del.get('layout');
|
164
|
+
}
|
153
165
|
if (this._optIsCollection && tarLayout.left) {
|
154
166
|
layout.left=this._optframe.x-tarLayout.left-paneElem.offsetLeft-1;
|
155
167
|
if(SC.browser.msie==7) layout.left--;
|
@@ -12,8 +12,8 @@ SC.BEST_FIT = "fitBest";
|
|
12
12
|
SC.BEST_FIT_DOWN_ONLY = "fitBestDown";
|
13
13
|
|
14
14
|
/**
|
15
|
-
InnerFrame provides the innerFrameForSize function, which will return a frame for the
|
16
|
-
to fit within the
|
15
|
+
InnerFrame provides the innerFrameForSize function, which will return a frame for the given size adjusted
|
16
|
+
to fit within the given outer size, according to the align and scale properties.
|
17
17
|
|
18
18
|
View's that render images will find this mixin particularly useful for fitting their images.
|
19
19
|
|
@@ -29,28 +29,61 @@ SC.InnerFrame = {
|
|
29
29
|
<tr><td>SC.ALIGN_BOTTOM_LEFT</td><td>SC.ALIGN_BOTTOM</td><td>SC.ALIGN_BOTTOM_RIGHT</td></tr>
|
30
30
|
</table>
|
31
31
|
|
32
|
-
@property {SC.ALIGN_CENTER|SC.ALIGN_TOP_LEFT|SC.ALIGN_TOP|SC.ALIGN_TOP_RIGHT|SC.ALIGN_RIGHT|SC.ALIGN_BOTTOM_RIGHT|SC.BOTTOM|SC.BOTTOM_LEFT|SC.LEFT
|
32
|
+
@property {SC.ALIGN_CENTER|SC.ALIGN_TOP_LEFT|SC.ALIGN_TOP|SC.ALIGN_TOP_RIGHT|SC.ALIGN_RIGHT|SC.ALIGN_BOTTOM_RIGHT|SC.BOTTOM|SC.BOTTOM_LEFT|SC.LEFT}
|
33
33
|
@default SC.ALIGN_CENTER
|
34
34
|
*/
|
35
35
|
align: SC.ALIGN_CENTER,
|
36
36
|
|
37
|
-
|
37
|
+
/**
|
38
|
+
Returns a frame (x, y, width, height) fitting the source size (sourceWidth & sourceHeight) within the
|
39
|
+
destination size (destWidth & destHeight) according to the align and scale properties. This is essential to
|
40
|
+
positioning child views or elements within parent views or elements in elegant ways.
|
41
|
+
|
42
|
+
Examples using 'align' on a 10x10px inner size within a 20x20px outer size ('scale' = SC.SCALE_NONE):
|
43
|
+
|
44
|
+
<table>
|
45
|
+
<tr><th>'align'</th><th>innerFrameForSize(10, 10, 20, 20)</th></tr>
|
46
|
+
<tr><td>SC.ALIGN_TOP_LEFT</td><td>{x: 0, y: 0, width: 10, height: 10}</td></tr>
|
47
|
+
<tr><td>SC.ALIGN_TOP</td><td>{x: 5, y: 0, width: 10, height: 10}</td></tr>
|
48
|
+
<tr><td>SC.ALIGN_TOP_RIGHT</td><td>{x: 10, y: 0, width: 10, height: 10}</td></tr>
|
49
|
+
<tr><td>SC.ALIGN_LEFT</td><td>{x: 0, y: 5, width: 10, height: 10}</td></tr>
|
50
|
+
<tr><td>SC.ALIGN_CENTER</td><td>{x: 5, y: 5, width: 10, height: 10}</td></tr>
|
51
|
+
<tr><td>SC.ALIGN_RIGHT</td><td>{x: 10, y: 5, width: 10, height: 10}</td></tr>
|
52
|
+
<tr><td>SC.ALIGN_BOTTOM_LEFT</td><td>{x: 0, y: 10, width: 10, height: 10}</td></tr>
|
53
|
+
<tr><td>SC.ALIGN_BOTTOM</td><td>{x: 5, y: 10, width: 10, height: 10}</td></tr>
|
54
|
+
<tr><td>SC.ALIGN_BOTTOM_RIGHT</td><td>{x: 10, y: 10, width: 10, height: 10}</td></tr>
|
55
|
+
</table>
|
56
|
+
|
57
|
+
|
58
|
+
Examples using 'scale' on a 10x15px inner size within a 20x20px outer size ('align' = SC.ALIGN_CENTER):
|
59
|
+
|
60
|
+
<table>
|
61
|
+
<tr><th>'scale'</th><th>innerFrameForSize(10, 15, 20, 20)</th></tr>
|
62
|
+
<tr><td>SC.SCALE_NONE</td><td>{x: 5, y: 5, width: 10, height: 10}</td></tr>
|
63
|
+
<tr><td>SC.FILL</td><td>{x: 0, y: 0, width: 20, height: 20}</td></tr>
|
64
|
+
<tr><td>SC.FILL_PROPORTIONALLY</td><td>{x: 0, y: -5, width: 20, height: 30}</td></tr>
|
65
|
+
<tr><td>SC.BEST_FIT</td><td>{x: 3, y: 0, width: 13, height: 20}</td></tr>
|
66
|
+
<tr><td>SC.BEST_FIT_DOWN_ONLY</td><td>{x: 5, y: 3, width: 10, height: 15}</td></tr>
|
67
|
+
<tr><td>2.0</td><td>{x: 0, y: -5, width: 20, height: 30}</td></tr>
|
68
|
+
</table>
|
69
|
+
|
70
|
+
@returns {Object} the inner frame with properties: {x: value, y: value, width: value, height: value }
|
71
|
+
*/
|
72
|
+
|
73
|
+
innerFrameForSize: function(sourceWidth, sourceHeight, destWidth, destHeight) {
|
38
74
|
var align = this.get('align'),
|
39
75
|
scale = this.get('scale'),
|
40
|
-
frame = this.get('frame') || { width: 0, height: 0 }, // frame is 'null' until rendered when useStaticLayout
|
41
|
-
frameWidth = frame.width,
|
42
|
-
frameHeight = frame.height,
|
43
76
|
scaleX,
|
44
77
|
scaleY,
|
45
78
|
result;
|
46
79
|
|
47
80
|
// Fast path
|
48
|
-
result = { x: 0, y: 0, width:
|
81
|
+
result = { x: 0, y: 0, width: destWidth, height: destHeight };
|
49
82
|
if (scale === SC.FILL) return result;
|
50
83
|
|
51
84
|
// Determine the appropriate scale
|
52
|
-
scaleX =
|
53
|
-
scaleY =
|
85
|
+
scaleX = destWidth / sourceWidth;
|
86
|
+
scaleY = destHeight / sourceHeight;
|
54
87
|
|
55
88
|
switch (scale) {
|
56
89
|
case SC.FILL_PROPORTIONALLY:
|
@@ -60,7 +93,7 @@ SC.InnerFrame = {
|
|
60
93
|
scale = scaleX < scaleY ? scaleX : scaleY;
|
61
94
|
break;
|
62
95
|
case SC.BEST_FIT_DOWN_ONLY:
|
63
|
-
if ((
|
96
|
+
if ((sourceWidth > destWidth) || (sourceHeight > destHeight)) {
|
64
97
|
scale = scaleX < scaleY ? scaleX : scaleY;
|
65
98
|
} else {
|
66
99
|
scale = 1.0;
|
@@ -78,51 +111,51 @@ SC.InnerFrame = {
|
|
78
111
|
}
|
79
112
|
}
|
80
113
|
|
81
|
-
|
82
|
-
|
83
|
-
result.width = Math.round(
|
84
|
-
result.height = Math.round(
|
114
|
+
sourceWidth *= scale;
|
115
|
+
sourceHeight *= scale;
|
116
|
+
result.width = Math.round(sourceWidth);
|
117
|
+
result.height = Math.round(sourceHeight);
|
85
118
|
|
86
119
|
// Align the image within its frame
|
87
120
|
switch (align) {
|
88
121
|
case SC.ALIGN_LEFT:
|
89
122
|
result.x = 0;
|
90
|
-
result.y = (
|
123
|
+
result.y = (destHeight / 2) - (sourceHeight / 2);
|
91
124
|
break;
|
92
125
|
case SC.ALIGN_RIGHT:
|
93
|
-
result.x =
|
94
|
-
result.y = (
|
126
|
+
result.x = destWidth - sourceWidth;
|
127
|
+
result.y = (destHeight / 2) - (sourceHeight / 2);
|
95
128
|
break;
|
96
129
|
case SC.ALIGN_TOP:
|
97
|
-
result.x = (
|
130
|
+
result.x = (destWidth / 2) - (sourceWidth / 2);
|
98
131
|
result.y = 0;
|
99
132
|
break;
|
100
133
|
case SC.ALIGN_BOTTOM:
|
101
|
-
result.x = (
|
102
|
-
result.y =
|
134
|
+
result.x = (destWidth / 2) - (sourceWidth / 2);
|
135
|
+
result.y = destHeight - sourceHeight;
|
103
136
|
break;
|
104
137
|
case SC.ALIGN_TOP_LEFT:
|
105
138
|
result.x = 0;
|
106
139
|
result.y = 0;
|
107
140
|
break;
|
108
141
|
case SC.ALIGN_TOP_RIGHT:
|
109
|
-
result.x =
|
142
|
+
result.x = destWidth - sourceWidth;
|
110
143
|
result.y = 0;
|
111
144
|
break;
|
112
145
|
case SC.ALIGN_BOTTOM_LEFT:
|
113
146
|
result.x = 0;
|
114
|
-
result.y =
|
147
|
+
result.y = destHeight - sourceHeight;
|
115
148
|
break;
|
116
149
|
case SC.ALIGN_BOTTOM_RIGHT:
|
117
|
-
result.x =
|
118
|
-
result.y =
|
150
|
+
result.x = destWidth - sourceWidth;
|
151
|
+
result.y = destHeight - sourceHeight;
|
119
152
|
break;
|
120
153
|
default: // SC.ALIGN_CENTER || SC.ALIGN_MIDDLE
|
121
154
|
if (align !== SC.ALIGN_CENTER && align !== SC.ALIGN_MIDDLE) {
|
122
155
|
SC.Logger.warn("SC.InnerFrame: The align '%@' was not understood. Align must be one of SC.ALIGN_CENTER/SC.ALIGN_MIDDLE, SC.ALIGN_LEFT, SC.ALIGN_RIGHT, SC.ALIGN_TOP, SC.ALIGN_BOTTOM, SC.ALIGN_TOP_LEFT, SC.ALIGN_TOP_RIGHT, SC.ALIGN_BOTTOM_LEFT or SC.ALIGN_BOTTOM_RIGHT.".fmt(align));
|
123
156
|
}
|
124
|
-
result.x = (
|
125
|
-
result.y = (
|
157
|
+
result.x = (destWidth / 2) - (sourceWidth / 2);
|
158
|
+
result.y = (destHeight / 2) - (sourceHeight / 2);
|
126
159
|
}
|
127
160
|
|
128
161
|
return result;
|
@@ -68,7 +68,7 @@ SC.BaseTheme.canvasImageRenderDelegate = SC.RenderDelegate.create({
|
|
68
68
|
update: function(dataSource, jquery) {
|
69
69
|
var elem = jquery[0],
|
70
70
|
image = dataSource.get('image'),
|
71
|
-
frame = dataSource.
|
71
|
+
frame = dataSource.get('frame'),
|
72
72
|
frameWidth = frame.width,
|
73
73
|
frameHeight = frame.height,
|
74
74
|
innerFrame = dataSource.get('innerFrame'),
|
@@ -195,7 +195,7 @@ SC.Benchmark = {
|
|
195
195
|
}
|
196
196
|
var start = stat._starts.pop() ;
|
197
197
|
if (!start) {
|
198
|
-
|
198
|
+
SC.Logger.log('SC.Benchmark "%@" ended without a matching start. No information was saved.'.fmt(key));
|
199
199
|
return ;
|
200
200
|
}
|
201
201
|
|
@@ -503,7 +503,7 @@ SC.Benchmark = {
|
|
503
503
|
// log each line to make this easier to read on an iPad
|
504
504
|
var lines = this.report(key).split('\n'),
|
505
505
|
len = lines.length, idx;
|
506
|
-
for(idx=0;idx<len;idx++)
|
506
|
+
for(idx=0;idx<len;idx++) SC.Logger.log(lines[idx]);
|
507
507
|
},
|
508
508
|
|
509
509
|
/**
|
@@ -512,12 +512,12 @@ SC.Benchmark = {
|
|
512
512
|
*/
|
513
513
|
startProfile: function(key) {
|
514
514
|
if (!this.enabled) return ;
|
515
|
-
|
515
|
+
SC.Logger.profile(key) ;
|
516
516
|
},
|
517
517
|
|
518
518
|
endProfile: function(key) {
|
519
519
|
if (!this.enabled) return ;
|
520
|
-
|
520
|
+
SC.Logger.profileEnd(key) ;
|
521
521
|
},
|
522
522
|
|
523
523
|
// PRIVATE METHODS
|
@@ -40,6 +40,8 @@ SC.Cookie = SC.Object.extend({
|
|
40
40
|
/**
|
41
41
|
Amount of time until the cookie expires. Set to -1 in order to delete the cookie.
|
42
42
|
|
43
|
+
If passing an Integer, it is interpreted as a number of days.
|
44
|
+
|
43
45
|
@property {Integer|SC.DateTime|Date}
|
44
46
|
*/
|
45
47
|
expires: null,
|
@@ -100,32 +102,28 @@ SC.Cookie = SC.Object.extend({
|
|
100
102
|
expires = this.get('expires'),
|
101
103
|
path = this.get('path'),
|
102
104
|
domain = this.get('domain'),
|
103
|
-
secure = this.get('secure')
|
105
|
+
secure = this.get('secure'),
|
106
|
+
output = '',
|
107
|
+
date;
|
104
108
|
|
105
|
-
|
106
|
-
|
107
|
-
var date;
|
108
|
-
if (SC.typeOf(expires) === SC.T_NUMBER) {
|
109
|
+
if (expires) {
|
110
|
+
if (typeof expires === SC.T_NUMBER) {
|
109
111
|
date = new Date();
|
110
|
-
date.setTime(date.getTime()+(expires*24*60*60*1000));
|
111
|
-
}
|
112
|
-
else if (SC.DateTime && expires.get && expires.get('milliseconds')) {
|
112
|
+
date.setTime(date.getTime() + (expires*24*60*60*1000));
|
113
|
+
} else if (SC.DateTime && expires.get && expires.get('milliseconds')) {
|
113
114
|
date = new Date(expires.get('milliseconds'));
|
114
|
-
}
|
115
|
-
else if (SC.typeOf(expires.toUTCString) === SC.T_FUNCTION) {
|
115
|
+
} else if (expires.toUTCString && expires.toUTCString.apply) {
|
116
116
|
date = expires;
|
117
117
|
}
|
118
118
|
|
119
|
-
if (date)
|
120
|
-
expiresOutput = '; expires=' + date.toUTCString();
|
121
|
-
}
|
119
|
+
if (date) output = "; expires=" + date.toUTCString();
|
122
120
|
}
|
123
121
|
|
124
|
-
|
125
|
-
|
126
|
-
|
122
|
+
if (!SC.none(path)) output += '; path=' + path;
|
123
|
+
if (!SC.none(domain)) output += '; domain=' + domain;
|
124
|
+
if (secure === YES) output += '; secure';
|
127
125
|
|
128
|
-
document.cookie =
|
126
|
+
document.cookie = name + "=" + encodeURIComponent(value) + output;
|
129
127
|
|
130
128
|
return this;
|
131
129
|
}
|
@@ -142,7 +140,7 @@ SC.Cookie.mixin(
|
|
142
140
|
@returns SC.Cookie object containing name and value of cookie
|
143
141
|
*/
|
144
142
|
find: function(name) {
|
145
|
-
if (document.cookie && document.cookie
|
143
|
+
if (document.cookie && document.cookie !== '') {
|
146
144
|
var cookies = document.cookie.split(';');
|
147
145
|
for (var i = 0; i < cookies.length; i++) {
|
148
146
|
var cookie = String(cookies[i]).trim();
|
@@ -158,3 +156,16 @@ SC.Cookie.mixin(
|
|
158
156
|
}
|
159
157
|
|
160
158
|
});
|
159
|
+
|
160
|
+
SC.CookieMonster = {
|
161
|
+
nomNomNom: function(cookie) {
|
162
|
+
var isCookie = SC.kindOf(cookie, SC.Cookie);
|
163
|
+
if (isCookie) {
|
164
|
+
SC.Logger.log("YUM!");
|
165
|
+
return cookie.destroy();
|
166
|
+
}
|
167
|
+
|
168
|
+
SC.Logger.error("Y U PASS ME NO COOKIE? %@", cookie);
|
169
|
+
return NO;
|
170
|
+
}
|
171
|
+
};
|