sproutcore 1.0.1003 → 1.0.1008
Sign up to get free protection for your applications and to get access to all the features.
- data/Buildfile +15 -3
- data/Rakefile +3 -7
- data/VERSION.yml +2 -2
- data/buildtasks/manifest.rake +2 -0
- data/frameworks/sproutcore/Buildfile +2 -0
- data/frameworks/sproutcore/HISTORY +218 -203
- data/frameworks/sproutcore/README +47 -6
- data/frameworks/sproutcore/apps/tests/english.lproj/main_page.css +4 -0
- data/frameworks/sproutcore/design/Design Charts.graffle +2945 -4332
- data/frameworks/sproutcore/frameworks/bootstrap/README +9 -0
- data/frameworks/sproutcore/frameworks/bootstrap/core.js +7 -0
- data/frameworks/sproutcore/frameworks/bootstrap/setup_body_class_names.js +10 -0
- data/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +28 -0
- data/frameworks/sproutcore/frameworks/bootstrap/system/loader.js +45 -0
- data/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +9 -8
- data/frameworks/sproutcore/frameworks/datastore/models/record.js +49 -9
- data/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +9 -0
- data/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +3 -2
- data/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +81 -8
- data/frameworks/sproutcore/frameworks/datastore/system/query.js +26 -5
- data/frameworks/sproutcore/frameworks/datastore/system/record_array.js +47 -0
- data/frameworks/sproutcore/frameworks/datastore/system/store.js +164 -32
- data/frameworks/sproutcore/frameworks/datastore/tests/models/many_attribute.js +32 -4
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js +56 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +1 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/unknownProperty.js +15 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +16 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +1 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +22 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/chain.js +32 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/core_methods.js +70 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/query/evaluation.js +12 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/error_methods.js +50 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js +9 -9
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/core_methods.js +8 -1
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataHashDidChange.js +79 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +24 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/error_methods.js +62 -0
- data/frameworks/sproutcore/frameworks/datastore/tests/system/store/init.js +2 -0
- data/frameworks/sproutcore/frameworks/debug/core.js +10 -6
- data/frameworks/sproutcore/frameworks/designer/controllers/page_design.js +43 -18
- data/frameworks/sproutcore/frameworks/designer/core.js +10 -0
- data/frameworks/sproutcore/frameworks/designer/english.lproj/selection_handles.css +58 -0
- data/frameworks/sproutcore/frameworks/designer/{views/mixins → mixins}/button.js +0 -0
- data/frameworks/sproutcore/frameworks/designer/views/{controls/button.js → button.js} +6 -2
- data/frameworks/sproutcore/frameworks/designer/views/designer.js +566 -136
- data/frameworks/sproutcore/frameworks/designer/views/selection_handles.js +77 -0
- data/frameworks/sproutcore/frameworks/desktop/core.js +12 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +1 -1
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/drag.css +3 -2
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +0 -36
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/menu.css +14 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/modal.css +4 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +2 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/tab.css +0 -4
- data/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +8 -5
- data/frameworks/sproutcore/frameworks/desktop/panes/alert.js +2 -2
- data/frameworks/sproutcore/frameworks/desktop/panes/menu.js +100 -111
- data/frameworks/sproutcore/frameworks/desktop/panes/panel.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/panes/picker.js +51 -13
- data/frameworks/sproutcore/frameworks/desktop/panes/{drop_down.js → select_button.js} +70 -109
- data/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +8 -0
- data/frameworks/sproutcore/frameworks/desktop/system/root_responder.js +69 -23
- data/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +4 -4
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/methods.js +2 -0
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/{dropDown → select_button}/methods.js +15 -11
- data/frameworks/sproutcore/frameworks/desktop/tests/panes/{dropDown → select_button}/ui.js +22 -22
- data/frameworks/sproutcore/frameworks/desktop/tests/views/button/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +0 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deleteSelection.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deselect.js +19 -3
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/itemViewForContentIndex.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +53 -28
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/select.js +6 -6
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectNextItem.js +23 -9
- data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectPreviousItem.js +24 -10
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowHeightForContentIndex.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_row_heights.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +10 -3
- data/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +50 -28
- data/frameworks/sproutcore/frameworks/desktop/tests/views/scroller/methods.js +6 -6
- data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +3 -3
- data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +8 -8
- data/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/views/button.js +5 -3
- data/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +4 -3
- data/frameworks/sproutcore/frameworks/desktop/views/collection.js +125 -96
- data/frameworks/sproutcore/frameworks/desktop/views/grid.js +1 -0
- data/frameworks/sproutcore/frameworks/desktop/views/list.js +68 -18
- data/frameworks/sproutcore/frameworks/desktop/views/list_item.js +134 -56
- data/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +18 -11
- data/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +562 -2
- data/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +13 -0
- data/frameworks/sproutcore/frameworks/desktop/views/progress.js +11 -8
- data/frameworks/sproutcore/frameworks/desktop/views/radio.js +7 -7
- data/frameworks/sproutcore/frameworks/desktop/views/scroll.js +99 -33
- data/frameworks/sproutcore/frameworks/desktop/views/scroller.js +3 -7
- data/frameworks/sproutcore/frameworks/desktop/views/segmented.js +0 -7
- data/frameworks/sproutcore/frameworks/desktop/views/separator.js +2 -3
- data/frameworks/sproutcore/frameworks/desktop/views/slider.js +0 -8
- data/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +1 -1
- data/frameworks/sproutcore/frameworks/desktop/views/split.js +27 -7
- data/frameworks/sproutcore/frameworks/desktop/views/tab.js +2 -6
- data/frameworks/sproutcore/frameworks/foundation/controllers/array.js +15 -10
- data/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +20 -1
- data/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/bootstrap.rhtml +3 -6
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/button_view.css +3 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/core.css +8 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/inline_editor.css +12 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/label.css +11 -0
- data/frameworks/sproutcore/frameworks/foundation/english.lproj/text_field.css +13 -0
- data/frameworks/sproutcore/frameworks/foundation/mixins/button.js +1 -2
- data/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +70 -21
- data/frameworks/sproutcore/frameworks/foundation/mixins/selection_support.js +88 -54
- data/frameworks/sproutcore/frameworks/foundation/mixins/static_layout.js +0 -25
- data/frameworks/sproutcore/frameworks/foundation/mixins/string.js +23 -2
- data/frameworks/sproutcore/frameworks/foundation/panes/pane.js +34 -23
- data/frameworks/sproutcore/frameworks/foundation/private/tree_item_observer.js +20 -0
- data/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +32 -23
- data/frameworks/sproutcore/frameworks/foundation/system/browser.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/system/bundle.js +77 -15
- data/frameworks/sproutcore/frameworks/foundation/system/core_query.js +5 -4
- data/frameworks/sproutcore/frameworks/foundation/system/cursor.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/system/render_context.js +22 -7
- data/frameworks/sproutcore/frameworks/foundation/system/request.js +466 -309
- data/frameworks/sproutcore/frameworks/foundation/system/responder.js +2 -1
- data/frameworks/sproutcore/frameworks/foundation/system/response.js +457 -0
- data/frameworks/sproutcore/frameworks/foundation/system/root_responder.js +66 -15
- data/frameworks/sproutcore/frameworks/foundation/system/routes.js +4 -4
- data/frameworks/sproutcore/frameworks/foundation/system/timer.js +6 -4
- data/frameworks/sproutcore/frameworks/foundation/system/utils.js +46 -8
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/array_case.js +17 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/enum_case.js +18 -5
- data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/null_case.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js +0 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/mixins/string.js +11 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/group_case.js +14 -14
- data/frameworks/sproutcore/frameworks/foundation/tests/system/builder.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_core.js +15 -3
- data/frameworks/sproutcore/frameworks/foundation/tests/system/datetime.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/tests/system/locale.js +8 -7
- data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js +3 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/system/request.js +51 -44
- data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/targetForAction.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/isPaused.js +4 -4
- data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/performAction.js +2 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/validators/credit_card.js +9 -9
- data/frameworks/sproutcore/frameworks/foundation/tests/validators/number.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +3 -3
- data/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +10 -3
- data/frameworks/sproutcore/frameworks/foundation/tests/views/label/ui.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/append_remove.js +14 -0
- data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +5 -5
- data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +1 -11
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/clippingFrame.js +2 -2
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/destroyLayer.js +2 -4
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/findLayerInParentLayer.js +2 -4
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/insertBefore.js +1 -1
- data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutStyle.js +0 -2
- data/frameworks/sproutcore/frameworks/foundation/validators/password.js +5 -5
- data/frameworks/sproutcore/frameworks/foundation/validators/validator.js +4 -2
- data/frameworks/sproutcore/frameworks/foundation/views/field.js +5 -8
- data/frameworks/sproutcore/frameworks/foundation/views/label.js +21 -5
- data/frameworks/sproutcore/frameworks/foundation/views/text_field.js +112 -69
- data/frameworks/sproutcore/frameworks/foundation/views/view.js +67 -6
- data/frameworks/sproutcore/frameworks/runtime/core.js +51 -2
- data/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +4 -1
- data/frameworks/sproutcore/frameworks/runtime/system/binding.js +2 -1
- data/frameworks/sproutcore/frameworks/runtime/system/enumerator.js +5 -4
- data/frameworks/sproutcore/frameworks/runtime/system/index_set.js +6 -1
- data/frameworks/sproutcore/frameworks/runtime/system/logger.js +408 -0
- data/frameworks/sproutcore/frameworks/runtime/system/object.js +15 -4
- data/frameworks/sproutcore/frameworks/runtime/system/selection_set.js +30 -2
- data/frameworks/sproutcore/frameworks/runtime/tests/core/IsEqual.js +5 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/beget.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/compare.js +3 -3
- data/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +2 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/core/isArray.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +2 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/core/tupleForPropertyPath.js +2 -2
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +1 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +11 -7
- data/frameworks/sproutcore/frameworks/runtime/tests/system/error.js +3 -2
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/add.js +18 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/remove.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +165 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +3 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/copy.js +1 -1
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/indexSetForSource.js +13 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/remove.js +24 -0
- data/frameworks/sproutcore/frameworks/runtime/tests/system/sparse_array.js +32 -13
- data/frameworks/sproutcore/frameworks/testing/english.lproj/runner.css +2 -2
- data/frameworks/sproutcore/frameworks/testing/english.lproj/testsuite.css +7 -2
- data/frameworks/sproutcore/lib/index.rhtml +6 -20
- data/frameworks/sproutcore/themes/standard_theme/Source/sc-theme-repeat-x.psd +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/button.css +0 -1
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/checkbox.css +5 -4
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/collection.css +4 -3
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/disclosure.css +7 -7
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-repeat-x.png +0 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/list_item.css +38 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/menu.css +20 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/progress.css +1 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/radio.css +3 -1
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/segmented.css +1 -0
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/split_view.css +1 -1
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/text_field.css +0 -15
- data/gen/data-source/Buildfile +18 -0
- data/gen/data-source/README +1 -0
- data/gen/data-source/USAGE +15 -0
- data/gen/data-source/templates/data_sources/@filename@.js +64 -0
- data/lib/sproutcore/builders/combine.rb +23 -0
- data/lib/sproutcore/builders/javascript.rb +27 -2
- data/lib/sproutcore/buildfile/task.rb +1 -1
- data/lib/sproutcore/helpers/entry_sorter.rb +2 -2
- data/lib/sproutcore/helpers/static_helper.rb +79 -0
- data/lib/sproutcore/models/manifest.rb +2 -2
- data/lib/sproutcore/models/target.rb +1 -1
- data/lib/sproutcore/tools/build.rb +1 -1
- data/lib/sproutcore/tools/docs.rb +3 -3
- data/lib/sproutcore/tools/gen.rb +17 -15
- data/lib/sproutcore/tools/manifest.rb +9 -9
- data/lib/sproutcore/tools/server.rb +3 -3
- data/lib/sproutcore/tools.rb +259 -250
- data/lib/sproutcore.rb +9 -1
- data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +2 -2
- data/spec/fixtures/entry_for_project/frameworks/unrelated/PLACEHOLDER +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/{lproj → english.lproj}/strings.js +0 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/main.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/resources/main_page.js +1 -0
- data/spec/fixtures/ordered_entries/apps/no_requires/t.js +1 -0
- data/spec/lib/models/manifest/find_entry.rb +12 -0
- data/spec/lib/tools/gen_spec.rb +1 -0
- data/spec/lib/tools/tools_spec.rb +1 -0
- data/sproutcore-abbot.gemspec +36 -44
- metadata +43 -44
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/indicator.gif +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sc-theme-sprite.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sticky-note.png +0 -0
- data/frameworks/sproutcore/frameworks/desktop/views/form.js +0 -594
- data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-sprite.png +0 -0
- data/lib/thor/CHANGELOG.rdoc +0 -52
- data/lib/thor/LICENSE +0 -20
- data/lib/thor/README.markdown +0 -76
- data/lib/thor/Rakefile +0 -6
- data/lib/thor/Thorfile +0 -45
- data/lib/thor/bin/rake2thor +0 -83
- data/lib/thor/bin/thor +0 -7
- data/lib/thor/lib/thor/error.rb +0 -3
- data/lib/thor/lib/thor/options.rb +0 -267
- data/lib/thor/lib/thor/ordered_hash.rb +0 -64
- data/lib/thor/lib/thor/runner.rb +0 -305
- data/lib/thor/lib/thor/task.rb +0 -83
- data/lib/thor/lib/thor/task_hash.rb +0 -22
- data/lib/thor/lib/thor/tasks/package.rb +0 -18
- data/lib/thor/lib/thor/tasks.rb +0 -77
- data/lib/thor/lib/thor/util.rb +0 -75
- data/lib/thor/lib/thor.rb +0 -170
- data/lib/thor/script/destroy +0 -14
- data/lib/thor/script/generate +0 -14
- data/lib/thor/spec/fixtures/task.thor +0 -10
- data/lib/thor/spec/options_spec.rb +0 -271
- data/lib/thor/spec/ordered_hash_spec.rb +0 -84
- data/lib/thor/spec/spec.opts +0 -1
- data/lib/thor/spec/spec_helper.rb +0 -30
- data/lib/thor/spec/task_spec.rb +0 -11
- data/lib/thor/spec/tasks_spec.rb +0 -28
- data/lib/thor/spec/thor_runner_spec.rb +0 -194
- data/lib/thor/spec/thor_spec.rb +0 -206
- data/lib/thor/spec/util_spec.rb +0 -99
- data/lib/thor/task.thor +0 -15
- data/lib/thor/thor.gemspec +0 -29
@@ -13,8 +13,8 @@ SC.LIST_ITEM_ACTION_EJECT = 'sc-list-item-cancel-eject';
|
|
13
13
|
@class
|
14
14
|
|
15
15
|
Many times list items need to display a lot more than just a label of text.
|
16
|
-
You often need to include checkboxes, icons, extra counts and
|
17
|
-
warning icon to the far right.
|
16
|
+
You often need to include checkboxes, icons, right icons, extra counts and
|
17
|
+
an action or warning icon to the far right.
|
18
18
|
|
19
19
|
A ListItemView can implement all of this for you in a more efficient way
|
20
20
|
than you might get if you simply put together a list item on your own using
|
@@ -51,6 +51,14 @@ SC.ListItemView = SC.View.extend(
|
|
51
51
|
space will be left for the icon next to the list item view.
|
52
52
|
*/
|
53
53
|
hasContentIcon: NO,
|
54
|
+
|
55
|
+
/**
|
56
|
+
(displayDelegate) True if you want the item view to display a right icon.
|
57
|
+
|
58
|
+
If false, the icon on the list item view will be hidden. Otherwise,
|
59
|
+
space will be left for the icon next to the list item view.
|
60
|
+
*/
|
61
|
+
hasContentRightIcon: NO,
|
54
62
|
|
55
63
|
/**
|
56
64
|
(displayDelegate) True if you want space to be allocated for a branch
|
@@ -76,6 +84,14 @@ SC.ListItemView = SC.View.extend(
|
|
76
84
|
icon to display. It must return either a URL or a CSS class name.
|
77
85
|
*/
|
78
86
|
contentIconKey: null,
|
87
|
+
|
88
|
+
/**
|
89
|
+
(displayDelegate) Property key to use for the right icon url
|
90
|
+
|
91
|
+
This property will be checked on the content object to determine the
|
92
|
+
icon to display. It must return either a URL or a CSS class name.
|
93
|
+
*/
|
94
|
+
contentRightIconKey: null,
|
79
95
|
|
80
96
|
/**
|
81
97
|
(displayDelegate) The name of the property used for label itself
|
@@ -135,7 +151,7 @@ SC.ListItemView = SC.View.extend(
|
|
135
151
|
disclosureState: SC.LEAF_NODE,
|
136
152
|
|
137
153
|
contentPropertyDidChange: function() {
|
138
|
-
if (this.get('isEditing')) this.discardEditing() ;
|
154
|
+
//if (this.get('isEditing')) this.discardEditing() ;
|
139
155
|
this.displayDidChange();
|
140
156
|
},
|
141
157
|
|
@@ -190,11 +206,25 @@ SC.ListItemView = SC.View.extend(
|
|
190
206
|
if (value && SC.typeOf(value) !== SC.T_STRING) value = value.toString();
|
191
207
|
if (this.get('escapeHTML')) value = SC.RenderContext.escapeHTML(value);
|
192
208
|
this.renderLabel(working, value);
|
209
|
+
|
210
|
+
// handle right icon
|
211
|
+
if (this.getDelegateProperty('hasContentRightIcon', del)) {
|
212
|
+
key = this.getDelegateProperty('contentRightIconKey', del) ;
|
213
|
+
value = (key && content) ? (content.get ? content.get(key) : content[key]) : null ;
|
214
|
+
|
215
|
+
this.renderRightIcon(working, value);
|
216
|
+
context.addClass('has-right-icon');
|
217
|
+
}
|
193
218
|
|
194
219
|
// handle unread count
|
195
220
|
key = this.getDelegateProperty('contentUnreadCountKey', del) ;
|
196
221
|
value = (key && content) ? (content.get ? content.get(key) : content[key]) : null ;
|
197
|
-
if (!SC.none(value) && (value !== 0))
|
222
|
+
if (!SC.none(value) && (value !== 0)) {
|
223
|
+
this.renderCount(working, value) ;
|
224
|
+
var digits = ['zero', 'one', 'two', 'three', 'four', 'five'];
|
225
|
+
var digit = (value.toString().length < digits.length) ? digits[value.toString().length] : digits[digits.length-1];
|
226
|
+
context.addClass('has-count %@-digit'.fmt(digit));
|
227
|
+
}
|
198
228
|
|
199
229
|
// handle action
|
200
230
|
key = this.getDelegateProperty('listItemActionProperty', del) ;
|
@@ -324,6 +354,31 @@ SC.ListItemView = SC.View.extend(
|
|
324
354
|
$label: function() {
|
325
355
|
return this.$('label') ;
|
326
356
|
},
|
357
|
+
|
358
|
+
/**
|
359
|
+
Generates a right icon for the label based on the content. This method will
|
360
|
+
only be called if the list item view has icons enabled. You can override
|
361
|
+
this method to display your own type of icon if desired.
|
362
|
+
|
363
|
+
@param {SC.RenderContext} context the render context
|
364
|
+
@param {String} icon a URL or class name.
|
365
|
+
@returns {void}
|
366
|
+
*/
|
367
|
+
renderRightIcon: function(context, icon){
|
368
|
+
// get a class name and url to include if relevant
|
369
|
+
var url = null, className = null ;
|
370
|
+
if (icon && SC.ImageView.valueIsUrl(icon)) {
|
371
|
+
url = icon; className = '' ;
|
372
|
+
} else {
|
373
|
+
className = icon; url = SC.BLANK_IMAGE_URL ;
|
374
|
+
}
|
375
|
+
|
376
|
+
// generate the img element...
|
377
|
+
context.begin('img')
|
378
|
+
.addClass('right-icon').addClass(className)
|
379
|
+
.attr('src', url)
|
380
|
+
.end();
|
381
|
+
},
|
327
382
|
|
328
383
|
/**
|
329
384
|
Generates an unread or other count for the list item. This method will
|
@@ -552,58 +607,81 @@ SC.ListItemView = SC.View.extend(
|
|
552
607
|
},
|
553
608
|
|
554
609
|
beginEditing: function() {
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
610
|
+
if (this.get('isEditing')) return YES ;
|
611
|
+
return this._beginEditing(YES);
|
612
|
+
},
|
613
|
+
|
614
|
+
_beginEditing: function(scrollIfNeeded) {
|
615
|
+
var content = this.get('content'),
|
616
|
+
del = this.get('displayDelegate'),
|
617
|
+
labelKey = this.getDelegateProperty('contentValueKey', del),
|
618
|
+
parent = this.get('parentView'),
|
619
|
+
pf = parent ? parent.get('frame') : null,
|
620
|
+
el = this.$label(),
|
621
|
+
f, v, offset, oldLineHeight, fontSize, top, lineHeight,
|
622
|
+
lineHeightShift, targetLineHeight, ret ;
|
623
|
+
|
624
|
+
// if possible, find a nearby scroll view and scroll into view.
|
625
|
+
// HACK: if we scrolled, then wait for a loop and get the item view again
|
626
|
+
// and begin editing. Right now collection view will regenerate the item
|
627
|
+
// view too often.
|
628
|
+
if (scrollIfNeeded && this.scrollToVisible()) {
|
629
|
+
var collectionView = this.get('owner'), idx = this.get('contentIndex');
|
630
|
+
this.invokeLater(function() {
|
631
|
+
var item = collectionView.itemViewForContentIndex(idx);
|
632
|
+
if (item && item._beginEditing) item._beginEditing(NO);
|
633
|
+
});
|
634
|
+
return YES; // let the scroll happen then begin editing...
|
635
|
+
}
|
636
|
+
|
637
|
+
// nothing to do...
|
638
|
+
if (!parent || !el || el.get('length')===0) return NO ;
|
639
|
+
v = (labelKey && content && content.get) ? content.get(labelKey) : null ;
|
640
|
+
|
641
|
+
|
642
|
+
f = this.computeFrameWithParentFrame(null);
|
643
|
+
offset = SC.viewportOffset(el[0]);
|
644
|
+
|
645
|
+
// if the label has a large line height, try to adjust it to something
|
646
|
+
// more reasonable so that it looks right when we show the popup editor.
|
647
|
+
oldLineHeight = el.css('lineHeight');
|
648
|
+
fontSize = el.css('fontSize');
|
649
|
+
top = this.$().css('top');
|
650
|
+
|
651
|
+
if (top) top = parseInt(top.substring(0,top.length-2),0);
|
652
|
+
else top =0;
|
653
|
+
|
654
|
+
lineHeight = oldLineHeight;
|
655
|
+
lineHeightShift = 0;
|
656
|
+
|
657
|
+
if (fontSize && lineHeight) {
|
658
|
+
targetLineHeight = fontSize * 1.5 ;
|
659
|
+
if (targetLineHeight < lineHeight) {
|
660
|
+
el.css({ lineHeight: '1.5' });
|
661
|
+
lineHeightShift = (lineHeight - targetLineHeight) / 2;
|
662
|
+
} else oldLineHeight = null ;
|
663
|
+
}
|
664
|
+
|
665
|
+
f.x = offset.x;
|
666
|
+
f.y = offset.y+top + lineHeightShift ;
|
667
|
+
f.height = el[0].offsetHeight ;
|
668
|
+
f.width = el[0].offsetWidth ;
|
669
|
+
|
670
|
+
ret = SC.InlineTextFieldView.beginEditing({
|
671
|
+
frame: f,
|
672
|
+
exampleElement: el,
|
673
|
+
delegate: this,
|
674
|
+
value: v,
|
675
|
+
multiline: NO,
|
676
|
+
isCollection: YES
|
677
|
+
}) ;
|
678
|
+
|
679
|
+
// restore old line height for original item if the old line height
|
680
|
+
// was saved.
|
681
|
+
if (oldLineHeight) el.css({ lineHeight: oldLineHeight }) ;
|
682
|
+
|
683
|
+
// Done! If this failed, then set editing back to no.
|
684
|
+
return ret ;
|
607
685
|
},
|
608
686
|
|
609
687
|
commitEditing: function() {
|
@@ -102,7 +102,7 @@ SC.MenuItemView = SC.ButtonView.extend( SC.ContentDisplay,
|
|
102
102
|
@readOnly
|
103
103
|
@type String
|
104
104
|
*/
|
105
|
-
contentCheckboxKey:
|
105
|
+
contentCheckboxKey: 'checkbox',
|
106
106
|
|
107
107
|
/**
|
108
108
|
The name of the property which will set the checkbox image for the menu
|
@@ -113,12 +113,6 @@ SC.MenuItemView = SC.ButtonView.extend( SC.ContentDisplay,
|
|
113
113
|
*/
|
114
114
|
contentActionKey: null,
|
115
115
|
|
116
|
-
/**
|
117
|
-
The name of the property which will set the checkbox state
|
118
|
-
|
119
|
-
@type Boolean
|
120
|
-
*/
|
121
|
-
isCheckboxChecked: NO,
|
122
116
|
|
123
117
|
/**
|
124
118
|
Describes the width of the menu item
|
@@ -163,7 +157,7 @@ SC.MenuItemView = SC.ButtonView.extend( SC.ContentDisplay,
|
|
163
157
|
This will hold the properties that can trigger a change in the diplay
|
164
158
|
*/
|
165
159
|
displayProperties: ['contentValueKey', 'contentIconKey', 'shortCutKey',
|
166
|
-
'contentIsBranchKey','
|
160
|
+
'contentIsBranchKey', 'itemHeight',
|
167
161
|
'subMenu','isEnabled','content'],
|
168
162
|
contentDisplayProperties: 'title value icon separator action checkbox shortcut branchItem subMenu'.w(),
|
169
163
|
/**
|
@@ -213,7 +207,10 @@ SC.MenuItemView = SC.ButtonView.extend( SC.ContentDisplay,
|
|
213
207
|
key = this.getDelegateProperty('contentIconKey', del) ;
|
214
208
|
val = (key && content) ? (content.get ? content.get(key) : content[key]) : null ;
|
215
209
|
if(val && SC.typeOf(val) !== SC.T_STRING) val = val.toString() ;
|
216
|
-
if(val)
|
210
|
+
if(val) {
|
211
|
+
this.renderImage(ic, val) ;
|
212
|
+
ic.addClass('hasIcon') ;
|
213
|
+
}
|
217
214
|
|
218
215
|
// handle label -- always invoke
|
219
216
|
key = this.getDelegateProperty('contentValueKey', del) ;
|
@@ -423,6 +420,17 @@ SC.MenuItemView = SC.ButtonView.extend( SC.ContentDisplay,
|
|
423
420
|
isAnchorMouseDown: NO,
|
424
421
|
|
425
422
|
mouseUp: function(evt) {
|
423
|
+
// SproutCore's event system will deliver the mouseUp event to the view
|
424
|
+
// that got the mouseDown event, but for menus we want to track the mouse,
|
425
|
+
// so we'll do our own dispatching.
|
426
|
+
var parentMenu = this.parentMenu() ;
|
427
|
+
if (parentMenu) {
|
428
|
+
var selectedMenuItem = parentMenu.get('currentSelectedMenuItem') ;
|
429
|
+
if (selectedMenuItem && (this !== selectedMenuItem)) {
|
430
|
+
return selectedMenuItem.tryToPerform('mouseUp', evt) ;
|
431
|
+
}
|
432
|
+
}
|
433
|
+
|
426
434
|
if (!this.get('isEnabled')) {
|
427
435
|
this.set('hasMouseExited',NO) ;
|
428
436
|
return YES ;
|
@@ -432,12 +440,11 @@ SC.MenuItemView = SC.ButtonView.extend( SC.ContentDisplay,
|
|
432
440
|
var content = this.get('content') ;
|
433
441
|
if (key) {
|
434
442
|
if (content && content.get(key)) {
|
435
|
-
this.$('.checkbox').setClass('inactive', YES) ;
|
436
443
|
content.set(key, NO) ;
|
437
444
|
} else if( content.get(key)!== undefined ) {
|
438
|
-
this.$('.checkbox').removeClass('inactive') ;
|
439
445
|
content.set(key, YES) ;
|
440
446
|
}
|
447
|
+
this.displayDidChange();
|
441
448
|
}
|
442
449
|
this._action(evt) ;
|
443
450
|
var anchor = this.getAnchor() ;
|