sproutcore 1.0.1003 → 1.0.1008
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -0,0 +1,70 @@
|
|
1
|
+
// ==========================================================================
|
2
|
+
// Project: SproutCore - JavaScript Application Framework
|
3
|
+
// Copyright: ©2006-2009 Apple Inc. and contributors.
|
4
|
+
// License: Licened under MIT license (see license.js)
|
5
|
+
// ==========================================================================
|
6
|
+
/*globals module ok equals same test MyApp Sample */
|
7
|
+
|
8
|
+
var store, nestedStore, Application, dataSource;
|
9
|
+
|
10
|
+
module("SC.NestedStore Core Methods", {
|
11
|
+
setup: function() {
|
12
|
+
dataSource = SC.DataSource.create();
|
13
|
+
|
14
|
+
Application = {};
|
15
|
+
Application._nameDidChange = 0;
|
16
|
+
|
17
|
+
Application.File = SC.Record.extend({
|
18
|
+
|
19
|
+
nameDidChange: function(object, key) {
|
20
|
+
Application._nameDidChange++;
|
21
|
+
}.observes('name', 'url', 'isDirectory')
|
22
|
+
|
23
|
+
});
|
24
|
+
Application.FileDisk = SC.Record.extend({ });
|
25
|
+
|
26
|
+
Application.Data = {
|
27
|
+
|
28
|
+
"FileDisk": [
|
29
|
+
{ guid: '14', name: 'Main Drive', parent: null, children: null }
|
30
|
+
],
|
31
|
+
|
32
|
+
"File": [
|
33
|
+
{ guid: '10', name: 'Home', url: '/emily_parker', isDirectory: true, parent: null, children: 'Collection'},
|
34
|
+
{ guid: '11', name: 'Documents', fileType: 'documents', url: '/emily_parker/Documents', isDirectory: true, parent: '10', children: 'Collection', createdAt: 'June 15, 2007', modifiedAt: 'October 21, 2007', filetype: 'directory', isShared: false},
|
35
|
+
{ guid: '137',name: 'Library', fileType: 'library', url: '/emily_parker/Library', isDirectory: true, parent: '10', children: 'Collection', createdAt: 'June 15, 2007', modifiedAt: 'October 21, 2007', filetype: 'directory', isShared: false},
|
36
|
+
{ guid: '12', name: 'Movies', fileType: 'movies', url: '/emily_parker/Movies', isDirectory: true, parent: '10', children: 'Collection', createdAt: 'June 15, 2007', modifiedAt: 'June 15, 2007', filetype: 'directory', isShared: true, sharedAt: 'October 15, 2007', sharedUntil: 'March 31, 2008', sharedUrl: '2fhty', isPasswordRequired: true},
|
37
|
+
{ guid: '134',name: 'Music', fileType: 'music', url: '/emily_parker/Music', isDirectory: true, parent: '10', children: 'Collection', createdAt: 'June 15, 2007', modifiedAt: 'June 15, 2007', filetype: 'directory', isShared: true, sharedAt: 'October 15, 2007', sharedUntil: 'March 31, 2008', sharedUrl: '2fhty', isPasswordRequired: true},
|
38
|
+
{ guid: '135',name: 'Pictures', fileType: 'pictures', url: '/emily_parker/Pictures', isDirectory: true, parent: '10', children: 'Collection', createdAt: 'June 15, 2007', modifiedAt: 'June 15, 2007', filetype: 'directory', isShared: true, sharedAt: 'October 15, 2007', sharedUntil: 'March 31, 2008', sharedUrl: '2fhty', isPasswordRequired: true},
|
39
|
+
{ guid: '13', name: 'Auto Insurance', fileType: 'folder', url: '/emily_parker/Documents/Auto%20Insurance', isDirectory: true, parent: '11', children: 'Collection', createdAt: 'June 15, 2007', modifiedAt: 'October 21, 2007', filetype: 'directory', isShared: false},
|
40
|
+
{ guid: '14', name: 'Birthday Invitation.pdf', fileType: 'file', url: '/emily_parker/Documents/Birthday%20Invitation', isDirectory: false, parent: '11', createdAt: 'October 17, 2007', modifiedAt: 'October 21, 2007', filetype: 'pdf', isShared: false},
|
41
|
+
{ guid: '136', name: 'Software', fileType: 'software', url: '/emily_parker/Software', isDirectory: true, parent: '10', children: 'Collection', createdAt: 'June 15, 2007', modifiedAt: 'June 15, 2007', filetype: 'directory', isShared: true, sharedAt: 'October 15, 2007', sharedUntil: 'March 31, 2008', sharedUrl: '2fhty', isPasswordRequired: true}
|
42
|
+
]
|
43
|
+
};
|
44
|
+
|
45
|
+
SC.RunLoop.begin();
|
46
|
+
store = SC.Store.create({ name: 'Test nested store'} ).from(dataSource);
|
47
|
+
for(var i in Application.Data) {
|
48
|
+
store.loadRecords(Application[i], Application.Data[i]);
|
49
|
+
}
|
50
|
+
SC.RunLoop.end();
|
51
|
+
|
52
|
+
// make sure RecordType by String can map
|
53
|
+
window.Application = Application;
|
54
|
+
|
55
|
+
nestedStore = store.chain();
|
56
|
+
}
|
57
|
+
});
|
58
|
+
|
59
|
+
test("Make sure that setting an attribute on a record will only notify respective observers once", function() {
|
60
|
+
|
61
|
+
var file = nestedStore.find(Application.File, '14');
|
62
|
+
Application._nameDidChange = 0 ;
|
63
|
+
|
64
|
+
SC.RunLoop.begin();
|
65
|
+
file.writeAttribute('name', 'My Great New Name');
|
66
|
+
SC.RunLoop.end();
|
67
|
+
|
68
|
+
equals(Application._nameDidChange, 1, 'observer was only fired once');
|
69
|
+
|
70
|
+
});
|
@@ -131,6 +131,18 @@ test("should evaluate all comparators", function() {
|
|
131
131
|
q.parse();
|
132
132
|
ok(q._tokenTree.evaluate() == false, "'Tea pot' CONTAINS 'a cup' should be false");
|
133
133
|
|
134
|
+
q.conditions = "{myTeapot} CONTAINS 'Tea'";
|
135
|
+
q.parse();
|
136
|
+
ok(q._tokenTree.evaluate(null,{myTeapot: ['Tea','pot']}) == true, "['Tea', 'pot'] CONTAINS 'Tea' should be true");
|
137
|
+
|
138
|
+
q.conditions = "{myTeapot} CONTAINS 'pot'";
|
139
|
+
q.parse();
|
140
|
+
ok(q._tokenTree.evaluate(null,{myTeapot: ['Tea','pot']}) == true, "['Tea', 'pot'] CONTAINS 'pot' should be true");
|
141
|
+
|
142
|
+
q.conditions = "{myTeapot} CONTAINS 'coffee'";
|
143
|
+
q.parse();
|
144
|
+
ok(q._tokenTree.evaluate(null,{myTeapot: ['Tea','pot']}) == false, "['Tea', 'pot'] CONTAINS 'coffee' should be false");
|
145
|
+
|
134
146
|
q.conditions = "'Tea pot' MATCHES {myCup}";
|
135
147
|
q.parse();
|
136
148
|
ok(q._tokenTree.evaluate(null,{myCup: /a\sp/}) === true, "'Tea pot' MATCHES /a\sp/ should be true");
|
@@ -0,0 +1,50 @@
|
|
1
|
+
// ==========================================================================
|
2
|
+
// Project: SproutCore - JavaScript Application Framework
|
3
|
+
// Copyright: ©2006-2009 Apple Inc. and contributors.
|
4
|
+
// License: Licened under MIT license (see license.js)
|
5
|
+
// ==========================================================================
|
6
|
+
/*globals module ok equals same test MyApp */
|
7
|
+
|
8
|
+
var store, Application;
|
9
|
+
module("SC.RecordArray Error Methods", {
|
10
|
+
setup: function() {
|
11
|
+
|
12
|
+
Application = {};
|
13
|
+
Application.Thing = SC.Record.extend({
|
14
|
+
name: SC.Record.attr(String)
|
15
|
+
});
|
16
|
+
|
17
|
+
SC.RunLoop.begin();
|
18
|
+
store = SC.Store.create();
|
19
|
+
|
20
|
+
var records = [
|
21
|
+
{ guid: 1, name: 'Thing One' },
|
22
|
+
{ guid: 2, name: 'Thing Two' }
|
23
|
+
];
|
24
|
+
|
25
|
+
var types = [ Application.Thing, Application.Thing ];
|
26
|
+
|
27
|
+
store.loadRecords(types, records);
|
28
|
+
SC.RunLoop.end();
|
29
|
+
},
|
30
|
+
|
31
|
+
teardown: function() {
|
32
|
+
store = null;
|
33
|
+
Application = null;
|
34
|
+
}
|
35
|
+
});
|
36
|
+
|
37
|
+
test("Verify error methods behave correctly", function() {
|
38
|
+
var q = SC.Query.local(Application.Thing);
|
39
|
+
var things = store.find(q);
|
40
|
+
|
41
|
+
SC.RunLoop.begin();
|
42
|
+
things.set('status', SC.Record.BUSY_LOADING);
|
43
|
+
store.dataSourceDidErrorQuery(q, SC.Record.GENERIC_ERROR);
|
44
|
+
SC.RunLoop.end();
|
45
|
+
|
46
|
+
ok(things.get('isError'), "isError on things array should be YES");
|
47
|
+
|
48
|
+
equals(things.get('errorObject'), SC.Record.GENERIC_ERROR,
|
49
|
+
"get('errorObject') on things array should return the correct error object");
|
50
|
+
});
|
@@ -173,21 +173,21 @@ test("Confirm that all the states are switched as expected after running commitR
|
|
173
173
|
});
|
174
174
|
|
175
175
|
test("calling commitRecords() without explicit storeKeys", function() {
|
176
|
-
|
176
|
+
var st;
|
177
177
|
store.changelog = [storeKey1, storeKey2, storeKey3, storeKey4];
|
178
178
|
store.commitRecords();
|
179
179
|
|
180
|
-
|
181
|
-
equals(
|
180
|
+
st = store.readStatus( storeKey1);
|
181
|
+
equals(st, SC.Record.READY_CLEAN, "storeKey1 - the status shouldn't have changed. It should be READY_CLEAN ");
|
182
182
|
|
183
|
-
|
184
|
-
equals(
|
183
|
+
st = store.readStatus( storeKey2);
|
184
|
+
equals(st, SC.Record.BUSY_CREATING, "storeKey2 - the status should be SC.Record.BUSY_CREATING");
|
185
185
|
|
186
|
-
|
187
|
-
equals(
|
186
|
+
st = store.readStatus( storeKey3);
|
187
|
+
equals(st, SC.Record.BUSY_COMMITTING, "storeKey3 - the status should be SC.Record.BUSY_COMMITTING");
|
188
188
|
|
189
|
-
|
190
|
-
equals(
|
189
|
+
st = store.readStatus( storeKey4);
|
190
|
+
equals(st, SC.Record.BUSY_DESTROYING, "storeKey4 - the status should be SC.Record.BUSY_DESTROYING");
|
191
191
|
|
192
192
|
ds.expect(1, [storeKey2], [storeKey3], [storeKey4]);
|
193
193
|
});
|
@@ -50,7 +50,7 @@ module("SC.Store Core Methods", {
|
|
50
50
|
};
|
51
51
|
|
52
52
|
SC.RunLoop.begin();
|
53
|
-
store = SC.Store.create().from(dataSource);
|
53
|
+
store = SC.Store.create({ name: 'Test store'} ).from(dataSource);
|
54
54
|
for(var i in Application.Data) {
|
55
55
|
store.loadRecords(Application[i], Application.Data[i]);
|
56
56
|
}
|
@@ -61,6 +61,13 @@ module("SC.Store Core Methods", {
|
|
61
61
|
}
|
62
62
|
});
|
63
63
|
|
64
|
+
test("Verify that SC.Store's toString() includes the store's name, if it was specified", function() {
|
65
|
+
|
66
|
+
var description = store.toString();
|
67
|
+
ok(description.indexOf('Test store') !== -1, 'should contain "Test store"');
|
68
|
+
|
69
|
+
});
|
70
|
+
|
64
71
|
test("Verify loadRecords() loads data", function() {
|
65
72
|
|
66
73
|
equals(store.find(Application.File, '14').get('name'), 'Birthday Invitation.pdf', 'should return File 14');
|
@@ -8,6 +8,8 @@
|
|
8
8
|
// NOTE: The test below are based on the Data Hashes state chart. This models
|
9
9
|
// the "did_change" event in the Store portion of the diagram.
|
10
10
|
|
11
|
+
var MyApp = {};
|
12
|
+
|
11
13
|
var store, child, storeKey, json;
|
12
14
|
module("SC.Store#dataHashDidChange", {
|
13
15
|
setup: function() {
|
@@ -24,6 +26,14 @@ module("SC.Store#dataHashDidChange", {
|
|
24
26
|
store.writeDataHash(storeKey, json, SC.Record.READY_CLEAN);
|
25
27
|
store.editables = null; // manually patch to setup test state
|
26
28
|
child = store.chain(); // test multiple levels deep
|
29
|
+
|
30
|
+
|
31
|
+
MyApp.Foo = SC.Record.extend({
|
32
|
+
prop1: SC.Record.attr(String, { defaultValue: 'Default Value for prop1' }),
|
33
|
+
prop2: SC.Record.attr(String, { defaultValue: 'Default Value for prop2' }),
|
34
|
+
prop3: SC.Record.attr(String, { defaultValue: 'Default Value for prop2' })
|
35
|
+
});
|
36
|
+
|
27
37
|
}
|
28
38
|
});
|
29
39
|
|
@@ -54,13 +64,21 @@ function testStateTransition(fromState, toState) {
|
|
54
64
|
}
|
55
65
|
|
56
66
|
test("edit state = LOCKED", function() {
|
67
|
+
SC.RunLoop.begin();
|
68
|
+
|
57
69
|
store.readDataHash(storeKey); // lock
|
58
70
|
testStateTransition(SC.Store.LOCKED, SC.Store.LOCKED);
|
71
|
+
|
72
|
+
SC.RunLoop.end();
|
59
73
|
}) ;
|
60
74
|
|
61
75
|
test("edit state = EDITABLE", function() {
|
76
|
+
SC.RunLoop.begin();
|
77
|
+
|
62
78
|
store.readEditableDataHash(storeKey); // make editable
|
63
79
|
testStateTransition(SC.Store.EDITABLE, SC.Store.EDITABLE);
|
80
|
+
|
81
|
+
SC.RunLoop.end();
|
64
82
|
}) ;
|
65
83
|
|
66
84
|
// ..........................................................
|
@@ -68,11 +86,72 @@ test("edit state = EDITABLE", function() {
|
|
68
86
|
//
|
69
87
|
|
70
88
|
test("calling with array of storeKeys will edit all store keys", function() {
|
89
|
+
SC.RunLoop.begin();
|
71
90
|
|
72
91
|
var storeKeys = [storeKey, SC.Store.generateStoreKey()], idx ;
|
73
92
|
store.dataHashDidChange(storeKeys, 2000) ;
|
74
93
|
for(idx=0;idx<storeKeys.length;idx++) {
|
75
94
|
equals(store.revisions[storeKeys[idx]], 2000, 'storeKey at index %@ should have new revision'.fmt(idx));
|
76
95
|
}
|
96
|
+
|
97
|
+
SC.RunLoop.end();
|
77
98
|
});
|
78
99
|
|
100
|
+
test("calling dataHashDidChange twice with different statusOnly values before flush is called should trigger a non-statusOnly flush if any of the statusOnly values were NO", function() {
|
101
|
+
SC.RunLoop.begin();
|
102
|
+
|
103
|
+
// Create a phony record because that's the only way the 'hasDataChanges'
|
104
|
+
// data structure will be used.
|
105
|
+
var record = SC.Record.create({ id: 514 }) ;
|
106
|
+
var storeKey = SC.Record.storeKeyFor(514) ;
|
107
|
+
record = store.materializeRecord(storeKey) ;
|
108
|
+
store.dataHashDidChange(storeKey, null, NO) ;
|
109
|
+
store.dataHashDidChange(storeKey, null, YES) ;
|
110
|
+
|
111
|
+
ok(store.recordPropertyChanges.hasDataChanges.contains(storeKey), 'recordPropertyChanges.hasDataChanges should contain the storeKey %@'.fmt(storeKey)) ;
|
112
|
+
|
113
|
+
SC.RunLoop.end();
|
114
|
+
});
|
115
|
+
|
116
|
+
test("calling _notifyRecordPropertyChange twice, once with a key and once without, before flush is called should invalidate all cached properties when flush is finally called", function() {
|
117
|
+
SC.RunLoop.begin();
|
118
|
+
|
119
|
+
var mainStore = SC.Store.create();
|
120
|
+
var record = mainStore.createRecord(MyApp.Foo, {});
|
121
|
+
|
122
|
+
// Make sure the property values get cached.
|
123
|
+
var cacheIt = record.get('prop1');
|
124
|
+
cacheIt = record.get('prop2');
|
125
|
+
|
126
|
+
var storeKey = record.get('storeKey');
|
127
|
+
|
128
|
+
// Send an innocuous "prop2 changed" notification, because we want to be sure
|
129
|
+
// that if we notify about a change to one property and later also change all
|
130
|
+
// properties, all properties get changed. (Even if we notify about yet
|
131
|
+
// another individual property change after that, but still before the flush.)
|
132
|
+
mainStore._notifyRecordPropertyChange(storeKey, NO, 'prop2');
|
133
|
+
|
134
|
+
var nestedStore = mainStore.chain();
|
135
|
+
var nestedRecord = nestedStore.materializeRecord(storeKey);
|
136
|
+
|
137
|
+
// Now, set the values of prop1 and prop2 to be different for the records in
|
138
|
+
// the nested store.
|
139
|
+
nestedRecord.set('prop1', 'New value');
|
140
|
+
|
141
|
+
// Now, when we commit, we'll be changing the dataHash of the main store and
|
142
|
+
// should notify that all properties have changed.
|
143
|
+
nestedStore.commitChanges();
|
144
|
+
|
145
|
+
// Now, we'll do one more innocuous "prop3 changed" notification to ensure
|
146
|
+
// that the eventual flush does indeed invalidate *all* property caches, and
|
147
|
+
// not just prop2 and prop3.
|
148
|
+
mainStore._notifyRecordPropertyChange(storeKey, NO, 'prop3');
|
149
|
+
|
150
|
+
// Let the flush happen.
|
151
|
+
SC.RunLoop.end();
|
152
|
+
|
153
|
+
|
154
|
+
// Finally, read 'prop1' from the main store's object. It should be the new
|
155
|
+
// value!
|
156
|
+
equals(record.get('prop1'), 'New value', 'The main store’s record should return the correct value for prop1, not the stale cached version') ;
|
157
|
+
});
|
@@ -101,6 +101,12 @@ module("SC.Store#dataSourceCallbacks", {
|
|
101
101
|
number: 23,
|
102
102
|
bool: YES
|
103
103
|
};
|
104
|
+
json16 = {
|
105
|
+
guid: "commitGUID16",
|
106
|
+
string: "string",
|
107
|
+
number: 23,
|
108
|
+
bool: YES
|
109
|
+
};
|
104
110
|
storeKey1 = SC.Store.generateStoreKey();
|
105
111
|
store.writeDataHash(storeKey1, json1, SC.Record.READY_CLEAN);
|
106
112
|
storeKey2 = SC.Store.generateStoreKey();
|
@@ -134,6 +140,9 @@ module("SC.Store#dataSourceCallbacks", {
|
|
134
140
|
store.writeDataHash(storeKey14, json14, SC.Record.READY_CLEAN);
|
135
141
|
storeKey15 = SC.Store.generateStoreKey();
|
136
142
|
store.writeDataHash(storeKey15, json15, SC.Record.BUSY_CREATING);
|
143
|
+
|
144
|
+
storeKey16 = SC.Store.generateStoreKey();
|
145
|
+
store.writeDataHash(storeKey16, json16, SC.Record.BUSY_LOADING);
|
137
146
|
|
138
147
|
SC.RunLoop.begin();
|
139
148
|
|
@@ -252,3 +261,18 @@ test("Confirm that dataSourceDidError switched the records to the right states",
|
|
252
261
|
equals(status, SC.Record.ERROR,
|
253
262
|
"the status shouldn't have changed.");
|
254
263
|
});
|
264
|
+
|
265
|
+
test("Confirm that errors passed to dataSourceDidError make it into the recordErrors array", function() {
|
266
|
+
var msg = '';
|
267
|
+
|
268
|
+
ok(!store.recordErrors, "recordErrors should be null at this point");
|
269
|
+
|
270
|
+
try {
|
271
|
+
store.dataSourceDidError(storeKey16, SC.Record.GENERIC_ERROR);
|
272
|
+
} catch (error) {
|
273
|
+
msg = error.message;
|
274
|
+
}
|
275
|
+
|
276
|
+
equals(store.recordErrors[storeKey16], SC.Record.GENERIC_ERROR,
|
277
|
+
"recordErrors[storeKey] should be the right error object");
|
278
|
+
});
|
@@ -0,0 +1,62 @@
|
|
1
|
+
// ==========================================================================
|
2
|
+
// Project: SproutCore - JavaScript Application Framework
|
3
|
+
// Copyright: ©2006-2009 Apple Inc. and contributors.
|
4
|
+
// License: Licened under MIT license (see license.js)
|
5
|
+
// ==========================================================================
|
6
|
+
/*globals module ok equals same test MyApp */
|
7
|
+
|
8
|
+
var store, Application;
|
9
|
+
|
10
|
+
module("SC.Store Error Methods", {
|
11
|
+
setup: function() {
|
12
|
+
|
13
|
+
Application = {};
|
14
|
+
Application.Thing = SC.Record.extend({
|
15
|
+
name: SC.Record.attr(String)
|
16
|
+
});
|
17
|
+
|
18
|
+
SC.RunLoop.begin();
|
19
|
+
store = SC.Store.create();
|
20
|
+
|
21
|
+
var records = [
|
22
|
+
{ guid: 1, name: 'Thing One' },
|
23
|
+
{ guid: 2, name: 'Thing Two' }
|
24
|
+
];
|
25
|
+
|
26
|
+
var types = [ Application.Thing, Application.Thing ];
|
27
|
+
|
28
|
+
store.loadRecords(types, records);
|
29
|
+
SC.RunLoop.end();
|
30
|
+
},
|
31
|
+
|
32
|
+
teardown: function() {
|
33
|
+
store = null;
|
34
|
+
Application = null;
|
35
|
+
}
|
36
|
+
});
|
37
|
+
|
38
|
+
test("Verify readError() returns correct errors", function() {
|
39
|
+
var thing1 = store.find(Application.Thing, 1);
|
40
|
+
var storeKey = thing1.get('storeKey');
|
41
|
+
|
42
|
+
SC.RunLoop.begin();
|
43
|
+
store.writeStatus(storeKey, SC.Record.BUSY_LOADING);
|
44
|
+
store.dataSourceDidError(storeKey, SC.Record.GENERIC_ERROR);
|
45
|
+
SC.RunLoop.end();
|
46
|
+
|
47
|
+
equals(store.readError(storeKey), SC.Record.GENERIC_ERROR,
|
48
|
+
"store.readError(storeKey) should return the correct error object");
|
49
|
+
});
|
50
|
+
|
51
|
+
test("Verify readQueryError() returns correct errors", function() {
|
52
|
+
var q = SC.Query.local(Application.Thing);
|
53
|
+
var things = store.find(q);
|
54
|
+
|
55
|
+
SC.RunLoop.begin();
|
56
|
+
things.set('status', SC.Record.BUSY_LOADING);
|
57
|
+
store.dataSourceDidErrorQuery(q, SC.Record.GENERIC_ERROR);
|
58
|
+
SC.RunLoop.end();
|
59
|
+
|
60
|
+
equals(store.readQueryError(q), SC.Record.GENERIC_ERROR,
|
61
|
+
"store.readQueryError(q) should return the correct error object");
|
62
|
+
});
|
@@ -17,5 +17,7 @@ test("initial setup for root store", function() {
|
|
17
17
|
equals(SC.typeOf(store.revisions), SC.T_HASH, 'should have revisions');
|
18
18
|
equals(SC.typeOf(store.statuses), SC.T_HASH, 'should have statuses');
|
19
19
|
ok(!store.editables, 'should not have editables');
|
20
|
+
ok(!store.recordErrors, 'should not have recordErrors');
|
21
|
+
ok(!store.queryErrors, 'should not have queryErrors');
|
20
22
|
});
|
21
23
|
|
@@ -43,18 +43,22 @@ SC.mapDisplayNames = function(obj, level, path, seenHash, seenArray) {
|
|
43
43
|
var useHash = !!SC._mapDisplayNamesUseHashForSeenTypesHash[SC.typeOf(obj)] ;
|
44
44
|
|
45
45
|
var hash;
|
46
|
+
var arrayToCheck;
|
46
47
|
if (useHash) {
|
47
48
|
hash = SC.hashFor(obj) ;
|
48
|
-
|
49
|
+
arrayToCheck = seenHash[hash];
|
49
50
|
}
|
50
51
|
else {
|
51
|
-
|
52
|
+
arrayToCheck = seenArray;
|
52
53
|
}
|
53
|
-
|
54
|
-
|
54
|
+
|
55
|
+
if (arrayToCheck && arrayToCheck.indexOf(obj) !== -1) return ;
|
56
|
+
|
57
|
+
if (arrayToCheck) {
|
58
|
+
arrayToCheck.push(obj) ;
|
55
59
|
}
|
56
|
-
else {
|
57
|
-
|
60
|
+
else if (useHash) {
|
61
|
+
seenHash[hash] = [obj] ;
|
58
62
|
}
|
59
63
|
|
60
64
|
var loc = path.length, str, val, t;
|
@@ -18,6 +18,10 @@
|
|
18
18
|
*/
|
19
19
|
SC.PageDesignController = SC.Object.extend({
|
20
20
|
|
21
|
+
// ..........................................................
|
22
|
+
// SELECTION
|
23
|
+
//
|
24
|
+
|
21
25
|
/** The current view builder selection. */
|
22
26
|
selection: null,
|
23
27
|
|
@@ -29,9 +33,13 @@ SC.PageDesignController = SC.Object.extend({
|
|
29
33
|
The passed selection must be a Designer object.
|
30
34
|
*/
|
31
35
|
select: function(sel, extend) {
|
32
|
-
var base =
|
33
|
-
|
34
|
-
|
36
|
+
var base = this.get('selection');
|
37
|
+
if (!base || !extend || !base.contains(sel)) {
|
38
|
+
base = (!extend || !base) ? SC.CoreSet.create() : base.copy();
|
39
|
+
base.add(sel);
|
40
|
+
this.set('selection', base.freeze()) ;
|
41
|
+
}
|
42
|
+
return this ;
|
35
43
|
},
|
36
44
|
|
37
45
|
/**
|
@@ -41,14 +49,13 @@ SC.PageDesignController = SC.Object.extend({
|
|
41
49
|
*/
|
42
50
|
deselect: function(sel) {
|
43
51
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
}
|
50
|
-
|
51
|
-
this.set('selection', newSel) ;
|
52
|
+
var base = this.get('selection');
|
53
|
+
if (base && base.contains(sel)) {
|
54
|
+
base = base.copy();
|
55
|
+
base.remove(sel);
|
56
|
+
this.set('selection', base.freeze());
|
57
|
+
}
|
58
|
+
return this;
|
52
59
|
},
|
53
60
|
|
54
61
|
/**
|
@@ -56,24 +63,42 @@ SC.PageDesignController = SC.Object.extend({
|
|
56
63
|
on the old and new views.
|
57
64
|
*/
|
58
65
|
selectionDidChange: function() {
|
59
|
-
|
60
|
-
|
61
|
-
var set = SC.Set.create(sel);
|
66
|
+
var sel = this.get('selection'),
|
67
|
+
oldSel = this._selection ;
|
62
68
|
|
63
69
|
// save old selection for next time
|
64
70
|
this._selection = sel ;
|
65
71
|
|
66
72
|
// set the isSelected state on new selection.
|
67
|
-
sel.
|
73
|
+
if (sel) sel.setEach('designIsSelected', YES);
|
68
74
|
|
69
75
|
// remove the isSelected state for old selection not in new selection.
|
70
|
-
oldSel
|
71
|
-
|
72
|
-
|
76
|
+
if (oldSel) {
|
77
|
+
oldSel.forEach(function(s){
|
78
|
+
if (!sel || !sel.contains(s)) s.set('designIsSelected', NO);
|
79
|
+
}, this);
|
80
|
+
}
|
73
81
|
|
74
82
|
}.observes('selection'),
|
75
83
|
|
76
84
|
|
85
|
+
/**
|
86
|
+
Called by a view to reposition the current selection during a mouse
|
87
|
+
drag.
|
88
|
+
*/
|
89
|
+
repositionSelection: function(evt, info) {
|
90
|
+
var sel = this.get('selection');
|
91
|
+
if (sel) sel.invoke('mouseReposition', evt, info);
|
92
|
+
},
|
93
|
+
|
94
|
+
/**
|
95
|
+
Called by a view to prepare all views in selection for repositioning
|
96
|
+
*/
|
97
|
+
prepareReposition: function(info) {
|
98
|
+
var sel = this.get('selection');
|
99
|
+
if (sel) sel.invoke('prepareReposition', info);
|
100
|
+
},
|
101
|
+
|
77
102
|
// ..........................................................
|
78
103
|
// DESIGNERS
|
79
104
|
//
|
@@ -0,0 +1,10 @@
|
|
1
|
+
// ========================================================================
|
2
|
+
// SproutCore -- JavaScript Application Framework
|
3
|
+
// Copyright ©2006-2008, Sprout Systems, Inc. and contributors.
|
4
|
+
// ========================================================================
|
5
|
+
|
6
|
+
|
7
|
+
/** Default namespace for designer-specific classes */
|
8
|
+
SC.Designer = SC.Object.extend({
|
9
|
+
|
10
|
+
});
|
@@ -0,0 +1,58 @@
|
|
1
|
+
.sc-view.handles {
|
2
|
+
border: 1px rgba(185,192,255,0.5) dashed;
|
3
|
+
overflow: visible;
|
4
|
+
}
|
5
|
+
|
6
|
+
.sc-view.handles .handle {
|
7
|
+
background-color: #ffdfb2;
|
8
|
+
width: 7px;
|
9
|
+
height: 7px;
|
10
|
+
position: absolute;
|
11
|
+
top: 50%;
|
12
|
+
left: 50%;
|
13
|
+
display: block;
|
14
|
+
-webkit-border-radius: 4px;
|
15
|
+
-moz-border-radius: 4px;
|
16
|
+
border-radius: 4px;
|
17
|
+
-webkit-box-shadow: rgba(0,0,0,0.2) 0px 1px 0px;
|
18
|
+
opacity: 0.9;
|
19
|
+
margin-left: -4px;
|
20
|
+
margin-top: -4px;
|
21
|
+
}
|
22
|
+
|
23
|
+
.sc-view.handles .handle.top {
|
24
|
+
margin-top: 0;
|
25
|
+
top: -4px;
|
26
|
+
cursor: row-resize;
|
27
|
+
}
|
28
|
+
|
29
|
+
.sc-view.handles .handle.bottom {
|
30
|
+
margin-top: 0;
|
31
|
+
top: auto;
|
32
|
+
bottom: -4px;
|
33
|
+
cursor: row-resize;
|
34
|
+
}
|
35
|
+
|
36
|
+
.sc-view.handles .handle.left {
|
37
|
+
margin-left: 0;
|
38
|
+
left: -4px;
|
39
|
+
cursor: col-resize;
|
40
|
+
}
|
41
|
+
|
42
|
+
.sc-view.handles .handle.right {
|
43
|
+
margin-left: 0;
|
44
|
+
left: auto;
|
45
|
+
right: -4px;
|
46
|
+
cursor: col-resize;
|
47
|
+
}
|
48
|
+
|
49
|
+
.sc-view.handles .handle.top.left,
|
50
|
+
.sc-view.handles .handle.bottom.right {
|
51
|
+
cursor: default;
|
52
|
+
}
|
53
|
+
|
54
|
+
.sc-view.handles .handle.top.right,
|
55
|
+
.sc-view.handles .handle.bottom.left {
|
56
|
+
cursor: default;
|
57
|
+
}
|
58
|
+
|
File without changes
|
@@ -5,13 +5,17 @@
|
|
5
5
|
// ========================================================================
|
6
6
|
|
7
7
|
sc_require('views/designer');
|
8
|
-
sc_require('
|
8
|
+
sc_require('mixins/button');
|
9
9
|
|
10
10
|
SC.ButtonView.Designer = SC.ViewDesigner.extend( SC.Button.Designer,
|
11
11
|
/** @scope SC.ButtonView.Designer.prototype */ {
|
12
12
|
|
13
13
|
encodeChildViews: NO,
|
14
14
|
|
15
|
-
designProperties: 'theme buttonBehavior href'.w()
|
15
|
+
designProperties: 'theme buttonBehavior href'.w(),
|
16
|
+
|
17
|
+
canResizeVertical: NO,
|
18
|
+
|
19
|
+
canResizeHorizontal: YES
|
16
20
|
|
17
21
|
});
|