sproutcore 1.5.0.rc.1 → 1.5.0.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/VERSION.yml +1 -1
- data/lib/frameworks/sproutcore/Buildfile +9 -4
- data/lib/frameworks/sproutcore/README.md +1 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/QuickLook/Preview.pdf +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/QuickLook/Thumbnail.tiff +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/data.plist +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image10.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image11.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image13.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image15.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image16.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image17.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image18.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image19.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image22.tiff +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image23.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image24.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image25.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image30.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image31.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image8.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image9.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/animation/core.js +23 -25
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +160 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +73 -82
- data/lib/frameworks/sproutcore/frameworks/core_foundation/core.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/bind.js +110 -7
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/collection.js +10 -7
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/localization.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/view.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions.js → core_foundation/ext/handlebars.js} +0 -57
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/object.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +11 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/main.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/application.js +14 -16
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/builder.js +29 -37
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/datetime.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +71 -19
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +3 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/page.js +5 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/selection_set.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/timer.js +21 -27
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +3 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/single_enumerable_case.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +93 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/convertLayouts.js +13 -11
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layer.js +2 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/theme.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template.js +6 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +87 -32
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +21 -25
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/cascade.js +15 -19
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +114 -167
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +4 -6
- data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/models/fetched_attribute.js +7 -7
- data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +18 -20
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +74 -72
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +36 -29
- data/lib/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +97 -78
- data/lib/frameworks/sproutcore/frameworks/datastore/system/many_array.js +117 -97
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +13 -13
- data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +111 -108
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +231 -198
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +146 -145
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/builders.js +21 -21
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +49 -50
- data/lib/frameworks/sproutcore/frameworks/datetime/{system → frameworks/core/system}/datetime.js +122 -171
- data/lib/frameworks/sproutcore/frameworks/datetime/{tests → frameworks/core/tests}/system/datetime.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/{resources → frameworks/localized/resources}/strings.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +91 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/core.js +18 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +23 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_fast_path.js +56 -45
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_group.js +5 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +21 -19
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +82 -77
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/navigation_builder.js +18 -12
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +29 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +148 -107
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +31 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/modal.js +16 -13
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/palette.js +38 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +37 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +247 -144
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/select_button.js +155 -100
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +39 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +9 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_source.js +18 -22
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +27 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +77 -44
- data/lib/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +68 -33
- data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +168 -110
- data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +37 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +187 -123
- data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +73 -49
- data/lib/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +34 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/views/file.js +51 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/views/grid.js +38 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/views/image_button.js +15 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +54 -34
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +113 -42
- data/lib/frameworks/sproutcore/frameworks/desktop/views/master_detail.js +84 -28
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +67 -51
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +122 -35
- data/lib/frameworks/sproutcore/frameworks/desktop/views/navigation.js +40 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/views/navigation_bar.js +28 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +27 -31
- data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +118 -68
- data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +117 -61
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scene.js +23 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +241 -77
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +134 -69
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segment.js +107 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +125 -48
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +165 -69
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +73 -24
- data/lib/frameworks/sproutcore/frameworks/desktop/views/separator.js +19 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list.js +16 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +14 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +43 -37
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split_divider.js +8 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/stacked.js +14 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +16 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +99 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/thumb.js +13 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/toolbar.js +58 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +34 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/views/well.js +25 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/views/workspace.js +70 -36
- data/lib/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +10 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +28 -17
- data/lib/frameworks/sproutcore/frameworks/foundation/delegates/inline_text_field.js +41 -43
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/pinch.js +42 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/swipe.js +94 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/tap.js +41 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_mixin.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +18 -9
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/collection_content.js +7 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_display.js +7 -8
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +34 -24
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/control.js +48 -18
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/misc.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tasks/preload_bundle.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +0 -11
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/date_time.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +8 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/README.md +24 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/package.json +21 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.css +215 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.js +1442 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/headless.html +24 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/index.html +18 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/logs.html +17 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/logs.js +150 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/same.js +1421 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/test.js +314 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +369 -60
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +2 -405
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +3 -9
- data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +50 -45
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +20 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +0 -9
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +36 -14
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable.js +0 -34
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable_observers.js +50 -61
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/registerDependentKeys.js +45 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/testing/core.js +3 -0
- data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +0 -1
- data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +0 -1
- data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +1 -1
- data/vendor/chance/lib/chance/instance.rb +8 -6
- metadata +41 -31
- data/lib/frameworks/sproutcore/frameworks/testing/jquery.js +0 -3559
- data/lib/frameworks/sproutcore/frameworks/testing/qunit.js +0 -827
@@ -10,16 +10,28 @@ sc_require('views/button');
|
|
10
10
|
|
11
11
|
/**
|
12
12
|
Passed to delegate when alert pane is dismissed by pressing button 1
|
13
|
+
|
14
|
+
@static
|
15
|
+
@type String
|
16
|
+
@default 'button1'
|
13
17
|
*/
|
14
18
|
SC.BUTTON1_STATUS = 'button1';
|
15
19
|
|
16
20
|
/**
|
17
21
|
Passed to delegate when alert pane is dismissed by pressing button 2
|
22
|
+
|
23
|
+
@static
|
24
|
+
@type String
|
25
|
+
@default 'button2'
|
18
26
|
*/
|
19
27
|
SC.BUTTON2_STATUS = 'button2';
|
20
28
|
|
21
29
|
/**
|
22
30
|
Passed to delegate when alert pane is dismissed by pressing button 3
|
31
|
+
|
32
|
+
@static
|
33
|
+
@type String
|
34
|
+
@default 'button3'
|
23
35
|
*/
|
24
36
|
SC.BUTTON3_STATUS = 'button3';
|
25
37
|
|
@@ -28,116 +40,108 @@ SC.BUTTON3_STATUS = 'button3';
|
|
28
40
|
|
29
41
|
Alert panes are a simple way to provide modal messaging that otherwise
|
30
42
|
blocks the user's interaction with your application. Alert panes are
|
31
|
-
useful for showing important error messages and confirmation dialogs.
|
43
|
+
useful for showing important error messages and confirmation dialogs. They
|
32
44
|
provide a better user experience than using the OS-level alert dialogs.
|
33
45
|
|
34
|
-
|
46
|
+
# Displaying an Alert Pane
|
35
47
|
|
36
|
-
The easiest way to display an alert pane is to use one of the various
|
48
|
+
The easiest way to display an alert pane is to use one of the various
|
37
49
|
class methods defined on SC.AlertPane, passing the message and an optional
|
38
|
-
detailed description and caption.
|
50
|
+
detailed description and caption.
|
39
51
|
|
40
|
-
There are four variations of this method can you can invoke:
|
52
|
+
There are four variations of this method can you can invoke:
|
41
53
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
54
|
+
- *warn()* - displays an alert pane with a warning icon to the left.
|
55
|
+
- *error()* - displays an alert with an error icon to the left
|
56
|
+
- *info()* - displays an alert with an info icon to the left
|
57
|
+
- *plain()* - displays an alert w/o any icon
|
58
|
+
- *show()* - displays an alert with a customizable icon to the left
|
47
59
|
|
48
60
|
In addition to passing a message, description and caption, you can also customize
|
49
61
|
the title of the button 1 (OK) and add an optional button 2 and 3 (Cancel or Extra).
|
50
62
|
|
51
|
-
|
52
|
-
|
53
|
-
|
63
|
+
- button1 - 1st button from the right. default:OK
|
64
|
+
- button2 - 2nd button from the right. Optional. Could be Cancel or 2nd action.
|
65
|
+
- button3 - 1st button from the left. Optional. Could be Cancel or alternative option.
|
54
66
|
|
55
67
|
Additionally, you can define a delegate object. This delegate's
|
56
68
|
'alertPaneDidDismiss()' method will be called when the pane
|
57
69
|
is dismissed, passing the pane instance and a key indicating which
|
58
70
|
button was pressed.
|
59
71
|
|
60
|
-
|
72
|
+
# Examples
|
61
73
|
|
62
74
|
Show a simple AlertPane with an OK button:
|
63
75
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
});
|
70
|
-
}}}
|
76
|
+
SC.AlertPane.warn({
|
77
|
+
message: "Could not load calendar",
|
78
|
+
description: "Your internet connection may be unavailable or our servers may be down.",
|
79
|
+
caption: "Try again in a few minutes."
|
80
|
+
});
|
71
81
|
|
72
82
|
Show an AlertPane with a customized OK title (title will be 'Try Again') and
|
73
83
|
custom action:
|
74
84
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
});
|
84
|
-
}}}
|
85
|
+
SC.AlertPane.warn({
|
86
|
+
message: "Could not load calendar",
|
87
|
+
description: "Your internet connection may be unavailable or our servers may be down.",
|
88
|
+
caption: "Try again in a few minutes.",
|
89
|
+
buttons: [
|
90
|
+
{ title: "Try Again" }
|
91
|
+
]
|
92
|
+
});
|
85
93
|
|
86
94
|
Show an AlertPane with a custom OK, a Cancel button and an Extra button,
|
87
95
|
each with custom titles. Also, pass a delegate that will be invoked when
|
88
96
|
the user's dismisses the dialog.
|
89
97
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
break;
|
98
|
+
MyApp.calendarController = SC.Object.create({
|
99
|
+
alertPaneDidDismiss: function(pane, status) {
|
100
|
+
switch(status) {
|
101
|
+
case SC.BUTTON1_STATUS:
|
102
|
+
this.tryAgain();
|
103
|
+
break;
|
97
104
|
|
98
|
-
|
99
|
-
|
100
|
-
|
105
|
+
case SC.BUTTON2_STATUS:
|
106
|
+
// do nothing
|
107
|
+
break;
|
101
108
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
}}}
|
109
|
+
case SC.BUTTON3_STATUS:
|
110
|
+
this.showMoreInfo();
|
111
|
+
break;
|
112
|
+
}
|
113
|
+
},
|
114
|
+
...
|
115
|
+
});
|
116
|
+
|
117
|
+
|
118
|
+
SC.AlertPane.warn({
|
119
|
+
message: "Could not load calendar",
|
120
|
+
description: "Your internet connection may be unavailable or our servers may be down.",
|
121
|
+
caption: "Try again in a few minutes.",
|
122
|
+
delegate: MyApp.calendarController,
|
123
|
+
buttons: [
|
124
|
+
{ title: "Try Again" },
|
125
|
+
{ title: "Cancel" },
|
126
|
+
{ title: "More Info…" }
|
127
|
+
]
|
128
|
+
});
|
123
129
|
|
124
130
|
Instead of using the delegate pattern above, you can also specify a target
|
125
131
|
and an action, similar to SC.ButtonView.
|
126
132
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
});
|
140
|
-
}}}
|
133
|
+
SC.AlertPane.warn({
|
134
|
+
message: "Could not load calendar",
|
135
|
+
description: "Your internet connection may be unavailable or our servers may be down.",
|
136
|
+
caption: "Try again in a few minutes.",
|
137
|
+
buttons: [
|
138
|
+
{
|
139
|
+
title: "OK",
|
140
|
+
action: "didClickOK",
|
141
|
+
target: MyApp.calendarController
|
142
|
+
}
|
143
|
+
]
|
144
|
+
});
|
141
145
|
|
142
146
|
Also note that in addition to passing the action as a string of the method
|
143
147
|
name that will be invoked, you can also give a function reference as the
|
@@ -147,15 +151,22 @@ SC.BUTTON3_STATUS = 'button3';
|
|
147
151
|
@extends SC.PanelPane
|
148
152
|
@since SproutCore 1.0
|
149
153
|
*/
|
150
|
-
SC.AlertPane = SC.PanelPane.extend(
|
151
|
-
|
152
|
-
classNames: 'sc-alert',
|
154
|
+
SC.AlertPane = SC.PanelPane.extend(
|
155
|
+
/** @scope SC.AlertPane.prototype */{
|
153
156
|
|
154
157
|
/**
|
155
|
-
|
156
|
-
|
158
|
+
@type Array
|
159
|
+
@default ['sc-alert']
|
160
|
+
@see SC.View#classNames
|
161
|
+
*/
|
162
|
+
classNames: ['sc-alert'],
|
157
163
|
|
158
|
-
|
164
|
+
/**
|
165
|
+
The WAI-ARIA role for alert pane.
|
166
|
+
|
167
|
+
@type String
|
168
|
+
@default 'alertdialog'
|
169
|
+
@constant
|
159
170
|
*/
|
160
171
|
ariaRole: 'alertdialog',
|
161
172
|
|
@@ -164,49 +175,61 @@ SC.AlertPane = SC.PanelPane.extend({
|
|
164
175
|
set specific button actions, they will be called on the delegate object
|
165
176
|
|
166
177
|
The method to be called on your delegate will be:
|
167
|
-
|
168
|
-
|
169
|
-
}}}
|
178
|
+
|
179
|
+
alertPaneDidDismiss: function(pane, status) {}
|
170
180
|
|
171
181
|
The status will be one of SC.BUTTON1_STATUS, SC.BUTTON2_STATUS or SC.BUTTON3_STATUS
|
172
182
|
depending on which button was clicked.
|
173
183
|
|
174
|
-
@
|
184
|
+
@type Object
|
185
|
+
@default null
|
175
186
|
*/
|
176
187
|
delegate: null,
|
177
188
|
|
178
189
|
/**
|
179
|
-
The icon URL or class name.
|
190
|
+
The icon URL or class name. If you do not set this, an alert icon will
|
180
191
|
be shown instead.
|
181
192
|
|
182
|
-
@
|
193
|
+
@type String
|
194
|
+
@default 'sc-icon-alert-48'
|
183
195
|
*/
|
184
196
|
icon: 'sc-icon-alert-48',
|
185
197
|
|
186
198
|
/**
|
187
|
-
The primary message to display.
|
199
|
+
The primary message to display. This message will appear in large bold
|
188
200
|
type at the top of the alert.
|
189
201
|
|
190
|
-
@
|
202
|
+
@type String
|
203
|
+
@default ""
|
191
204
|
*/
|
192
205
|
message: "",
|
193
206
|
|
194
207
|
/**
|
195
208
|
The ARIA label for the alert is the message, by default.
|
209
|
+
|
210
|
+
@field {String}
|
196
211
|
*/
|
197
212
|
ariaLabel: function() {
|
198
213
|
return this.get('message');
|
199
214
|
}.property('message').cacheable(),
|
200
215
|
|
201
216
|
/**
|
202
|
-
An optional detailed decription.
|
217
|
+
An optional detailed decription. Use this string to provide further
|
203
218
|
explanation of the condition and, optionally, ways the user can resolve
|
204
219
|
the problem.
|
205
220
|
|
206
|
-
@
|
221
|
+
@type String
|
222
|
+
@default ""
|
207
223
|
*/
|
208
224
|
description: "",
|
209
225
|
|
226
|
+
/**
|
227
|
+
An escaped and formatted version of the description property.
|
228
|
+
|
229
|
+
@field
|
230
|
+
@type String
|
231
|
+
@observes description
|
232
|
+
*/
|
210
233
|
displayDescription: function() {
|
211
234
|
var desc = this.get('description');
|
212
235
|
if (!desc || desc.length === 0) return desc ;
|
@@ -216,14 +239,22 @@ SC.AlertPane = SC.PanelPane.extend({
|
|
216
239
|
}.property('description').cacheable(),
|
217
240
|
|
218
241
|
/**
|
219
|
-
An optional detailed caption.
|
242
|
+
An optional detailed caption. Use this string to provide further
|
220
243
|
fine print explanation of the condition and, optionally, ways the user can resolve
|
221
244
|
the problem.
|
222
245
|
|
223
|
-
@
|
246
|
+
@type String
|
247
|
+
@default ""
|
224
248
|
*/
|
225
249
|
caption: "",
|
226
250
|
|
251
|
+
/**
|
252
|
+
An escaped and formatted version of the caption property.
|
253
|
+
|
254
|
+
@field
|
255
|
+
@type String
|
256
|
+
@observes caption
|
257
|
+
*/
|
227
258
|
displayCaption: function() {
|
228
259
|
var caption = this.get('caption');
|
229
260
|
if (!caption || caption.length === 0) return caption ;
|
@@ -235,31 +266,36 @@ SC.AlertPane = SC.PanelPane.extend({
|
|
235
266
|
/**
|
236
267
|
The button view for button 1 (OK).
|
237
268
|
|
238
|
-
@
|
269
|
+
@type SC.ButtonView
|
239
270
|
*/
|
240
271
|
button1: SC.outlet('contentView.childViews.1.childViews.1'),
|
241
272
|
|
242
273
|
/**
|
243
274
|
The button view for the button 2 (Cancel).
|
244
275
|
|
245
|
-
@
|
276
|
+
@type SC.ButtonView
|
246
277
|
*/
|
247
278
|
button2: SC.outlet('contentView.childViews.1.childViews.0'),
|
248
279
|
|
249
280
|
/**
|
250
281
|
The button view for the button 3 (Extra).
|
251
282
|
|
252
|
-
@
|
283
|
+
@type SC.ButtonView
|
253
284
|
*/
|
254
285
|
button3: SC.outlet('contentView.childViews.2.childViews.0'),
|
255
286
|
|
256
287
|
/**
|
257
288
|
The view for the button 3 (Extra) wrapper.
|
258
289
|
|
259
|
-
@
|
290
|
+
@type SC.View
|
260
291
|
*/
|
261
292
|
buttonThreeWrapper: SC.outlet('contentView.childViews.2'),
|
262
293
|
|
294
|
+
/**
|
295
|
+
@type Hash
|
296
|
+
@default { top : 0.3, centerX: 0, width: 500 }
|
297
|
+
@see SC.View#layout
|
298
|
+
*/
|
263
299
|
layout: { top : 0.3, centerX: 0, width: 500 },
|
264
300
|
|
265
301
|
/** @private - internal view that is actually displayed */
|
@@ -273,6 +309,7 @@ SC.AlertPane = SC.PanelPane.extend({
|
|
273
309
|
SC.View.extend(SC.StaticLayout, {
|
274
310
|
classNames: ['info'],
|
275
311
|
|
312
|
+
/** @private */
|
276
313
|
render: function(context, firstTime) {
|
277
314
|
var pane = this.get('pane');
|
278
315
|
if(pane.get('icon') == 'blank') context.addClass('plain');
|
@@ -380,24 +417,24 @@ SC.AlertPane = SC.PanelPane.extend({
|
|
380
417
|
|
381
418
|
});
|
382
419
|
|
383
|
-
SC.AlertPane.mixin(
|
420
|
+
SC.AlertPane.mixin(
|
421
|
+
/** @scope SC.AlertPane */{
|
384
422
|
|
385
423
|
/**
|
386
424
|
Show a dialog with a given set of hash attributes:
|
387
425
|
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
});
|
395
|
-
}}}
|
426
|
+
SC.AlertPane.show({
|
427
|
+
message: "Could not load calendar",
|
428
|
+
description: "Your internet connection may be unavailable or our servers may be down.",
|
429
|
+
caption: "Try again in a few minutes.",
|
430
|
+
delegate: MyApp.calendarController
|
431
|
+
});
|
396
432
|
|
397
433
|
See more examples for how to configure buttons and individual actions in the
|
398
434
|
documentation for the SC.AlertPane class.
|
399
435
|
|
400
436
|
@param {Hash} args
|
437
|
+
@return {SC.AlertPane} the pane shown
|
401
438
|
*/
|
402
439
|
show: function(args) {
|
403
440
|
// normalize the arguments if this is a deprecated call
|
@@ -441,6 +478,7 @@ SC.AlertPane.mixin({
|
|
441
478
|
as the dialog icon
|
442
479
|
|
443
480
|
@param {Hash} args
|
481
|
+
@return {SC.AlertPane} the pane shown
|
444
482
|
*/
|
445
483
|
warn: function(args) {
|
446
484
|
// normalize the arguments if this is a deprecated call
|
@@ -455,6 +493,7 @@ SC.AlertPane.mixin({
|
|
455
493
|
as the dialog icon
|
456
494
|
|
457
495
|
@param {Hash} args
|
496
|
+
@return {SC.AlertPane} the pane shown
|
458
497
|
*/
|
459
498
|
info: function(args) {
|
460
499
|
// normalize the arguments if this is a deprecated call
|
@@ -469,6 +508,7 @@ SC.AlertPane.mixin({
|
|
469
508
|
as the dialog icon
|
470
509
|
|
471
510
|
@param {Hash} args
|
511
|
+
@return {SC.AlertPane} the pane shown
|
472
512
|
*/
|
473
513
|
error: function(args) {
|
474
514
|
// normalize the arguments if this is a deprecated call
|
@@ -483,6 +523,7 @@ SC.AlertPane.mixin({
|
|
483
523
|
as the dialog icon
|
484
524
|
|
485
525
|
@param {Hash} args
|
526
|
+
@return {SC.AlertPane} the pane shown
|
486
527
|
*/
|
487
528
|
plain: function(args) {
|
488
529
|
// normalize the arguments if this is a deprecated call
|
@@ -4,6 +4,7 @@
|
|
4
4
|
// Portions ©2008-2011 Apple Inc. All rights reserved.
|
5
5
|
// License: Licensed under MIT license (see license.js)
|
6
6
|
// ==========================================================================
|
7
|
+
|
7
8
|
require('panes/picker');
|
8
9
|
require('views/menu_item');
|
9
10
|
|
@@ -59,20 +60,26 @@ require('views/menu_item');
|
|
59
60
|
@extends SC.PickerPane
|
60
61
|
@since SproutCore 1.0
|
61
62
|
*/
|
62
|
-
|
63
63
|
SC.MenuPane = SC.PickerPane.extend(
|
64
64
|
/** @scope SC.MenuPane.prototype */ {
|
65
65
|
|
66
|
+
/**
|
67
|
+
@property {Array}
|
68
|
+
@default ['sc-menu']
|
69
|
+
@see SC.View#classNames
|
70
|
+
*/
|
66
71
|
classNames: ['sc-menu'],
|
67
72
|
|
68
73
|
/**
|
69
|
-
The WAI-ARIA role for menu pane.
|
70
|
-
changed.
|
74
|
+
The WAI-ARIA role for menu pane.
|
71
75
|
|
72
76
|
@property {String}
|
77
|
+
@default 'menu'
|
78
|
+
@constant
|
73
79
|
*/
|
74
80
|
ariaRole: 'menu',
|
75
81
|
|
82
|
+
|
76
83
|
// ..........................................................
|
77
84
|
// PROPERTIES
|
78
85
|
//
|
@@ -83,7 +90,8 @@ SC.MenuPane = SC.PickerPane.extend(
|
|
83
90
|
various itemKey properties to tell the menu how to extract the information
|
84
91
|
it needs.
|
85
92
|
|
86
|
-
@
|
93
|
+
@property {Array}
|
94
|
+
@default []
|
87
95
|
*/
|
88
96
|
items: [],
|
89
97
|
|
@@ -97,6 +105,7 @@ SC.MenuPane = SC.PickerPane.extend(
|
|
97
105
|
Your theme can override the default values for each control size by specifying
|
98
106
|
them in the `menuRenderDelegate`. For example:
|
99
107
|
|
108
|
+
{{{
|
100
109
|
MyTheme.menuRenderDelegate = SC.BaseTheme.menuRenderDelegate.create({
|
101
110
|
'sc-tiny-size': {
|
102
111
|
itemHeight: 20,
|
@@ -105,10 +114,11 @@ SC.MenuPane = SC.PickerPane.extend(
|
|
105
114
|
submenuOffsetX: 2
|
106
115
|
}
|
107
116
|
});
|
117
|
+
}}}
|
108
118
|
|
109
119
|
Changing the controlSize once the menu is instantiated has no effect.
|
110
120
|
|
111
|
-
@
|
121
|
+
@property {String}
|
112
122
|
@default SC.REGULAR_CONTROL_SIZE
|
113
123
|
*/
|
114
124
|
controlSize: SC.REGULAR_CONTROL_SIZE,
|
@@ -122,7 +132,7 @@ SC.MenuPane = SC.PickerPane.extend(
|
|
122
132
|
If you don't specify a value, the item height will be inferred from
|
123
133
|
controlSize.
|
124
134
|
|
125
|
-
@
|
135
|
+
@property {Number}
|
126
136
|
@default itemHeight from theme if present, or 20.
|
127
137
|
*/
|
128
138
|
itemHeight: SC.propertyFromRenderDelegate('itemHeight', 20),
|
@@ -136,16 +146,17 @@ SC.MenuPane = SC.PickerPane.extend(
|
|
136
146
|
If you don't specify a value, the height of the separator menu items will
|
137
147
|
be inferred from controlSize.
|
138
148
|
|
139
|
-
@
|
149
|
+
@property {Number}
|
140
150
|
@default itemSeparatorHeight from theme, or 9.
|
141
151
|
*/
|
142
152
|
itemSeparatorHeight: SC.propertyFromRenderDelegate('itemSeparatorHeight', 9),
|
143
153
|
|
144
154
|
/**
|
145
|
-
The height of the menu pane.
|
155
|
+
The height of the menu pane. This is updated every time menuItemViews
|
146
156
|
is recalculated.
|
147
157
|
|
148
|
-
@
|
158
|
+
@property {Number}
|
159
|
+
@default 0
|
149
160
|
@isReadOnly
|
150
161
|
*/
|
151
162
|
menuHeight: 0,
|
@@ -160,7 +171,7 @@ SC.MenuPane = SC.PickerPane.extend(
|
|
160
171
|
If you don't specify a value, the padding will be inferred from the
|
161
172
|
controlSize.
|
162
173
|
|
163
|
-
@
|
174
|
+
@property {Number}
|
164
175
|
@default menuHeightPadding from theme, or 6
|
165
176
|
*/
|
166
177
|
menuHeightPadding: SC.propertyFromRenderDelegate('menuHeightPadding', 6),
|
@@ -171,7 +182,7 @@ SC.MenuPane = SC.PickerPane.extend(
|
|
171
182
|
If you don't specify a value, the padding will be inferred from the
|
172
183
|
controlSize.
|
173
184
|
|
174
|
-
@
|
185
|
+
@property {Number}
|
175
186
|
@default submenuOffsetX from theme, or 2
|
176
187
|
*/
|
177
188
|
submenuOffsetX: SC.propertyFromRenderDelegate('submenuOffsetX', 2),
|
@@ -182,7 +193,7 @@ SC.MenuPane = SC.PickerPane.extend(
|
|
182
193
|
You can place an observer on this property to be notified when the user
|
183
194
|
makes a selection.
|
184
195
|
|
185
|
-
@
|
196
|
+
@property {SC.Object}
|
186
197
|
@default null
|
187
198
|
@isReadOnly
|
188
199
|
*/
|
@@ -195,8 +206,8 @@ SC.MenuPane = SC.PickerPane.extend(
|
|
195
206
|
set here for each item in the @items@ array. You may provide your own
|
196
207
|
subclass for this property to display the customized content.
|
197
208
|
|
209
|
+
@property {SC.View}
|
198
210
|
@default SC.MenuItemView
|
199
|
-
@type SC.View
|
200
211
|
*/
|
201
212
|
exampleView: SC.MenuItemView,
|
202
213
|
|
@@ -216,6 +227,7 @@ SC.MenuPane = SC.PickerPane.extend(
|
|
216
227
|
YES if this menu pane was generated by a parent SC.MenuPane.
|
217
228
|
|
218
229
|
@type Boolean
|
230
|
+
@default NO
|
219
231
|
@isReadOnly
|
220
232
|
*/
|
221
233
|
isSubMenu: NO,
|
@@ -241,9 +253,13 @@ SC.MenuPane = SC.PickerPane.extend(
|
|
241
253
|
|
242
254
|
/**
|
243
255
|
Disable context menu.
|
256
|
+
|
257
|
+
@property {Boolean}
|
258
|
+
@default NO
|
244
259
|
*/
|
245
260
|
isContextMenuEnabled: NO,
|
246
261
|
|
262
|
+
|
247
263
|
// ..........................................................
|
248
264
|
// METHODS
|
249
265
|
//
|
@@ -255,10 +271,9 @@ SC.MenuPane = SC.PickerPane.extend(
|
|
255
271
|
anchor itself to the view, and intelligently reposition itself if the
|
256
272
|
contents of the menu exceed the available space.
|
257
273
|
|
258
|
-
@param SC.View anchorViewOrElement the view or element to which the menu
|
274
|
+
@param {SC.View} anchorViewOrElement the view or element to which the menu
|
259
275
|
should anchor.
|
260
|
-
@param preferMatrix The prefer matrix used to position the pane.
|
261
|
-
(optional)
|
276
|
+
@param {Array} (preferMatrix) The prefer matrix used to position the pane.
|
262
277
|
*/
|
263
278
|
popup: function(anchorViewOrElement, preferMatrix) {
|
264
279
|
var anchor;
|
@@ -14,26 +14,30 @@
|
|
14
14
|
panes.
|
15
15
|
|
16
16
|
A modal pane is automatically appended when a pane with isModal set to
|
17
|
-
YES is made visible and removed when the same pane is hidden. The only
|
18
|
-
purpose of the ModalPane is to absorb mouse events so that they cannot
|
19
|
-
filter through to the underlying content.
|
17
|
+
YES is made visible and removed when the same pane is hidden. The only
|
18
|
+
purpose of the ModalPane is to absorb mouse events so that they cannot
|
19
|
+
filter through to the underlying content.
|
20
20
|
|
21
21
|
@extends SC.Pane
|
22
22
|
@since SproutCore 1.0
|
23
23
|
*/
|
24
|
-
SC.ModalPane = SC.Pane.extend(
|
24
|
+
SC.ModalPane = SC.Pane.extend(
|
25
|
+
/** @scope SC.ModalPane.prototype */{
|
25
26
|
|
27
|
+
/**
|
28
|
+
@type Array
|
29
|
+
@default ['sc-modal']
|
30
|
+
@see SC.View#classNames
|
31
|
+
*/
|
26
32
|
classNames: 'sc-modal',
|
27
33
|
|
28
|
-
/** @private
|
29
|
-
layout: { top: 0, left: 0, bottom: 0, right: 0 },
|
30
|
-
|
34
|
+
/** @private */
|
31
35
|
_openPaneCount: 0,
|
32
36
|
|
33
|
-
/**
|
37
|
+
/** @private
|
34
38
|
Called by a pane just before it appends itself. The modal pane can
|
35
39
|
make itself visible first if needed.
|
36
|
-
|
40
|
+
|
37
41
|
@param {SC.Pane} pane the pane
|
38
42
|
@returns {SC.ModalPane} receiver
|
39
43
|
*/
|
@@ -43,7 +47,7 @@ SC.ModalPane = SC.Pane.extend({
|
|
43
47
|
return this ;
|
44
48
|
},
|
45
49
|
|
46
|
-
/**
|
50
|
+
/** @private
|
47
51
|
Called by a pane just after it removes itself. The modal pane can remove
|
48
52
|
itself if needed. Modal panes only remove themselves when an equal
|
49
53
|
number of paneWillAppend() and paneDidRemove() calls are received.
|
@@ -59,14 +63,13 @@ SC.ModalPane = SC.Pane.extend({
|
|
59
63
|
}
|
60
64
|
},
|
61
65
|
|
62
|
-
/**
|
63
|
-
If owner pane implements modalPaneDidClick(), call it on mouse down.
|
64
|
-
*/
|
66
|
+
/** @private */
|
65
67
|
mouseDown: function(evt) {
|
66
68
|
var owner = this.get('owner');
|
67
69
|
if (owner && owner.modalPaneDidClick) owner.modalPaneDidClick(evt);
|
68
70
|
},
|
69
71
|
|
72
|
+
/** @private */
|
70
73
|
touchStart: function(evt) {
|
71
74
|
this.mouseDown(evt);
|
72
75
|
}
|