discourse-ember-source 3.5.1.1 → 3.5.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ember/version.rb +1 -1
- metadata +2 -740
- data/.gitignore +0 -9
- data/.travis.yml +0 -5
- data/Gemfile +0 -6
- data/LICENSE.txt +0 -21
- data/README +0 -18
- data/README.md +0 -39
- data/Rakefile +0 -27
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/discourse-ember-source-3.5.1.0.gem +0 -0
- data/dist/ember-all.debug.map +0 -1
- data/dist/ember-template-compiler.map +0 -1
- data/dist/ember-testing.map +0 -1
- data/dist/ember-tests.map +0 -1
- data/dist/ember-tests.prod.map +0 -1
- data/dist/ember.debug.map +0 -1
- data/dist/ember.min.map +0 -1
- data/dist/ember.prod.map +0 -1
- data/dist/es/@ember/application/globals-resolver.js +0 -425
- data/dist/es/@ember/application/index.js +0 -3
- data/dist/es/@ember/application/instance.js +0 -513
- data/dist/es/@ember/application/lib/application.js +0 -1139
- data/dist/es/@ember/application/lib/lazy_load.js +0 -69
- data/dist/es/@ember/application/lib/validate-type.js +0 -24
- data/dist/es/@ember/application/tests/application_instance_test.js +0 -230
- data/dist/es/@ember/application/tests/application_test.js +0 -470
- data/dist/es/@ember/application/tests/bootstrap-test.js +0 -28
- data/dist/es/@ember/application/tests/dependency_injection/custom_resolver_test.js +0 -32
- data/dist/es/@ember/application/tests/dependency_injection/default_resolver_test.js +0 -363
- data/dist/es/@ember/application/tests/dependency_injection/normalization_test.js +0 -70
- data/dist/es/@ember/application/tests/dependency_injection/to_string_test.js +0 -71
- data/dist/es/@ember/application/tests/dependency_injection_test.js +0 -93
- data/dist/es/@ember/application/tests/initializers_test.js +0 -391
- data/dist/es/@ember/application/tests/instance_initializers_test.js +0 -395
- data/dist/es/@ember/application/tests/lazy_load_test.js +0 -79
- data/dist/es/@ember/application/tests/logging_test.js +0 -179
- data/dist/es/@ember/application/tests/readiness_test.js +0 -138
- data/dist/es/@ember/application/tests/reset_test.js +0 -185
- data/dist/es/@ember/application/tests/visit_test.js +0 -783
- data/dist/es/@ember/canary-features/index.js +0 -76
- data/dist/es/@ember/controller/index.js +0 -50
- data/dist/es/@ember/controller/lib/controller_mixin.js +0 -42
- data/dist/es/@ember/controller/tests/controller_test.js +0 -209
- data/dist/es/@ember/debug/index.js +0 -264
- data/dist/es/@ember/debug/lib/deprecate.js +0 -198
- data/dist/es/@ember/debug/lib/handlers.js +0 -22
- data/dist/es/@ember/debug/lib/testing.js +0 -7
- data/dist/es/@ember/debug/lib/warn.js +0 -107
- data/dist/es/@ember/debug/tests/handlers-test.js +0 -144
- data/dist/es/@ember/debug/tests/main_test.js +0 -444
- data/dist/es/@ember/deprecated-features/index.js +0 -21
- data/dist/es/@ember/engine/index.js +0 -532
- data/dist/es/@ember/engine/instance.js +0 -228
- data/dist/es/@ember/engine/lib/engine-parent.js +0 -32
- data/dist/es/@ember/engine/tests/engine_initializers_test.js +0 -366
- data/dist/es/@ember/engine/tests/engine_instance_initializers_test.js +0 -409
- data/dist/es/@ember/engine/tests/engine_instance_test.js +0 -115
- data/dist/es/@ember/engine/tests/engine_parent_test.js +0 -20
- data/dist/es/@ember/engine/tests/engine_test.js +0 -121
- data/dist/es/@ember/error/index.js +0 -36
- data/dist/es/@ember/error/tests/index_test.js +0 -19
- data/dist/es/@ember/instrumentation/index.js +0 -240
- data/dist/es/@ember/instrumentation/tests/index-test.js +0 -214
- data/dist/es/@ember/map/index.js +0 -218
- data/dist/es/@ember/map/lib/ordered-set.js +0 -186
- data/dist/es/@ember/map/lib/utils.js +0 -29
- data/dist/es/@ember/map/tests/map_test.js +0 -578
- data/dist/es/@ember/map/with-default.js +0 -87
- data/dist/es/@ember/object/computed.js +0 -35
- data/dist/es/@ember/object/lib/computed/computed_macros.js +0 -742
- data/dist/es/@ember/object/lib/computed/reduce_computed_macros.js +0 -894
- data/dist/es/@ember/object/tests/computed/computed_macros_test.js +0 -533
- data/dist/es/@ember/object/tests/computed/reduce_computed_macros_test.js +0 -2243
- data/dist/es/@ember/polyfills/index.js +0 -3
- data/dist/es/@ember/polyfills/lib/assign.js +0 -43
- data/dist/es/@ember/polyfills/lib/merge.js +0 -35
- data/dist/es/@ember/polyfills/tests/assign_test.js +0 -64
- data/dist/es/@ember/runloop/index.js +0 -749
- data/dist/es/@ember/runloop/tests/debounce_test.js +0 -87
- data/dist/es/@ember/runloop/tests/later_test.js +0 -264
- data/dist/es/@ember/runloop/tests/next_test.js +0 -56
- data/dist/es/@ember/runloop/tests/once_test.js +0 -62
- data/dist/es/@ember/runloop/tests/onerror_test.js +0 -59
- data/dist/es/@ember/runloop/tests/run_bind_test.js +0 -59
- data/dist/es/@ember/runloop/tests/run_test.js +0 -28
- data/dist/es/@ember/runloop/tests/schedule_test.js +0 -86
- data/dist/es/@ember/runloop/tests/sync_test.js +0 -32
- data/dist/es/@ember/runloop/tests/unwind_test.js +0 -54
- data/dist/es/@ember/service/index.js +0 -57
- data/dist/es/@ember/string/index.js +0 -362
- data/dist/es/@ember/string/lib/string_registry.js +0 -13
- data/dist/es/@ember/string/tests/camelize_test.js +0 -53
- data/dist/es/@ember/string/tests/capitalize_test.js +0 -58
- data/dist/es/@ember/string/tests/classify_test.js +0 -79
- data/dist/es/@ember/string/tests/dasherize_test.js +0 -57
- data/dist/es/@ember/string/tests/decamelize_test.js +0 -51
- data/dist/es/@ember/string/tests/loc_test.js +0 -76
- data/dist/es/@ember/string/tests/underscore_test.js +0 -51
- data/dist/es/@ember/string/tests/w_test.js +0 -39
- data/dist/es/@glimmer/compiler.js +0 -1226
- data/dist/es/@glimmer/encoder.js +0 -39
- data/dist/es/@glimmer/low-level.js +0 -82
- data/dist/es/@glimmer/node.js +0 -112
- data/dist/es/@glimmer/opcode-compiler.js +0 -1999
- data/dist/es/@glimmer/program.js +0 -405
- data/dist/es/@glimmer/reference.js +0 -478
- data/dist/es/@glimmer/runtime.js +0 -4086
- data/dist/es/@glimmer/syntax.js +0 -1424
- data/dist/es/@glimmer/util.js +0 -189
- data/dist/es/@glimmer/vm.js +0 -27
- data/dist/es/@glimmer/wire-format.js +0 -56
- data/dist/es/backburner.js +0 -936
- data/dist/es/container/index.js +0 -8
- data/dist/es/container/lib/container.js +0 -437
- data/dist/es/container/lib/registry.js +0 -646
- data/dist/es/container/tests/container_test.js +0 -872
- data/dist/es/container/tests/owner_test.js +0 -20
- data/dist/es/container/tests/registry_test.js +0 -943
- data/dist/es/dag-map.js +0 -209
- data/dist/es/ember-browser-environment/index.js +0 -8
- data/dist/es/ember-browser-environment/lib/has-dom.js +0 -19
- data/dist/es/ember-console/index.js +0 -177
- data/dist/es/ember-environment/index.js +0 -3
- data/dist/es/ember-environment/lib/context.js +0 -20
- data/dist/es/ember-environment/lib/env.js +0 -185
- data/dist/es/ember-environment/lib/global.js +0 -14
- data/dist/es/ember-error-handling/index.js +0 -22
- data/dist/es/ember-extension-support/index.js +0 -2
- data/dist/es/ember-extension-support/lib/container_debug_adapter.js +0 -99
- data/dist/es/ember-extension-support/lib/data_adapter.js +0 -493
- data/dist/es/ember-extension-support/tests/container_debug_adapter_test.js +0 -73
- data/dist/es/ember-extension-support/tests/data_adapter_test.js +0 -301
- data/dist/es/ember-glimmer/index.js +0 -286
- data/dist/es/ember-glimmer/lib/compile-time-lookup.js +0 -37
- data/dist/es/ember-glimmer/lib/component-managers/abstract.js +0 -49
- data/dist/es/ember-glimmer/lib/component-managers/curly.js +0 -395
- data/dist/es/ember-glimmer/lib/component-managers/custom.js +0 -145
- data/dist/es/ember-glimmer/lib/component-managers/definition-state.js +0 -1
- data/dist/es/ember-glimmer/lib/component-managers/mount.js +0 -103
- data/dist/es/ember-glimmer/lib/component-managers/outlet.js +0 -114
- data/dist/es/ember-glimmer/lib/component-managers/render.js +0 -112
- data/dist/es/ember-glimmer/lib/component-managers/root.js +0 -74
- data/dist/es/ember-glimmer/lib/component-managers/template-only.js +0 -46
- data/dist/es/ember-glimmer/lib/component.js +0 -633
- data/dist/es/ember-glimmer/lib/components/checkbox.js +0 -57
- data/dist/es/ember-glimmer/lib/components/link-to.js +0 -777
- data/dist/es/ember-glimmer/lib/components/text_area.js +0 -236
- data/dist/es/ember-glimmer/lib/components/text_field.js +0 -145
- data/dist/es/ember-glimmer/lib/dom.js +0 -3
- data/dist/es/ember-glimmer/lib/environment.js +0 -102
- data/dist/es/ember-glimmer/lib/helper.js +0 -128
- data/dist/es/ember-glimmer/lib/helpers/-class.js +0 -23
- data/dist/es/ember-glimmer/lib/helpers/-html-safe.js +0 -9
- data/dist/es/ember-glimmer/lib/helpers/-input-type.js +0 -11
- data/dist/es/ember-glimmer/lib/helpers/-normalize-class.js +0 -22
- data/dist/es/ember-glimmer/lib/helpers/action.js +0 -360
- data/dist/es/ember-glimmer/lib/helpers/component.js +0 -135
- data/dist/es/ember-glimmer/lib/helpers/concat.js +0 -38
- data/dist/es/ember-glimmer/lib/helpers/each-in.js +0 -126
- data/dist/es/ember-glimmer/lib/helpers/get.js +0 -100
- data/dist/es/ember-glimmer/lib/helpers/hash.js +0 -44
- data/dist/es/ember-glimmer/lib/helpers/if-unless.js +0 -142
- data/dist/es/ember-glimmer/lib/helpers/loc.js +0 -40
- data/dist/es/ember-glimmer/lib/helpers/log.js +0 -25
- data/dist/es/ember-glimmer/lib/helpers/mut.js +0 -107
- data/dist/es/ember-glimmer/lib/helpers/query-param.js +0 -31
- data/dist/es/ember-glimmer/lib/helpers/readonly.js +0 -104
- data/dist/es/ember-glimmer/lib/helpers/unbound.js +0 -36
- data/dist/es/ember-glimmer/lib/modifiers/action.js +0 -185
- data/dist/es/ember-glimmer/lib/protocol-for-url.js +0 -48
- data/dist/es/ember-glimmer/lib/renderer.js +0 -371
- data/dist/es/ember-glimmer/lib/resolver.js +0 -290
- data/dist/es/ember-glimmer/lib/setup-registry.js +0 -77
- data/dist/es/ember-glimmer/lib/syntax.js +0 -73
- data/dist/es/ember-glimmer/lib/syntax/-text-area.js +0 -8
- data/dist/es/ember-glimmer/lib/syntax/input.js +0 -173
- data/dist/es/ember-glimmer/lib/syntax/let.js +0 -50
- data/dist/es/ember-glimmer/lib/syntax/mount.js +0 -101
- data/dist/es/ember-glimmer/lib/syntax/outlet.js +0 -120
- data/dist/es/ember-glimmer/lib/syntax/render.js +0 -140
- data/dist/es/ember-glimmer/lib/syntax/utils.js +0 -6
- data/dist/es/ember-glimmer/lib/template-compiler.js +0 -7
- data/dist/es/ember-glimmer/lib/template.js +0 -16
- data/dist/es/ember-glimmer/lib/template_registry.js +0 -18
- data/dist/es/ember-glimmer/lib/templates/component.js +0 -2
- data/dist/es/ember-glimmer/lib/templates/empty.js +0 -2
- data/dist/es/ember-glimmer/lib/templates/link-to.js +0 -2
- data/dist/es/ember-glimmer/lib/templates/outlet.js +0 -2
- data/dist/es/ember-glimmer/lib/templates/root.js +0 -2
- data/dist/es/ember-glimmer/lib/utils/bindings.js +0 -180
- data/dist/es/ember-glimmer/lib/utils/curly-component-state-bucket.js +0 -36
- data/dist/es/ember-glimmer/lib/utils/custom-component-manager.js +0 -20
- data/dist/es/ember-glimmer/lib/utils/debug-stack.js +0 -57
- data/dist/es/ember-glimmer/lib/utils/iterable.js +0 -358
- data/dist/es/ember-glimmer/lib/utils/outlet.js +0 -89
- data/dist/es/ember-glimmer/lib/utils/process-args.js +0 -40
- data/dist/es/ember-glimmer/lib/utils/references.js +0 -325
- data/dist/es/ember-glimmer/lib/utils/serialization-first-node-helpers.js +0 -1
- data/dist/es/ember-glimmer/lib/utils/string.js +0 -98
- data/dist/es/ember-glimmer/lib/utils/to-bool.js +0 -9
- data/dist/es/ember-glimmer/lib/views/outlet.js +0 -71
- data/dist/es/ember-glimmer/tests/integration/application/actions-test.js +0 -107
- data/dist/es/ember-glimmer/tests/integration/application/engine-test.js +0 -912
- data/dist/es/ember-glimmer/tests/integration/application/rendering-test.js +0 -530
- data/dist/es/ember-glimmer/tests/integration/components/angle-bracket-invocation-test.js +0 -852
- data/dist/es/ember-glimmer/tests/integration/components/append-test.js +0 -742
- data/dist/es/ember-glimmer/tests/integration/components/attribute-bindings-test.js +0 -999
- data/dist/es/ember-glimmer/tests/integration/components/attrs-lookup-test.js +0 -268
- data/dist/es/ember-glimmer/tests/integration/components/class-bindings-test.js +0 -849
- data/dist/es/ember-glimmer/tests/integration/components/contextual-components-test.js +0 -1493
- data/dist/es/ember-glimmer/tests/integration/components/curly-components-test.js +0 -3705
- data/dist/es/ember-glimmer/tests/integration/components/destroy-test.js +0 -33
- data/dist/es/ember-glimmer/tests/integration/components/dynamic-components-test.js +0 -896
- data/dist/es/ember-glimmer/tests/integration/components/error-handling-test.js +0 -164
- data/dist/es/ember-glimmer/tests/integration/components/fragment-components-test.js +0 -285
- data/dist/es/ember-glimmer/tests/integration/components/instrumentation-compile-test.js +0 -108
- data/dist/es/ember-glimmer/tests/integration/components/instrumentation-test.js +0 -157
- data/dist/es/ember-glimmer/tests/integration/components/life-cycle-test.js +0 -1653
- data/dist/es/ember-glimmer/tests/integration/components/link-to-test.js +0 -218
- data/dist/es/ember-glimmer/tests/integration/components/local-lookup-test.js +0 -414
- data/dist/es/ember-glimmer/tests/integration/components/namespaced-lookup-test.js +0 -185
- data/dist/es/ember-glimmer/tests/integration/components/render-to-element-test.js +0 -0
- data/dist/es/ember-glimmer/tests/integration/components/target-action-test.js +0 -779
- data/dist/es/ember-glimmer/tests/integration/components/template-only-components-test.js +0 -225
- data/dist/es/ember-glimmer/tests/integration/components/to-string-test.js +0 -27
- data/dist/es/ember-glimmer/tests/integration/components/utils-test.js +0 -401
- data/dist/es/ember-glimmer/tests/integration/components/web-component-fallback-test.js +0 -35
- data/dist/es/ember-glimmer/tests/integration/components/will-destroy-element-hook-test.js +0 -40
- data/dist/es/ember-glimmer/tests/integration/content-test.js +0 -1759
- data/dist/es/ember-glimmer/tests/integration/custom-component-manager-test.js +0 -508
- data/dist/es/ember-glimmer/tests/integration/event-dispatcher-test.js +0 -607
- data/dist/es/ember-glimmer/tests/integration/helpers/-class-test.js +0 -76
- data/dist/es/ember-glimmer/tests/integration/helpers/closure-action-test.js +0 -1240
- data/dist/es/ember-glimmer/tests/integration/helpers/concat-test.js +0 -106
- data/dist/es/ember-glimmer/tests/integration/helpers/custom-helper-test.js +0 -672
- data/dist/es/ember-glimmer/tests/integration/helpers/element-action-test.js +0 -1595
- data/dist/es/ember-glimmer/tests/integration/helpers/get-test.js +0 -618
- data/dist/es/ember-glimmer/tests/integration/helpers/hash-test.js +0 -188
- data/dist/es/ember-glimmer/tests/integration/helpers/if-unless-test.js +0 -149
- data/dist/es/ember-glimmer/tests/integration/helpers/input-test.js +0 -827
- data/dist/es/ember-glimmer/tests/integration/helpers/loc-test.js +0 -103
- data/dist/es/ember-glimmer/tests/integration/helpers/log-test.js +0 -61
- data/dist/es/ember-glimmer/tests/integration/helpers/mut-test.js +0 -580
- data/dist/es/ember-glimmer/tests/integration/helpers/partial-test.js +0 -386
- data/dist/es/ember-glimmer/tests/integration/helpers/readonly-test.js +0 -293
- data/dist/es/ember-glimmer/tests/integration/helpers/render-test.js +0 -522
- data/dist/es/ember-glimmer/tests/integration/helpers/text-area-test.js +0 -166
- data/dist/es/ember-glimmer/tests/integration/helpers/unbound-test.js +0 -650
- data/dist/es/ember-glimmer/tests/integration/helpers/yield-test.js +0 -275
- data/dist/es/ember-glimmer/tests/integration/input-test.js +0 -242
- data/dist/es/ember-glimmer/tests/integration/mount-test.js +0 -424
- data/dist/es/ember-glimmer/tests/integration/outlet-test.js +0 -318
- data/dist/es/ember-glimmer/tests/integration/refinements-test.js +0 -74
- data/dist/es/ember-glimmer/tests/integration/render-settled-test.js +0 -72
- data/dist/es/ember-glimmer/tests/integration/svg-test.js +0 -158
- data/dist/es/ember-glimmer/tests/integration/syntax/each-in-test.js +0 -697
- data/dist/es/ember-glimmer/tests/integration/syntax/each-test.js +0 -1251
- data/dist/es/ember-glimmer/tests/integration/syntax/experimental-syntax-test.js +0 -42
- data/dist/es/ember-glimmer/tests/integration/syntax/if-unless-test.js +0 -108
- data/dist/es/ember-glimmer/tests/integration/syntax/in-element-test.js +0 -119
- data/dist/es/ember-glimmer/tests/integration/syntax/let-test.js +0 -390
- data/dist/es/ember-glimmer/tests/integration/syntax/with-dynamic-var-test.js +0 -36
- data/dist/es/ember-glimmer/tests/integration/syntax/with-test.js +0 -422
- data/dist/es/ember-glimmer/tests/unit/outlet-test.js +0 -48
- data/dist/es/ember-glimmer/tests/unit/runtime-resolver-cache-test.js +0 -263
- data/dist/es/ember-glimmer/tests/unit/template-factory-test.js +0 -67
- data/dist/es/ember-glimmer/tests/unit/utils/debug-stack-test.js +0 -38
- data/dist/es/ember-glimmer/tests/utils/abstract-test-case.js +0 -1
- data/dist/es/ember-glimmer/tests/utils/helpers.js +0 -15
- data/dist/es/ember-glimmer/tests/utils/shared-conditional-tests.js +0 -965
- data/dist/es/ember-glimmer/tests/utils/string-test.js +0 -47
- data/dist/es/ember-glimmer/tests/utils/test-case.js +0 -6
- data/dist/es/ember-glimmer/tests/utils/test-helpers.js +0 -1
- data/dist/es/ember-meta/index.js +0 -1
- data/dist/es/ember-meta/lib/meta.js +0 -623
- data/dist/es/ember-meta/tests/meta_test.js +0 -169
- data/dist/es/ember-metal/index.js +0 -33
- data/dist/es/ember-metal/lib/alias.js +0 -80
- data/dist/es/ember-metal/lib/array.js +0 -55
- data/dist/es/ember-metal/lib/array_events.js +0 -65
- data/dist/es/ember-metal/lib/chains.js +0 -315
- data/dist/es/ember-metal/lib/change_event.js +0 -4
- data/dist/es/ember-metal/lib/computed.js +0 -526
- data/dist/es/ember-metal/lib/computed_cache.js +0 -58
- data/dist/es/ember-metal/lib/dependent_keys.js +0 -34
- data/dist/es/ember-metal/lib/deprecate_property.js +0 -34
- data/dist/es/ember-metal/lib/descriptor.js +0 -28
- data/dist/es/ember-metal/lib/each_proxy.js +0 -106
- data/dist/es/ember-metal/lib/each_proxy_events.js +0 -13
- data/dist/es/ember-metal/lib/events.js +0 -174
- data/dist/es/ember-metal/lib/expand_properties.js +0 -64
- data/dist/es/ember-metal/lib/get_properties.js +0 -45
- data/dist/es/ember-metal/lib/injected_property.js +0 -53
- data/dist/es/ember-metal/lib/is_blank.js +0 -34
- data/dist/es/ember-metal/lib/is_empty.js +0 -63
- data/dist/es/ember-metal/lib/is_none.js +0 -27
- data/dist/es/ember-metal/lib/is_present.js +0 -38
- data/dist/es/ember-metal/lib/libraries.js +0 -80
- data/dist/es/ember-metal/lib/mixin.js +0 -646
- data/dist/es/ember-metal/lib/namespace_search.js +0 -166
- data/dist/es/ember-metal/lib/observer.js +0 -34
- data/dist/es/ember-metal/lib/observer_set.js +0 -48
- data/dist/es/ember-metal/lib/path_cache.js +0 -5
- data/dist/es/ember-metal/lib/properties.js +0 -192
- data/dist/es/ember-metal/lib/property_events.js +0 -198
- data/dist/es/ember-metal/lib/property_get.js +0 -160
- data/dist/es/ember-metal/lib/property_set.js +0 -157
- data/dist/es/ember-metal/lib/set_properties.js +0 -43
- data/dist/es/ember-metal/lib/tags.js +0 -81
- data/dist/es/ember-metal/lib/tracked.js +0 -201
- data/dist/es/ember-metal/lib/transaction.js +0 -137
- data/dist/es/ember-metal/lib/watch_key.js +0 -113
- data/dist/es/ember-metal/lib/watch_path.js +0 -24
- data/dist/es/ember-metal/lib/watching.js +0 -54
- data/dist/es/ember-metal/tests/accessors/get_path_test.js +0 -82
- data/dist/es/ember-metal/tests/accessors/get_properties_test.js +0 -36
- data/dist/es/ember-metal/tests/accessors/get_test.js +0 -335
- data/dist/es/ember-metal/tests/accessors/mandatory_setters_test.js +0 -470
- data/dist/es/ember-metal/tests/accessors/set_path_test.js +0 -97
- data/dist/es/ember-metal/tests/accessors/set_test.js +0 -128
- data/dist/es/ember-metal/tests/alias_test.js +0 -167
- data/dist/es/ember-metal/tests/chains_test.js +0 -210
- data/dist/es/ember-metal/tests/computed_test.js +0 -1040
- data/dist/es/ember-metal/tests/descriptor_test.js +0 -368
- data/dist/es/ember-metal/tests/events_test.js +0 -210
- data/dist/es/ember-metal/tests/expand_properties_test.js +0 -119
- data/dist/es/ember-metal/tests/injected_property_test.js +0 -76
- data/dist/es/ember-metal/tests/is_blank_test.js +0 -29
- data/dist/es/ember-metal/tests/is_empty_test.js +0 -55
- data/dist/es/ember-metal/tests/is_none_test.js +0 -23
- data/dist/es/ember-metal/tests/is_present_test.js +0 -30
- data/dist/es/ember-metal/tests/libraries_test.js +0 -99
- data/dist/es/ember-metal/tests/main_test.js +0 -31
- data/dist/es/ember-metal/tests/mixin/alias_method_test.js +0 -91
- data/dist/es/ember-metal/tests/mixin/apply_test.js +0 -40
- data/dist/es/ember-metal/tests/mixin/computed_test.js +0 -166
- data/dist/es/ember-metal/tests/mixin/concatenated_properties_test.js +0 -117
- data/dist/es/ember-metal/tests/mixin/detect_test.js +0 -40
- data/dist/es/ember-metal/tests/mixin/introspection_test.js +0 -75
- data/dist/es/ember-metal/tests/mixin/merged_properties_test.js +0 -200
- data/dist/es/ember-metal/tests/mixin/method_test.js +0 -252
- data/dist/es/ember-metal/tests/mixin/observer_test.js +0 -202
- data/dist/es/ember-metal/tests/mixin/reopen_test.js +0 -53
- data/dist/es/ember-metal/tests/mixin/without_test.js +0 -22
- data/dist/es/ember-metal/tests/namespace_search_test.js +0 -16
- data/dist/es/ember-metal/tests/observer_test.js +0 -961
- data/dist/es/ember-metal/tests/performance_test.js +0 -81
- data/dist/es/ember-metal/tests/properties_test.js +0 -120
- data/dist/es/ember-metal/tests/property_did_change_hook.js +0 -73
- data/dist/es/ember-metal/tests/set_properties_test.js +0 -49
- data/dist/es/ember-metal/tests/tracked/computed_test.js +0 -67
- data/dist/es/ember-metal/tests/tracked/get_test.js +0 -86
- data/dist/es/ember-metal/tests/tracked/set_test.js +0 -44
- data/dist/es/ember-metal/tests/tracked/support.js +0 -37
- data/dist/es/ember-metal/tests/tracked/validation_test.js +0 -233
- data/dist/es/ember-metal/tests/watching/is_watching_test.js +0 -97
- data/dist/es/ember-metal/tests/watching/unwatch_test.js +0 -109
- data/dist/es/ember-metal/tests/watching/watch_test.js +0 -255
- data/dist/es/ember-owner/index.js +0 -66
- data/dist/es/ember-routing/index.js +0 -21
- data/dist/es/ember-routing/lib/ext/controller.js +0 -222
- data/dist/es/ember-routing/lib/location/api.js +0 -118
- data/dist/es/ember-routing/lib/location/auto_location.js +0 -323
- data/dist/es/ember-routing/lib/location/hash_location.js +0 -171
- data/dist/es/ember-routing/lib/location/history_location.js +0 -298
- data/dist/es/ember-routing/lib/location/none_location.js +0 -122
- data/dist/es/ember-routing/lib/location/util.js +0 -114
- data/dist/es/ember-routing/lib/services/router.js +0 -243
- data/dist/es/ember-routing/lib/services/routing.js +0 -101
- data/dist/es/ember-routing/lib/system/cache.js +0 -40
- data/dist/es/ember-routing/lib/system/controller_for.js +0 -14
- data/dist/es/ember-routing/lib/system/dsl.js +0 -208
- data/dist/es/ember-routing/lib/system/generate_controller.js +0 -54
- data/dist/es/ember-routing/lib/system/query_params.js +0 -6
- data/dist/es/ember-routing/lib/system/route.js +0 -2476
- data/dist/es/ember-routing/lib/system/router.js +0 -1607
- data/dist/es/ember-routing/lib/system/router_state.js +0 -26
- data/dist/es/ember-routing/lib/system/transition.js +0 -153
- data/dist/es/ember-routing/lib/utils.js +0 -230
- data/dist/es/ember-routing/tests/ext/controller_test.js +0 -85
- data/dist/es/ember-routing/tests/location/auto_location_test.js +0 -379
- data/dist/es/ember-routing/tests/location/hash_location_test.js +0 -207
- data/dist/es/ember-routing/tests/location/history_location_test.js +0 -322
- data/dist/es/ember-routing/tests/location/none_location_test.js +0 -88
- data/dist/es/ember-routing/tests/location/util_test.js +0 -159
- data/dist/es/ember-routing/tests/system/cache_test.js +0 -54
- data/dist/es/ember-routing/tests/system/controller_for_test.js +0 -75
- data/dist/es/ember-routing/tests/system/dsl_test.js +0 -413
- data/dist/es/ember-routing/tests/system/route_test.js +0 -587
- data/dist/es/ember-routing/tests/system/router_test.js +0 -287
- data/dist/es/ember-routing/tests/utils_test.js +0 -37
- data/dist/es/ember-runtime/.gitignore +0 -1
- data/dist/es/ember-runtime/README +0 -12
- data/dist/es/ember-runtime/index.js +0 -35
- data/dist/es/ember-runtime/lib/compare.js +0 -149
- data/dist/es/ember-runtime/lib/copy.js +0 -106
- data/dist/es/ember-runtime/lib/ext/function.js +0 -154
- data/dist/es/ember-runtime/lib/ext/rsvp.js +0 -59
- data/dist/es/ember-runtime/lib/is-equal.js +0 -60
- data/dist/es/ember-runtime/lib/mixins/-proxy.js +0 -109
- data/dist/es/ember-runtime/lib/mixins/action_handler.js +0 -222
- data/dist/es/ember-runtime/lib/mixins/array.js +0 -1661
- data/dist/es/ember-runtime/lib/mixins/comparable.js +0 -38
- data/dist/es/ember-runtime/lib/mixins/container_proxy.js +0 -154
- data/dist/es/ember-runtime/lib/mixins/copyable.js +0 -34
- data/dist/es/ember-runtime/lib/mixins/enumerable.js +0 -16
- data/dist/es/ember-runtime/lib/mixins/evented.js +0 -149
- data/dist/es/ember-runtime/lib/mixins/mutable_enumerable.js +0 -18
- data/dist/es/ember-runtime/lib/mixins/observable.js +0 -482
- data/dist/es/ember-runtime/lib/mixins/promise_proxy.js +0 -224
- data/dist/es/ember-runtime/lib/mixins/registry_proxy.js +0 -265
- data/dist/es/ember-runtime/lib/mixins/target_action_support.js +0 -172
- data/dist/es/ember-runtime/lib/system/array_proxy.js +0 -298
- data/dist/es/ember-runtime/lib/system/core_object.js +0 -1037
- data/dist/es/ember-runtime/lib/system/namespace.js +0 -69
- data/dist/es/ember-runtime/lib/system/object.js +0 -73
- data/dist/es/ember-runtime/lib/system/object_proxy.js +0 -81
- data/dist/es/ember-runtime/lib/type-of.js +0 -107
- data/dist/es/ember-runtime/tests/array/any-test.js +0 -55
- data/dist/es/ember-runtime/tests/array/compact-test.js +0 -12
- data/dist/es/ember-runtime/tests/array/every-test.js +0 -82
- data/dist/es/ember-runtime/tests/array/filter-test.js +0 -123
- data/dist/es/ember-runtime/tests/array/find-test.js +0 -86
- data/dist/es/ember-runtime/tests/array/firstObject-test.js +0 -27
- data/dist/es/ember-runtime/tests/array/forEach-test.js +0 -68
- data/dist/es/ember-runtime/tests/array/includes-test.js +0 -46
- data/dist/es/ember-runtime/tests/array/indexOf-test.js +0 -27
- data/dist/es/ember-runtime/tests/array/invoke-test.js +0 -60
- data/dist/es/ember-runtime/tests/array/isAny-test.js +0 -53
- data/dist/es/ember-runtime/tests/array/lastIndexOf-test.js +0 -78
- data/dist/es/ember-runtime/tests/array/lastObject-test.js +0 -31
- data/dist/es/ember-runtime/tests/array/map-test.js +0 -68
- data/dist/es/ember-runtime/tests/array/mapBy-test.js +0 -16
- data/dist/es/ember-runtime/tests/array/objectAt-test.js +0 -34
- data/dist/es/ember-runtime/tests/array/reduce-test.js +0 -24
- data/dist/es/ember-runtime/tests/array/reject-test.js +0 -134
- data/dist/es/ember-runtime/tests/array/sortBy-test.js +0 -23
- data/dist/es/ember-runtime/tests/array/toArray-test.js +0 -11
- data/dist/es/ember-runtime/tests/array/uniq-test.js +0 -27
- data/dist/es/ember-runtime/tests/array/uniqBy-test.js +0 -33
- data/dist/es/ember-runtime/tests/array/without-test.js +0 -39
- data/dist/es/ember-runtime/tests/copyable-array/copy-test.js +0 -12
- data/dist/es/ember-runtime/tests/core/compare_test.js +0 -89
- data/dist/es/ember-runtime/tests/core/copy_test.js +0 -47
- data/dist/es/ember-runtime/tests/core/isEqual_test.js +0 -65
- data/dist/es/ember-runtime/tests/core/is_array_test.js +0 -59
- data/dist/es/ember-runtime/tests/core/is_empty_test.js +0 -15
- data/dist/es/ember-runtime/tests/core/type_of_test.js +0 -54
- data/dist/es/ember-runtime/tests/ext/function_test.js +0 -121
- data/dist/es/ember-runtime/tests/ext/rsvp_test.js +0 -269
- data/dist/es/ember-runtime/tests/helpers/array.js +0 -336
- data/dist/es/ember-runtime/tests/inject_test.js +0 -51
- data/dist/es/ember-runtime/tests/legacy_1x/mixins/observable/chained_test.js +0 -63
- data/dist/es/ember-runtime/tests/legacy_1x/mixins/observable/observable_test.js +0 -892
- data/dist/es/ember-runtime/tests/legacy_1x/mixins/observable/propertyChanges_test.js +0 -142
- data/dist/es/ember-runtime/tests/legacy_1x/system/object/base_test.js +0 -98
- data/dist/es/ember-runtime/tests/legacy_1x/system/object/concatenated_test.js +0 -131
- data/dist/es/ember-runtime/tests/mixins/array_test.js +0 -400
- data/dist/es/ember-runtime/tests/mixins/comparable_test.js +0 -37
- data/dist/es/ember-runtime/tests/mixins/container_proxy_test.js +0 -48
- data/dist/es/ember-runtime/tests/mixins/enumerable_test.js +0 -17
- data/dist/es/ember-runtime/tests/mixins/evented_test.js +0 -23
- data/dist/es/ember-runtime/tests/mixins/mutable_enumerable_test.js +0 -17
- data/dist/es/ember-runtime/tests/mixins/observable_test.js +0 -137
- data/dist/es/ember-runtime/tests/mixins/promise_proxy_test.js +0 -593
- data/dist/es/ember-runtime/tests/mixins/target_action_support_test.js +0 -237
- data/dist/es/ember-runtime/tests/mutable-array/addObject-test.js +0 -76
- data/dist/es/ember-runtime/tests/mutable-array/clear-test.js +0 -64
- data/dist/es/ember-runtime/tests/mutable-array/insertAt-test.js +0 -216
- data/dist/es/ember-runtime/tests/mutable-array/popObject-test.js +0 -91
- data/dist/es/ember-runtime/tests/mutable-array/pushObject-test.js +0 -98
- data/dist/es/ember-runtime/tests/mutable-array/pushObjects-test.js +0 -12
- data/dist/es/ember-runtime/tests/mutable-array/removeAt-test.js +0 -187
- data/dist/es/ember-runtime/tests/mutable-array/removeObject-test.js +0 -77
- data/dist/es/ember-runtime/tests/mutable-array/removeObjects-test.js +0 -202
- data/dist/es/ember-runtime/tests/mutable-array/replace-test.js +0 -221
- data/dist/es/ember-runtime/tests/mutable-array/reverseObjects-test.js +0 -35
- data/dist/es/ember-runtime/tests/mutable-array/setObjects-test.js +0 -63
- data/dist/es/ember-runtime/tests/mutable-array/shiftObject-test.js +0 -105
- data/dist/es/ember-runtime/tests/mutable-array/unshiftObject-test.js +0 -99
- data/dist/es/ember-runtime/tests/mutable-array/unshiftObjects-test.js +0 -102
- data/dist/es/ember-runtime/tests/system/array_proxy/arranged_content_test.js +0 -275
- data/dist/es/ember-runtime/tests/system/array_proxy/array_observer_test.js +0 -51
- data/dist/es/ember-runtime/tests/system/array_proxy/content_change_test.js +0 -85
- data/dist/es/ember-runtime/tests/system/array_proxy/length_test.js +0 -201
- data/dist/es/ember-runtime/tests/system/array_proxy/watching_and_listening_test.js +0 -157
- data/dist/es/ember-runtime/tests/system/core_object_test.js +0 -114
- data/dist/es/ember-runtime/tests/system/namespace/base_test.js +0 -175
- data/dist/es/ember-runtime/tests/system/native_array/a_test.js +0 -16
- data/dist/es/ember-runtime/tests/system/native_array/copyable_suite_test.js +0 -19
- data/dist/es/ember-runtime/tests/system/native_array/replace_test.js +0 -17
- data/dist/es/ember-runtime/tests/system/object/computed_test.js +0 -352
- data/dist/es/ember-runtime/tests/system/object/create_test.js +0 -135
- data/dist/es/ember-runtime/tests/system/object/destroy_test.js +0 -146
- data/dist/es/ember-runtime/tests/system/object/detectInstance_test.js +0 -38
- data/dist/es/ember-runtime/tests/system/object/detect_test.js +0 -33
- data/dist/es/ember-runtime/tests/system/object/es-compatibility-test.js +0 -469
- data/dist/es/ember-runtime/tests/system/object/events_test.js +0 -156
- data/dist/es/ember-runtime/tests/system/object/extend_test.js +0 -153
- data/dist/es/ember-runtime/tests/system/object/observer_test.js +0 -216
- data/dist/es/ember-runtime/tests/system/object/reopenClass_test.js +0 -36
- data/dist/es/ember-runtime/tests/system/object/reopen_test.js +0 -48
- data/dist/es/ember-runtime/tests/system/object/strict-mode-test.js +0 -31
- data/dist/es/ember-runtime/tests/system/object/toString_test.js +0 -125
- data/dist/es/ember-runtime/tests/system/object_proxy_test.js +0 -314
- data/dist/es/ember-template-compiler/index.js +0 -26
- data/dist/es/ember-template-compiler/lib/compat.js +0 -16
- data/dist/es/ember-template-compiler/lib/plugins/assert-if-helper-without-arguments.js +0 -38
- data/dist/es/ember-template-compiler/lib/plugins/assert-input-helper-without-block.js +0 -20
- data/dist/es/ember-template-compiler/lib/plugins/assert-reserved-named-arguments.js +0 -26
- data/dist/es/ember-template-compiler/lib/plugins/assert-splattribute-expression.js +0 -27
- data/dist/es/ember-template-compiler/lib/plugins/deprecate-render-model.js +0 -38
- data/dist/es/ember-template-compiler/lib/plugins/deprecate-render.js +0 -41
- data/dist/es/ember-template-compiler/lib/plugins/deprecate-send-action.js +0 -42
- data/dist/es/ember-template-compiler/lib/plugins/index.js +0 -50
- data/dist/es/ember-template-compiler/lib/plugins/transform-action-syntax.js +0 -52
- data/dist/es/ember-template-compiler/lib/plugins/transform-angle-bracket-components.js +0 -10
- data/dist/es/ember-template-compiler/lib/plugins/transform-attrs-into-args.js +0 -62
- data/dist/es/ember-template-compiler/lib/plugins/transform-dot-component-invocation.js +0 -88
- data/dist/es/ember-template-compiler/lib/plugins/transform-each-in-into-each.js +0 -48
- data/dist/es/ember-template-compiler/lib/plugins/transform-has-block-syntax.js +0 -46
- data/dist/es/ember-template-compiler/lib/plugins/transform-in-element.js +0 -83
- data/dist/es/ember-template-compiler/lib/plugins/transform-inline-link-to.js +0 -31
- data/dist/es/ember-template-compiler/lib/plugins/transform-input-type-syntax.js +0 -52
- data/dist/es/ember-template-compiler/lib/plugins/transform-old-binding-syntax.js +0 -48
- data/dist/es/ember-template-compiler/lib/plugins/transform-old-class-binding-syntax.js +0 -102
- data/dist/es/ember-template-compiler/lib/plugins/transform-quoted-bindings-into-just-bindings.js +0 -34
- data/dist/es/ember-template-compiler/lib/plugins/transform-top-level-components.js +0 -41
- data/dist/es/ember-template-compiler/lib/system/bootstrap.js +0 -44
- data/dist/es/ember-template-compiler/lib/system/calculate-location-display.js +0 -20
- data/dist/es/ember-template-compiler/lib/system/compile-options.js +0 -71
- data/dist/es/ember-template-compiler/lib/system/compile.js +0 -28
- data/dist/es/ember-template-compiler/lib/system/dasherize-component-name.js +0 -13
- data/dist/es/ember-template-compiler/lib/system/initializer.js +0 -22
- data/dist/es/ember-template-compiler/lib/system/precompile.js +0 -18
- data/dist/es/ember-template-compiler/tests/plugins/assert-if-helper-without-arguments-test.js +0 -51
- data/dist/es/ember-template-compiler/tests/plugins/assert-input-helper-without-block-test.js +0 -17
- data/dist/es/ember-template-compiler/tests/plugins/assert-reserved-named-arguments-test.js +0 -416
- data/dist/es/ember-template-compiler/tests/plugins/assert-splattribute-expression-test.js +0 -57
- data/dist/es/ember-template-compiler/tests/plugins/deprecate-render-model-test.js +0 -19
- data/dist/es/ember-template-compiler/tests/plugins/deprecate-render-test.js +0 -19
- data/dist/es/ember-template-compiler/tests/plugins/deprecate-send-action-test.js +0 -29
- data/dist/es/ember-template-compiler/tests/plugins/transform-dot-component-invocation-test.js +0 -27
- data/dist/es/ember-template-compiler/tests/plugins/transform-inline-link-to-test.js +0 -15
- data/dist/es/ember-template-compiler/tests/plugins/transform-input-type-syntax-test.js +0 -25
- data/dist/es/ember-template-compiler/tests/system/bootstrap-test.js +0 -155
- data/dist/es/ember-template-compiler/tests/system/compile_options_test.js +0 -115
- data/dist/es/ember-template-compiler/tests/system/dasherize-component-name-test.js +0 -19
- data/dist/es/ember-testing/index.js +0 -10
- data/dist/es/ember-testing/lib/adapters/adapter.js +0 -58
- data/dist/es/ember-testing/lib/adapters/qunit.js +0 -47
- data/dist/es/ember-testing/lib/events.js +0 -136
- data/dist/es/ember-testing/lib/ext/application.js +0 -191
- data/dist/es/ember-testing/lib/ext/rsvp.js +0 -19
- data/dist/es/ember-testing/lib/helpers.js +0 -30
- data/dist/es/ember-testing/lib/helpers/-is-form-control.js +0 -16
- data/dist/es/ember-testing/lib/helpers/and_then.js +0 -3
- data/dist/es/ember-testing/lib/helpers/click.js +0 -36
- data/dist/es/ember-testing/lib/helpers/current_path.js +0 -27
- data/dist/es/ember-testing/lib/helpers/current_route_name.js +0 -25
- data/dist/es/ember-testing/lib/helpers/current_url.js +0 -27
- data/dist/es/ember-testing/lib/helpers/fill_in.js +0 -46
- data/dist/es/ember-testing/lib/helpers/find.js +0 -41
- data/dist/es/ember-testing/lib/helpers/find_with_assert.js +0 -34
- data/dist/es/ember-testing/lib/helpers/key_event.js +0 -36
- data/dist/es/ember-testing/lib/helpers/pause_test.js +0 -65
- data/dist/es/ember-testing/lib/helpers/trigger_event.js +0 -62
- data/dist/es/ember-testing/lib/helpers/visit.js +0 -42
- data/dist/es/ember-testing/lib/helpers/wait.js +0 -72
- data/dist/es/ember-testing/lib/initializers.js +0 -17
- data/dist/es/ember-testing/lib/setup_for_testing.js +0 -44
- data/dist/es/ember-testing/lib/support.js +0 -62
- data/dist/es/ember-testing/lib/test.js +0 -70
- data/dist/es/ember-testing/lib/test/adapter.js +0 -33
- data/dist/es/ember-testing/lib/test/helpers.js +0 -125
- data/dist/es/ember-testing/lib/test/on_inject_helpers.js +0 -38
- data/dist/es/ember-testing/lib/test/pending_requests.js +0 -24
- data/dist/es/ember-testing/lib/test/promise.js +0 -79
- data/dist/es/ember-testing/lib/test/run.js +0 -9
- data/dist/es/ember-testing/lib/test/waiters.js +0 -117
- data/dist/es/ember-testing/tests/acceptance_test.js +0 -478
- data/dist/es/ember-testing/tests/adapters/adapter_test.js +0 -31
- data/dist/es/ember-testing/tests/adapters/qunit_test.js +0 -50
- data/dist/es/ember-testing/tests/adapters_test.js +0 -405
- data/dist/es/ember-testing/tests/ext/rsvp_test.js +0 -124
- data/dist/es/ember-testing/tests/helper_registration_test.js +0 -98
- data/dist/es/ember-testing/tests/helpers_test.js +0 -1228
- data/dist/es/ember-testing/tests/integration_test.js +0 -106
- data/dist/es/ember-testing/tests/reexports_test.js +0 -26
- data/dist/es/ember-testing/tests/test/waiters-test.js +0 -145
- data/dist/es/ember-utils/index.js +0 -28
- data/dist/es/ember-utils/lib/cache.js +0 -36
- data/dist/es/ember-utils/lib/dictionary.js +0 -11
- data/dist/es/ember-utils/lib/guid.js +0 -120
- data/dist/es/ember-utils/lib/inspect.js +0 -112
- data/dist/es/ember-utils/lib/intern.js +0 -49
- data/dist/es/ember-utils/lib/invoke.js +0 -53
- data/dist/es/ember-utils/lib/is_proxy.js +0 -14
- data/dist/es/ember-utils/lib/lookup-descriptor.js +0 -11
- data/dist/es/ember-utils/lib/make-array.js +0 -7
- data/dist/es/ember-utils/lib/name.js +0 -9
- data/dist/es/ember-utils/lib/proxy-utils.js +0 -1
- data/dist/es/ember-utils/lib/spec.js +0 -14
- data/dist/es/ember-utils/lib/super.js +0 -83
- data/dist/es/ember-utils/lib/symbol-utils.js +0 -8
- data/dist/es/ember-utils/lib/symbol.js +0 -15
- data/dist/es/ember-utils/lib/to-string.js +0 -35
- data/dist/es/ember-utils/lib/weak_set.js +0 -18
- data/dist/es/ember-utils/tests/cache_test.js +0 -77
- data/dist/es/ember-utils/tests/can_invoke_test.js +0 -46
- data/dist/es/ember-utils/tests/checkHasSuper_test.js +0 -17
- data/dist/es/ember-utils/tests/generate_guid_test.js +0 -13
- data/dist/es/ember-utils/tests/guid_for_test.js +0 -101
- data/dist/es/ember-utils/tests/inspect_test.js +0 -146
- data/dist/es/ember-utils/tests/is_proxy_test.js +0 -18
- data/dist/es/ember-utils/tests/make_array_test.js +0 -41
- data/dist/es/ember-utils/tests/to-string-test.js +0 -32
- data/dist/es/ember-utils/tests/try_invoke_test.js +0 -48
- data/dist/es/ember-views/index.js +0 -28
- data/dist/es/ember-views/lib/compat/attrs.js +0 -3
- data/dist/es/ember-views/lib/compat/fallback-view-registry.js +0 -3
- data/dist/es/ember-views/lib/component_lookup.js +0 -27
- data/dist/es/ember-views/lib/mixins/action_support.js +0 -189
- data/dist/es/ember-views/lib/mixins/child_views_support.js +0 -27
- data/dist/es/ember-views/lib/mixins/class_names_support.js +0 -102
- data/dist/es/ember-views/lib/mixins/text_support.js +0 -333
- data/dist/es/ember-views/lib/mixins/view_state_support.js +0 -19
- data/dist/es/ember-views/lib/mixins/view_support.js +0 -452
- data/dist/es/ember-views/lib/system/action_manager.js +0 -14
- data/dist/es/ember-views/lib/system/event_dispatcher.js +0 -454
- data/dist/es/ember-views/lib/system/jquery.js +0 -29
- data/dist/es/ember-views/lib/system/jquery_event_deprecation.js +0 -61
- data/dist/es/ember-views/lib/system/lookup_partial.js +0 -55
- data/dist/es/ember-views/lib/system/utils.js +0 -201
- data/dist/es/ember-views/lib/utils/lookup-component.js +0 -58
- data/dist/es/ember-views/lib/views/core_view.js +0 -83
- data/dist/es/ember-views/lib/views/states.js +0 -48
- data/dist/es/ember-views/lib/views/states/default.js +0 -17
- data/dist/es/ember-views/lib/views/states/destroying.js +0 -16
- data/dist/es/ember-views/lib/views/states/has_element.js +0 -31
- data/dist/es/ember-views/lib/views/states/in_dom.js +0 -28
- data/dist/es/ember-views/lib/views/states/pre_render.js +0 -3
- data/dist/es/ember/index.js +0 -645
- data/dist/es/ember/tests/application_lifecycle_test.js +0 -188
- data/dist/es/ember/tests/component_context_test.js +0 -255
- data/dist/es/ember/tests/component_registration_test.js +0 -252
- data/dist/es/ember/tests/controller_test.js +0 -44
- data/dist/es/ember/tests/error_handler_test.js +0 -581
- data/dist/es/ember/tests/helpers/helper_registration_test.js +0 -103
- data/dist/es/ember/tests/helpers/link_to_test.js +0 -2103
- data/dist/es/ember/tests/helpers/link_to_test/link_to_transitioning_classes_test.js +0 -342
- data/dist/es/ember/tests/helpers/link_to_test/link_to_with_query_params_test.js +0 -694
- data/dist/es/ember/tests/homepage_example_test.js +0 -47
- data/dist/es/ember/tests/integration/multiple-app-test.js +0 -101
- data/dist/es/ember/tests/production_build_test.js +0 -34
- data/dist/es/ember/tests/reexports_test.js +0 -307
- data/dist/es/ember/tests/routing/decoupled_basic_test.js +0 -4506
- data/dist/es/ember/tests/routing/query_params_test.js +0 -1579
- data/dist/es/ember/tests/routing/query_params_test/model_dependent_state_with_query_params_test.js +0 -1117
- data/dist/es/ember/tests/routing/query_params_test/overlapping_query_params_test.js +0 -185
- data/dist/es/ember/tests/routing/query_params_test/query_param_async_get_handler_test.js +0 -327
- data/dist/es/ember/tests/routing/query_params_test/query_params_paramless_link_to_test.js +0 -37
- data/dist/es/ember/tests/routing/query_params_test/shared_state_test.js +0 -84
- data/dist/es/ember/tests/routing/router_map_test.js +0 -46
- data/dist/es/ember/tests/routing/router_service_test/basic_test.js +0 -95
- data/dist/es/ember/tests/routing/router_service_test/currenturl_lifecycle_test.js +0 -149
- data/dist/es/ember/tests/routing/router_service_test/isActive_test.js +0 -113
- data/dist/es/ember/tests/routing/router_service_test/replaceWith_test.js +0 -144
- data/dist/es/ember/tests/routing/router_service_test/transitionTo_test.js +0 -370
- data/dist/es/ember/tests/routing/router_service_test/urlFor_test.js +0 -307
- data/dist/es/ember/tests/routing/substates_test.js +0 -1110
- data/dist/es/ember/tests/routing/toplevel_dom_test.js +0 -37
- data/dist/es/ember/tests/service_injection_test.js +0 -278
- data/dist/es/ember/tests/view_instrumentation_test.js +0 -47
- data/dist/es/ember/version.js +0 -1
- data/dist/es/handlebars.js +0 -1268
- data/dist/es/internal-test-helpers/index.js +0 -31
- data/dist/es/internal-test-helpers/lib/.gitkeep +0 -0
- data/dist/es/internal-test-helpers/lib/apply-mixins.js +0 -37
- data/dist/es/internal-test-helpers/lib/browser-detect.js +0 -4
- data/dist/es/internal-test-helpers/lib/build-owner.js +0 -49
- data/dist/es/internal-test-helpers/lib/confirm-export.js +0 -45
- data/dist/es/internal-test-helpers/lib/ember-dev/assertion.js +0 -87
- data/dist/es/internal-test-helpers/lib/ember-dev/containers.js +0 -34
- data/dist/es/internal-test-helpers/lib/ember-dev/debug.js +0 -47
- data/dist/es/internal-test-helpers/lib/ember-dev/deprecation.js +0 -71
- data/dist/es/internal-test-helpers/lib/ember-dev/index.js +0 -19
- data/dist/es/internal-test-helpers/lib/ember-dev/method-call-tracker.js +0 -127
- data/dist/es/internal-test-helpers/lib/ember-dev/namespaces.js +0 -34
- data/dist/es/internal-test-helpers/lib/ember-dev/run-loop.js +0 -28
- data/dist/es/internal-test-helpers/lib/ember-dev/setup-qunit.js +0 -26
- data/dist/es/internal-test-helpers/lib/ember-dev/utils.js +0 -33
- data/dist/es/internal-test-helpers/lib/ember-dev/warning.js +0 -71
- data/dist/es/internal-test-helpers/lib/equal-inner-html.js +0 -37
- data/dist/es/internal-test-helpers/lib/equal-tokens.js +0 -53
- data/dist/es/internal-test-helpers/lib/factory.js +0 -65
- data/dist/es/internal-test-helpers/lib/get-all-property-names.js +0 -12
- data/dist/es/internal-test-helpers/lib/get-text-of.js +0 -3
- data/dist/es/internal-test-helpers/lib/matchers.js +0 -167
- data/dist/es/internal-test-helpers/lib/module-for.js +0 -89
- data/dist/es/internal-test-helpers/lib/registry-check.js +0 -28
- data/dist/es/internal-test-helpers/lib/run.js +0 -11
- data/dist/es/internal-test-helpers/lib/strip.js +0 -12
- data/dist/es/internal-test-helpers/lib/system/synthetic-events.js +0 -183
- data/dist/es/internal-test-helpers/lib/test-cases/abstract-application.js +0 -70
- data/dist/es/internal-test-helpers/lib/test-cases/abstract-rendering.js +0 -203
- data/dist/es/internal-test-helpers/lib/test-cases/abstract.js +0 -222
- data/dist/es/internal-test-helpers/lib/test-cases/application.js +0 -39
- data/dist/es/internal-test-helpers/lib/test-cases/autoboot-application.js +0 -34
- data/dist/es/internal-test-helpers/lib/test-cases/default-resolver-application.js +0 -43
- data/dist/es/internal-test-helpers/lib/test-cases/node-query.js +0 -120
- data/dist/es/internal-test-helpers/lib/test-cases/query-param.js +0 -124
- data/dist/es/internal-test-helpers/lib/test-cases/rendering.js +0 -14
- data/dist/es/internal-test-helpers/lib/test-cases/router.js +0 -26
- data/dist/es/internal-test-helpers/lib/test-cases/test-resolver-application.js +0 -40
- data/dist/es/internal-test-helpers/lib/test-resolver.js +0 -86
- data/dist/es/internal-test-helpers/tests/index-test.js +0 -10
- data/dist/es/route-recognizer.js +0 -685
- data/dist/es/router.js +0 -2454
- data/dist/es/rsvp.js +0 -2394
- data/dist/es/simple-html-tokenizer.js +0 -638
- data/dist/jquery/jquery.js +0 -10364
- data/dist/node/app-boot-test.js +0 -146
- data/dist/node/build-info-test.js +0 -177
- data/dist/node/component-rendering-test.js +0 -34
- data/dist/node/helpers/app-module.js +0 -198
- data/dist/node/helpers/assert-html-matches.js +0 -25
- data/dist/node/helpers/build-owner.js +0 -28
- data/dist/node/helpers/component-module.js +0 -137
- data/dist/node/sourcemap-test.js +0 -27
- data/dist/node/template-compiler-test.js +0 -45
- data/dist/node/visit-test.js +0 -349
- data/dist/qunit/qunit.css +0 -436
- data/dist/qunit/qunit.js +0 -5188
- data/dist/tests/index.html +0 -254
- data/ember-source.gemspec +0 -28
- data/node_modules/.yarn-integrity +0 -10
- data/yarn.lock +0 -4
@@ -1,54 +0,0 @@
|
|
1
|
-
import { get } from 'ember-metal';
|
2
|
-
import { info } from '@ember/debug';
|
3
|
-
import { DEBUG } from '@glimmer/env';
|
4
|
-
/**
|
5
|
-
@module ember
|
6
|
-
*/
|
7
|
-
|
8
|
-
/**
|
9
|
-
Generates a controller factory
|
10
|
-
|
11
|
-
@for Ember
|
12
|
-
@method generateControllerFactory
|
13
|
-
@private
|
14
|
-
*/
|
15
|
-
|
16
|
-
export function generateControllerFactory(owner, controllerName) {
|
17
|
-
let Factory = owner.factoryFor('controller:basic').class;
|
18
|
-
|
19
|
-
Factory = Factory.extend({
|
20
|
-
toString() {
|
21
|
-
return `(generated ${controllerName} controller)`;
|
22
|
-
},
|
23
|
-
});
|
24
|
-
|
25
|
-
let fullName = `controller:${controllerName}`;
|
26
|
-
|
27
|
-
owner.register(fullName, Factory);
|
28
|
-
|
29
|
-
return Factory;
|
30
|
-
}
|
31
|
-
|
32
|
-
/**
|
33
|
-
Generates and instantiates a controller extending from `controller:basic`
|
34
|
-
if present, or `Controller` if not.
|
35
|
-
|
36
|
-
@for Ember
|
37
|
-
@method generateController
|
38
|
-
@private
|
39
|
-
@since 1.3.0
|
40
|
-
*/
|
41
|
-
export default function generateController(owner, controllerName) {
|
42
|
-
generateControllerFactory(owner, controllerName);
|
43
|
-
|
44
|
-
let fullName = `controller:${controllerName}`;
|
45
|
-
let instance = owner.lookup(fullName);
|
46
|
-
|
47
|
-
if (DEBUG) {
|
48
|
-
if (get(instance, 'namespace.LOG_ACTIVE_GENERATION')) {
|
49
|
-
info(`generated -> ${fullName}`, { fullName });
|
50
|
-
}
|
51
|
-
}
|
52
|
-
|
53
|
-
return instance;
|
54
|
-
}
|
@@ -1,2476 +0,0 @@
|
|
1
|
-
import { ROUTER_ROUTER } from '@ember/deprecated-features';
|
2
|
-
import { getOwner } from 'ember-owner';
|
3
|
-
import { assign } from '@ember/polyfills';
|
4
|
-
import { once } from '@ember/runloop';
|
5
|
-
import { get, set, getProperties, setProperties, computed, isEmpty } from 'ember-metal';
|
6
|
-
import { assert, deprecate, info, isTesting } from '@ember/debug';
|
7
|
-
import { DEBUG } from '@glimmer/env';
|
8
|
-
import { classify } from '@ember/string';
|
9
|
-
import { typeOf, Object as EmberObject, A as emberA, Evented, ActionHandler } from 'ember-runtime';
|
10
|
-
import generateController from './generate_controller';
|
11
|
-
import {
|
12
|
-
stashParamNames,
|
13
|
-
normalizeControllerQueryParams,
|
14
|
-
calculateCacheKey,
|
15
|
-
prefixRouteNameArg,
|
16
|
-
} from '../utils';
|
17
|
-
|
18
|
-
function K() {
|
19
|
-
return this;
|
20
|
-
}
|
21
|
-
|
22
|
-
export function defaultSerialize(model, params) {
|
23
|
-
if (params.length < 1 || !model) {
|
24
|
-
return;
|
25
|
-
}
|
26
|
-
|
27
|
-
let object = {};
|
28
|
-
if (params.length === 1) {
|
29
|
-
let [name] = params;
|
30
|
-
if (name in model) {
|
31
|
-
object[name] = get(model, name);
|
32
|
-
} else if (/_id$/.test(name)) {
|
33
|
-
object[name] = get(model, 'id');
|
34
|
-
}
|
35
|
-
} else {
|
36
|
-
object = getProperties(model, params);
|
37
|
-
}
|
38
|
-
|
39
|
-
return object;
|
40
|
-
}
|
41
|
-
|
42
|
-
export function hasDefaultSerialize(route) {
|
43
|
-
return route.serialize === defaultSerialize;
|
44
|
-
}
|
45
|
-
|
46
|
-
/**
|
47
|
-
@module @ember/routing
|
48
|
-
*/
|
49
|
-
|
50
|
-
/**
|
51
|
-
The `Route` class is used to define individual routes. Refer to
|
52
|
-
the [routing guide](https://guides.emberjs.com/release/routing/) for documentation.
|
53
|
-
|
54
|
-
@class Route
|
55
|
-
@extends EmberObject
|
56
|
-
@uses ActionHandler
|
57
|
-
@uses Evented
|
58
|
-
@since 1.0.0
|
59
|
-
@public
|
60
|
-
*/
|
61
|
-
let Route = EmberObject.extend(ActionHandler, Evented, {
|
62
|
-
/**
|
63
|
-
Configuration hash for this route's queryParams. The possible
|
64
|
-
configuration options and their defaults are as follows
|
65
|
-
(assuming a query param whose controller property is `page`):
|
66
|
-
|
67
|
-
```javascript
|
68
|
-
queryParams: {
|
69
|
-
page: {
|
70
|
-
// By default, controller query param properties don't
|
71
|
-
// cause a full transition when they are changed, but
|
72
|
-
// rather only cause the URL to update. Setting
|
73
|
-
// `refreshModel` to true will cause an "in-place"
|
74
|
-
// transition to occur, whereby the model hooks for
|
75
|
-
// this route (and any child routes) will re-fire, allowing
|
76
|
-
// you to reload models (e.g., from the server) using the
|
77
|
-
// updated query param values.
|
78
|
-
refreshModel: false,
|
79
|
-
|
80
|
-
// By default, changes to controller query param properties
|
81
|
-
// cause the URL to update via `pushState`, which means an
|
82
|
-
// item will be added to the browser's history, allowing
|
83
|
-
// you to use the back button to restore the app to the
|
84
|
-
// previous state before the query param property was changed.
|
85
|
-
// Setting `replace` to true will use `replaceState` (or its
|
86
|
-
// hash location equivalent), which causes no browser history
|
87
|
-
// item to be added. This options name and default value are
|
88
|
-
// the same as the `link-to` helper's `replace` option.
|
89
|
-
replace: false,
|
90
|
-
|
91
|
-
// By default, the query param URL key is the same name as
|
92
|
-
// the controller property name. Use `as` to specify a
|
93
|
-
// different URL key.
|
94
|
-
as: 'page'
|
95
|
-
}
|
96
|
-
}
|
97
|
-
```
|
98
|
-
|
99
|
-
@property queryParams
|
100
|
-
@for Route
|
101
|
-
@type Object
|
102
|
-
@since 1.6.0
|
103
|
-
@public
|
104
|
-
*/
|
105
|
-
queryParams: {},
|
106
|
-
|
107
|
-
router: ROUTER_ROUTER
|
108
|
-
? computed('_router', function() {
|
109
|
-
deprecate(
|
110
|
-
'Route#router is an intimate API that has been renamed to Route#_router. However you might want to consider using the router service',
|
111
|
-
false,
|
112
|
-
{
|
113
|
-
id: 'ember-routing.route-router',
|
114
|
-
until: '3.5.0',
|
115
|
-
url: 'https://emberjs.com/deprecations/v3.x#toc_ember-routing-route-router',
|
116
|
-
}
|
117
|
-
);
|
118
|
-
return this._router;
|
119
|
-
})
|
120
|
-
: undefined,
|
121
|
-
|
122
|
-
/**
|
123
|
-
The name of the route, dot-delimited.
|
124
|
-
|
125
|
-
For example, a route found at `app/routes/posts/post.js` will have
|
126
|
-
a `routeName` of `posts.post`.
|
127
|
-
|
128
|
-
@property routeName
|
129
|
-
@for Route
|
130
|
-
@type String
|
131
|
-
@since 1.0.0
|
132
|
-
@public
|
133
|
-
*/
|
134
|
-
|
135
|
-
/**
|
136
|
-
The name of the route, dot-delimited, including the engine prefix
|
137
|
-
if applicable.
|
138
|
-
|
139
|
-
For example, a route found at `addon/routes/posts/post.js` within an
|
140
|
-
engine named `admin` will have a `fullRouteName` of `admin.posts.post`.
|
141
|
-
|
142
|
-
@property fullRouteName
|
143
|
-
@for Route
|
144
|
-
@type String
|
145
|
-
@since 2.10.0
|
146
|
-
@public
|
147
|
-
*/
|
148
|
-
|
149
|
-
/**
|
150
|
-
Sets the name for this route, including a fully resolved name for routes
|
151
|
-
inside engines.
|
152
|
-
|
153
|
-
@private
|
154
|
-
@method _setRouteName
|
155
|
-
@param {String} name
|
156
|
-
*/
|
157
|
-
_setRouteName(name) {
|
158
|
-
this.routeName = name;
|
159
|
-
this.fullRouteName = getEngineRouteName(getOwner(this), name);
|
160
|
-
},
|
161
|
-
|
162
|
-
/**
|
163
|
-
@private
|
164
|
-
|
165
|
-
@property _qp
|
166
|
-
*/
|
167
|
-
_qp: computed(function() {
|
168
|
-
let combinedQueryParameterConfiguration;
|
169
|
-
|
170
|
-
let controllerName = this.controllerName || this.routeName;
|
171
|
-
let owner = getOwner(this);
|
172
|
-
let controller = owner.lookup(`controller:${controllerName}`);
|
173
|
-
let queryParameterConfiguraton = get(this, 'queryParams');
|
174
|
-
let hasRouterDefinedQueryParams = Object.keys(queryParameterConfiguraton).length > 0;
|
175
|
-
|
176
|
-
if (controller) {
|
177
|
-
// the developer has authored a controller class in their application for
|
178
|
-
// this route find its query params and normalize their object shape them
|
179
|
-
// merge in the query params for the route. As a mergedProperty,
|
180
|
-
// Route#queryParams is always at least `{}`
|
181
|
-
|
182
|
-
let controllerDefinedQueryParameterConfiguration = get(controller, 'queryParams') || {};
|
183
|
-
let normalizedControllerQueryParameterConfiguration = normalizeControllerQueryParams(
|
184
|
-
controllerDefinedQueryParameterConfiguration
|
185
|
-
);
|
186
|
-
combinedQueryParameterConfiguration = mergeEachQueryParams(
|
187
|
-
normalizedControllerQueryParameterConfiguration,
|
188
|
-
queryParameterConfiguraton
|
189
|
-
);
|
190
|
-
} else if (hasRouterDefinedQueryParams) {
|
191
|
-
// the developer has not defined a controller but *has* supplied route query params.
|
192
|
-
// Generate a class for them so we can later insert default values
|
193
|
-
controller = generateController(owner, controllerName);
|
194
|
-
combinedQueryParameterConfiguration = queryParameterConfiguraton;
|
195
|
-
}
|
196
|
-
|
197
|
-
let qps = [];
|
198
|
-
let map = {};
|
199
|
-
let propertyNames = [];
|
200
|
-
|
201
|
-
for (let propName in combinedQueryParameterConfiguration) {
|
202
|
-
if (!combinedQueryParameterConfiguration.hasOwnProperty(propName)) {
|
203
|
-
continue;
|
204
|
-
}
|
205
|
-
|
206
|
-
// to support the dubious feature of using unknownProperty
|
207
|
-
// on queryParams configuration
|
208
|
-
if (propName === 'unknownProperty' || propName === '_super') {
|
209
|
-
// possible todo: issue deprecation warning?
|
210
|
-
continue;
|
211
|
-
}
|
212
|
-
|
213
|
-
let desc = combinedQueryParameterConfiguration[propName];
|
214
|
-
let scope = desc.scope || 'model';
|
215
|
-
let parts;
|
216
|
-
|
217
|
-
if (scope === 'controller') {
|
218
|
-
parts = [];
|
219
|
-
}
|
220
|
-
|
221
|
-
let urlKey = desc.as || this.serializeQueryParamKey(propName);
|
222
|
-
let defaultValue = get(controller, propName);
|
223
|
-
|
224
|
-
if (Array.isArray(defaultValue)) {
|
225
|
-
defaultValue = emberA(defaultValue.slice());
|
226
|
-
}
|
227
|
-
|
228
|
-
let type = desc.type || typeOf(defaultValue);
|
229
|
-
|
230
|
-
let defaultValueSerialized = this.serializeQueryParam(defaultValue, urlKey, type);
|
231
|
-
let scopedPropertyName = `${controllerName}:${propName}`;
|
232
|
-
let qp = {
|
233
|
-
undecoratedDefaultValue: get(controller, propName),
|
234
|
-
defaultValue,
|
235
|
-
serializedDefaultValue: defaultValueSerialized,
|
236
|
-
serializedValue: defaultValueSerialized,
|
237
|
-
|
238
|
-
type,
|
239
|
-
urlKey,
|
240
|
-
prop: propName,
|
241
|
-
scopedPropertyName,
|
242
|
-
controllerName,
|
243
|
-
route: this,
|
244
|
-
parts, // provided later when stashNames is called if 'model' scope
|
245
|
-
values: null, // provided later when setup is called. no idea why.
|
246
|
-
scope,
|
247
|
-
};
|
248
|
-
|
249
|
-
map[propName] = map[urlKey] = map[scopedPropertyName] = qp;
|
250
|
-
qps.push(qp);
|
251
|
-
propertyNames.push(propName);
|
252
|
-
}
|
253
|
-
|
254
|
-
return {
|
255
|
-
qps,
|
256
|
-
map,
|
257
|
-
propertyNames,
|
258
|
-
states: {
|
259
|
-
/*
|
260
|
-
Called when a query parameter changes in the URL, this route cares
|
261
|
-
about that query parameter, but the route is not currently
|
262
|
-
in the active route hierarchy.
|
263
|
-
*/
|
264
|
-
inactive: (prop, value) => {
|
265
|
-
let qp = map[prop];
|
266
|
-
this._qpChanged(prop, value, qp);
|
267
|
-
},
|
268
|
-
/*
|
269
|
-
Called when a query parameter changes in the URL, this route cares
|
270
|
-
about that query parameter, and the route is currently
|
271
|
-
in the active route hierarchy.
|
272
|
-
*/
|
273
|
-
active: (prop, value) => {
|
274
|
-
let qp = map[prop];
|
275
|
-
this._qpChanged(prop, value, qp);
|
276
|
-
return this._activeQPChanged(qp, value);
|
277
|
-
},
|
278
|
-
/*
|
279
|
-
Called when a value of a query parameter this route handles changes in a controller
|
280
|
-
and the route is currently in the active route hierarchy.
|
281
|
-
*/
|
282
|
-
allowOverrides: (prop, value) => {
|
283
|
-
let qp = map[prop];
|
284
|
-
this._qpChanged(prop, value, qp);
|
285
|
-
return this._updatingQPChanged(qp);
|
286
|
-
},
|
287
|
-
},
|
288
|
-
};
|
289
|
-
}),
|
290
|
-
|
291
|
-
/**
|
292
|
-
@private
|
293
|
-
|
294
|
-
@property _names
|
295
|
-
*/
|
296
|
-
_names: null,
|
297
|
-
|
298
|
-
/**
|
299
|
-
@private
|
300
|
-
|
301
|
-
@method _stashNames
|
302
|
-
*/
|
303
|
-
_stashNames(handlerInfo, dynamicParent) {
|
304
|
-
if (this._names) {
|
305
|
-
return;
|
306
|
-
}
|
307
|
-
let names = (this._names = handlerInfo._names);
|
308
|
-
|
309
|
-
if (!names.length) {
|
310
|
-
handlerInfo = dynamicParent;
|
311
|
-
names = (handlerInfo && handlerInfo._names) || [];
|
312
|
-
}
|
313
|
-
|
314
|
-
let qps = get(this, '_qp.qps');
|
315
|
-
|
316
|
-
let namePaths = new Array(names.length);
|
317
|
-
for (let a = 0; a < names.length; ++a) {
|
318
|
-
namePaths[a] = `${handlerInfo.name}.${names[a]}`;
|
319
|
-
}
|
320
|
-
|
321
|
-
for (let i = 0; i < qps.length; ++i) {
|
322
|
-
let qp = qps[i];
|
323
|
-
if (qp.scope === 'model') {
|
324
|
-
qp.parts = namePaths;
|
325
|
-
}
|
326
|
-
}
|
327
|
-
},
|
328
|
-
|
329
|
-
/**
|
330
|
-
@private
|
331
|
-
|
332
|
-
@property _activeQPChanged
|
333
|
-
*/
|
334
|
-
_activeQPChanged(qp, value) {
|
335
|
-
this._router._activeQPChanged(qp.scopedPropertyName, value);
|
336
|
-
},
|
337
|
-
|
338
|
-
/**
|
339
|
-
@private
|
340
|
-
@method _updatingQPChanged
|
341
|
-
*/
|
342
|
-
_updatingQPChanged(qp) {
|
343
|
-
this._router._updatingQPChanged(qp.urlKey);
|
344
|
-
},
|
345
|
-
|
346
|
-
mergedProperties: ['queryParams'],
|
347
|
-
|
348
|
-
/**
|
349
|
-
Returns a hash containing the parameters of an ancestor route.
|
350
|
-
|
351
|
-
Example
|
352
|
-
|
353
|
-
```app/router.js
|
354
|
-
// ...
|
355
|
-
|
356
|
-
Router.map(function() {
|
357
|
-
this.route('member', { path: ':name' }, function() {
|
358
|
-
this.route('interest', { path: ':interest' });
|
359
|
-
});
|
360
|
-
});
|
361
|
-
```
|
362
|
-
|
363
|
-
```app/routes/member.js
|
364
|
-
import Route from '@ember/routing/route';
|
365
|
-
|
366
|
-
export default Route.extend({
|
367
|
-
queryParams: {
|
368
|
-
memberQp: { refreshModel: true }
|
369
|
-
}
|
370
|
-
});
|
371
|
-
```
|
372
|
-
|
373
|
-
```app/routes/member/interest.js
|
374
|
-
import Route from '@ember/routing/route';
|
375
|
-
|
376
|
-
export default Route.extend({
|
377
|
-
queryParams: {
|
378
|
-
interestQp: { refreshModel: true }
|
379
|
-
},
|
380
|
-
|
381
|
-
model() {
|
382
|
-
return this.paramsFor('member');
|
383
|
-
}
|
384
|
-
});
|
385
|
-
```
|
386
|
-
|
387
|
-
If we visit `/turing/maths?memberQp=member&interestQp=interest` the model for
|
388
|
-
the `member.interest` route is a hash with:
|
389
|
-
|
390
|
-
* `name`: `turing`
|
391
|
-
* `memberQp`: `member`
|
392
|
-
|
393
|
-
@method paramsFor
|
394
|
-
@param {String} name
|
395
|
-
@return {Object} hash containing the parameters of the route `name`
|
396
|
-
@since 1.4.0
|
397
|
-
@public
|
398
|
-
*/
|
399
|
-
paramsFor(name) {
|
400
|
-
let route = getOwner(this).lookup(`route:${name}`);
|
401
|
-
|
402
|
-
if (!route) {
|
403
|
-
return {};
|
404
|
-
}
|
405
|
-
|
406
|
-
let transition = this._router._routerMicrolib.activeTransition;
|
407
|
-
let state = transition ? transition.state : this._router._routerMicrolib.state;
|
408
|
-
|
409
|
-
let fullName = route.fullRouteName;
|
410
|
-
let params = assign({}, state.params[fullName]);
|
411
|
-
let queryParams = getQueryParamsFor(route, state);
|
412
|
-
|
413
|
-
return Object.keys(queryParams).reduce((params, key) => {
|
414
|
-
assert(
|
415
|
-
`The route '${
|
416
|
-
this.routeName
|
417
|
-
}' has both a dynamic segment and query param with name '${key}'. Please rename one to avoid collisions.`,
|
418
|
-
!params[key]
|
419
|
-
);
|
420
|
-
params[key] = queryParams[key];
|
421
|
-
return params;
|
422
|
-
}, params);
|
423
|
-
},
|
424
|
-
|
425
|
-
/**
|
426
|
-
Serializes the query parameter key
|
427
|
-
|
428
|
-
@method serializeQueryParamKey
|
429
|
-
@param {String} controllerPropertyName
|
430
|
-
@private
|
431
|
-
*/
|
432
|
-
serializeQueryParamKey(controllerPropertyName) {
|
433
|
-
return controllerPropertyName;
|
434
|
-
},
|
435
|
-
|
436
|
-
/**
|
437
|
-
Serializes value of the query parameter based on defaultValueType
|
438
|
-
|
439
|
-
@method serializeQueryParam
|
440
|
-
@param {Object} value
|
441
|
-
@param {String} urlKey
|
442
|
-
@param {String} defaultValueType
|
443
|
-
@private
|
444
|
-
*/
|
445
|
-
serializeQueryParam(value, urlKey, defaultValueType) {
|
446
|
-
// urlKey isn't used here, but anyone overriding
|
447
|
-
// can use it to provide serialization specific
|
448
|
-
// to a certain query param.
|
449
|
-
return this._router._serializeQueryParam(value, defaultValueType);
|
450
|
-
},
|
451
|
-
|
452
|
-
/**
|
453
|
-
Deserializes value of the query parameter based on defaultValueType
|
454
|
-
|
455
|
-
@method deserializeQueryParam
|
456
|
-
@param {Object} value
|
457
|
-
@param {String} urlKey
|
458
|
-
@param {String} defaultValueType
|
459
|
-
@private
|
460
|
-
*/
|
461
|
-
deserializeQueryParam(value, urlKey, defaultValueType) {
|
462
|
-
// urlKey isn't used here, but anyone overriding
|
463
|
-
// can use it to provide deserialization specific
|
464
|
-
// to a certain query param.
|
465
|
-
return this._router._deserializeQueryParam(value, defaultValueType);
|
466
|
-
},
|
467
|
-
|
468
|
-
/**
|
469
|
-
@private
|
470
|
-
|
471
|
-
@property _optionsForQueryParam
|
472
|
-
*/
|
473
|
-
_optionsForQueryParam(qp) {
|
474
|
-
return get(this, `queryParams.${qp.urlKey}`) || get(this, `queryParams.${qp.prop}`) || {};
|
475
|
-
},
|
476
|
-
|
477
|
-
/**
|
478
|
-
A hook you can use to reset controller values either when the model
|
479
|
-
changes or the route is exiting.
|
480
|
-
|
481
|
-
```app/routes/articles.js
|
482
|
-
import Route from '@ember/routing/route';
|
483
|
-
|
484
|
-
export default Route.extend({
|
485
|
-
resetController(controller, isExiting, transition) {
|
486
|
-
if (isExiting && transition.targetName !== 'error') {
|
487
|
-
controller.set('page', 1);
|
488
|
-
}
|
489
|
-
}
|
490
|
-
});
|
491
|
-
```
|
492
|
-
|
493
|
-
@method resetController
|
494
|
-
@param {Controller} controller instance
|
495
|
-
@param {Boolean} isExiting
|
496
|
-
@param {Object} transition
|
497
|
-
@since 1.7.0
|
498
|
-
@public
|
499
|
-
*/
|
500
|
-
resetController: K,
|
501
|
-
|
502
|
-
/**
|
503
|
-
@private
|
504
|
-
|
505
|
-
@method exit
|
506
|
-
*/
|
507
|
-
exit() {
|
508
|
-
this.deactivate();
|
509
|
-
this.trigger('deactivate');
|
510
|
-
this.teardownViews();
|
511
|
-
},
|
512
|
-
|
513
|
-
/**
|
514
|
-
@private
|
515
|
-
|
516
|
-
@method _reset
|
517
|
-
@since 1.7.0
|
518
|
-
*/
|
519
|
-
_reset(isExiting, transition) {
|
520
|
-
let controller = this.controller;
|
521
|
-
controller._qpDelegate = get(this, '_qp.states.inactive');
|
522
|
-
|
523
|
-
this.resetController(controller, isExiting, transition);
|
524
|
-
},
|
525
|
-
|
526
|
-
/**
|
527
|
-
@private
|
528
|
-
|
529
|
-
@method enter
|
530
|
-
*/
|
531
|
-
enter() {
|
532
|
-
this.connections = [];
|
533
|
-
this.activate();
|
534
|
-
this.trigger('activate');
|
535
|
-
},
|
536
|
-
|
537
|
-
/**
|
538
|
-
The name of the template to use by default when rendering this routes
|
539
|
-
template.
|
540
|
-
|
541
|
-
```app/routes/posts/list.js
|
542
|
-
import Route from '@ember/routing/route';
|
543
|
-
|
544
|
-
export default Route.extend({
|
545
|
-
templateName: 'posts/list'
|
546
|
-
});
|
547
|
-
```
|
548
|
-
|
549
|
-
```app/routes/posts/index.js
|
550
|
-
import PostsList from '../posts/list';
|
551
|
-
|
552
|
-
export default PostsList.extend();
|
553
|
-
```
|
554
|
-
|
555
|
-
```app/routes/posts/archived.js
|
556
|
-
import PostsList from '../posts/list';
|
557
|
-
|
558
|
-
export default PostsList.extend();
|
559
|
-
```
|
560
|
-
|
561
|
-
@property templateName
|
562
|
-
@type String
|
563
|
-
@default null
|
564
|
-
@since 1.4.0
|
565
|
-
@public
|
566
|
-
*/
|
567
|
-
templateName: null,
|
568
|
-
|
569
|
-
/**
|
570
|
-
The name of the controller to associate with this route.
|
571
|
-
|
572
|
-
By default, Ember will lookup a route's controller that matches the name
|
573
|
-
of the route (i.e. `posts.new`). However,
|
574
|
-
if you would like to define a specific controller to use, you can do so
|
575
|
-
using this property.
|
576
|
-
|
577
|
-
This is useful in many ways, as the controller specified will be:
|
578
|
-
|
579
|
-
* passed to the `setupController` method.
|
580
|
-
* used as the controller for the template being rendered by the route.
|
581
|
-
* returned from a call to `controllerFor` for the route.
|
582
|
-
|
583
|
-
@property controllerName
|
584
|
-
@type String
|
585
|
-
@default null
|
586
|
-
@since 1.4.0
|
587
|
-
@public
|
588
|
-
*/
|
589
|
-
controllerName: null,
|
590
|
-
|
591
|
-
/**
|
592
|
-
The `willTransition` action is fired at the beginning of any
|
593
|
-
attempted transition with a `Transition` object as the sole
|
594
|
-
argument. This action can be used for aborting, redirecting,
|
595
|
-
or decorating the transition from the currently active routes.
|
596
|
-
|
597
|
-
A good example is preventing navigation when a form is
|
598
|
-
half-filled out:
|
599
|
-
|
600
|
-
```app/routes/contact-form.js
|
601
|
-
import Route from '@ember/routing/route';
|
602
|
-
|
603
|
-
export default Route.extend({
|
604
|
-
actions: {
|
605
|
-
willTransition(transition) {
|
606
|
-
if (this.controller.get('userHasEnteredData')) {
|
607
|
-
this.controller.displayNavigationConfirm();
|
608
|
-
transition.abort();
|
609
|
-
}
|
610
|
-
}
|
611
|
-
}
|
612
|
-
});
|
613
|
-
```
|
614
|
-
|
615
|
-
You can also redirect elsewhere by calling
|
616
|
-
`this.transitionTo('elsewhere')` from within `willTransition`.
|
617
|
-
Note that `willTransition` will not be fired for the
|
618
|
-
redirecting `transitionTo`, since `willTransition` doesn't
|
619
|
-
fire when there is already a transition underway. If you want
|
620
|
-
subsequent `willTransition` actions to fire for the redirecting
|
621
|
-
transition, you must first explicitly call
|
622
|
-
`transition.abort()`.
|
623
|
-
|
624
|
-
To allow the `willTransition` event to continue bubbling to the parent
|
625
|
-
route, use `return true;`. When the `willTransition` method has a
|
626
|
-
return value of `true` then the parent route's `willTransition` method
|
627
|
-
will be fired, enabling "bubbling" behavior for the event.
|
628
|
-
|
629
|
-
@event willTransition
|
630
|
-
@param {Transition} transition
|
631
|
-
@since 1.0.0
|
632
|
-
@public
|
633
|
-
*/
|
634
|
-
|
635
|
-
/**
|
636
|
-
The `didTransition` action is fired after a transition has
|
637
|
-
successfully been completed. This occurs after the normal model
|
638
|
-
hooks (`beforeModel`, `model`, `afterModel`, `setupController`)
|
639
|
-
have resolved. The `didTransition` action has no arguments,
|
640
|
-
however, it can be useful for tracking page views or resetting
|
641
|
-
state on the controller.
|
642
|
-
|
643
|
-
```app/routes/login.js
|
644
|
-
import Route from '@ember/routing/route';
|
645
|
-
|
646
|
-
export default Route.extend({
|
647
|
-
actions: {
|
648
|
-
didTransition() {
|
649
|
-
this.controller.get('errors.base').clear();
|
650
|
-
return true; // Bubble the didTransition event
|
651
|
-
}
|
652
|
-
}
|
653
|
-
});
|
654
|
-
```
|
655
|
-
|
656
|
-
@event didTransition
|
657
|
-
@since 1.2.0
|
658
|
-
@public
|
659
|
-
*/
|
660
|
-
|
661
|
-
/**
|
662
|
-
The `loading` action is fired on the route when a route's `model`
|
663
|
-
hook returns a promise that is not already resolved. The current
|
664
|
-
`Transition` object is the first parameter and the route that
|
665
|
-
triggered the loading event is the second parameter.
|
666
|
-
|
667
|
-
```app/routes/application.js
|
668
|
-
import Route from '@ember/routing/route';
|
669
|
-
|
670
|
-
export default Route.extend({
|
671
|
-
actions: {
|
672
|
-
loading(transition, route) {
|
673
|
-
let controller = this.controllerFor('foo');
|
674
|
-
controller.set('currentlyLoading', true);
|
675
|
-
|
676
|
-
transition.finally(function() {
|
677
|
-
controller.set('currentlyLoading', false);
|
678
|
-
});
|
679
|
-
}
|
680
|
-
}
|
681
|
-
});
|
682
|
-
```
|
683
|
-
|
684
|
-
@event loading
|
685
|
-
@param {Transition} transition
|
686
|
-
@param {Route} route The route that triggered the loading event
|
687
|
-
@since 1.2.0
|
688
|
-
@public
|
689
|
-
*/
|
690
|
-
|
691
|
-
/**
|
692
|
-
When attempting to transition into a route, any of the hooks
|
693
|
-
may return a promise that rejects, at which point an `error`
|
694
|
-
action will be fired on the partially-entered routes, allowing
|
695
|
-
for per-route error handling logic, or shared error handling
|
696
|
-
logic defined on a parent route.
|
697
|
-
|
698
|
-
Here is an example of an error handler that will be invoked
|
699
|
-
for rejected promises from the various hooks on the route,
|
700
|
-
as well as any unhandled errors from child routes:
|
701
|
-
|
702
|
-
```app/routes/admin.js
|
703
|
-
import { reject } from 'rsvp';
|
704
|
-
import Route from '@ember/routing/route';
|
705
|
-
|
706
|
-
export default Route.extend({
|
707
|
-
beforeModel() {
|
708
|
-
return reject('bad things!');
|
709
|
-
},
|
710
|
-
|
711
|
-
actions: {
|
712
|
-
error(error, transition) {
|
713
|
-
// Assuming we got here due to the error in `beforeModel`,
|
714
|
-
// we can expect that error === "bad things!",
|
715
|
-
// but a promise model rejecting would also
|
716
|
-
// call this hook, as would any errors encountered
|
717
|
-
// in `afterModel`.
|
718
|
-
|
719
|
-
// The `error` hook is also provided the failed
|
720
|
-
// `transition`, which can be stored and later
|
721
|
-
// `.retry()`d if desired.
|
722
|
-
|
723
|
-
this.transitionTo('login');
|
724
|
-
}
|
725
|
-
}
|
726
|
-
});
|
727
|
-
```
|
728
|
-
|
729
|
-
`error` actions that bubble up all the way to `ApplicationRoute`
|
730
|
-
will fire a default error handler that logs the error. You can
|
731
|
-
specify your own global default error handler by overriding the
|
732
|
-
`error` handler on `ApplicationRoute`:
|
733
|
-
|
734
|
-
```app/routes/application.js
|
735
|
-
import Route from '@ember/routing/route';
|
736
|
-
|
737
|
-
export default Route.extend({
|
738
|
-
actions: {
|
739
|
-
error(error, transition) {
|
740
|
-
this.controllerFor('banner').displayError(error.message);
|
741
|
-
}
|
742
|
-
}
|
743
|
-
});
|
744
|
-
```
|
745
|
-
@event error
|
746
|
-
@param {Error} error
|
747
|
-
@param {Transition} transition
|
748
|
-
@since 1.0.0
|
749
|
-
@public
|
750
|
-
*/
|
751
|
-
|
752
|
-
/**
|
753
|
-
This event is triggered when the router enters the route. It is
|
754
|
-
not executed when the model for the route changes.
|
755
|
-
|
756
|
-
```app/routes/application.js
|
757
|
-
import { on } from '@ember/object/evented';
|
758
|
-
import Route from '@ember/routing/route';
|
759
|
-
|
760
|
-
export default Route.extend({
|
761
|
-
collectAnalytics: on('activate', function(){
|
762
|
-
collectAnalytics();
|
763
|
-
})
|
764
|
-
});
|
765
|
-
```
|
766
|
-
|
767
|
-
@event activate
|
768
|
-
@since 1.9.0
|
769
|
-
@public
|
770
|
-
*/
|
771
|
-
|
772
|
-
/**
|
773
|
-
This event is triggered when the router completely exits this
|
774
|
-
route. It is not executed when the model for the route changes.
|
775
|
-
|
776
|
-
```app/routes/index.js
|
777
|
-
import { on } from '@ember/object/evented';
|
778
|
-
import Route from '@ember/routing/route';
|
779
|
-
|
780
|
-
export default Route.extend({
|
781
|
-
trackPageLeaveAnalytics: on('deactivate', function(){
|
782
|
-
trackPageLeaveAnalytics();
|
783
|
-
})
|
784
|
-
});
|
785
|
-
```
|
786
|
-
|
787
|
-
@event deactivate
|
788
|
-
@since 1.9.0
|
789
|
-
@public
|
790
|
-
*/
|
791
|
-
|
792
|
-
/**
|
793
|
-
The controller associated with this route.
|
794
|
-
|
795
|
-
Example
|
796
|
-
|
797
|
-
```app/routes/form.js
|
798
|
-
import Route from '@ember/routing/route';
|
799
|
-
|
800
|
-
export default Route.extend({
|
801
|
-
actions: {
|
802
|
-
willTransition(transition) {
|
803
|
-
if (this.controller.get('userHasEnteredData') &&
|
804
|
-
!confirm('Are you sure you want to abandon progress?')) {
|
805
|
-
transition.abort();
|
806
|
-
} else {
|
807
|
-
// Bubble the `willTransition` action so that
|
808
|
-
// parent routes can decide whether or not to abort.
|
809
|
-
return true;
|
810
|
-
}
|
811
|
-
}
|
812
|
-
}
|
813
|
-
});
|
814
|
-
```
|
815
|
-
|
816
|
-
@property controller
|
817
|
-
@type Controller
|
818
|
-
@since 1.6.0
|
819
|
-
@public
|
820
|
-
*/
|
821
|
-
|
822
|
-
actions: {
|
823
|
-
/**
|
824
|
-
This action is called when one or more query params have changed. Bubbles.
|
825
|
-
|
826
|
-
@method queryParamsDidChange
|
827
|
-
@param changed {Object} Keys are names of query params that have changed.
|
828
|
-
@param totalPresent {Object} Keys are names of query params that are currently set.
|
829
|
-
@param removed {Object} Keys are names of query params that have been removed.
|
830
|
-
@returns {boolean}
|
831
|
-
@private
|
832
|
-
*/
|
833
|
-
queryParamsDidChange(changed, totalPresent, removed) {
|
834
|
-
let qpMap = get(this, '_qp').map;
|
835
|
-
|
836
|
-
let totalChanged = Object.keys(changed).concat(Object.keys(removed));
|
837
|
-
for (let i = 0; i < totalChanged.length; ++i) {
|
838
|
-
let qp = qpMap[totalChanged[i]];
|
839
|
-
if (
|
840
|
-
qp &&
|
841
|
-
get(this._optionsForQueryParam(qp), 'refreshModel') &&
|
842
|
-
this._router.currentState
|
843
|
-
) {
|
844
|
-
this.refresh();
|
845
|
-
break;
|
846
|
-
}
|
847
|
-
}
|
848
|
-
|
849
|
-
return true;
|
850
|
-
},
|
851
|
-
|
852
|
-
finalizeQueryParamChange(params, finalParams, transition) {
|
853
|
-
if (this.fullRouteName !== 'application') {
|
854
|
-
return true;
|
855
|
-
}
|
856
|
-
|
857
|
-
// Transition object is absent for intermediate transitions.
|
858
|
-
if (!transition) {
|
859
|
-
return;
|
860
|
-
}
|
861
|
-
|
862
|
-
let handlerInfos = transition.state.handlerInfos;
|
863
|
-
let router = this._router;
|
864
|
-
let qpMeta = router._queryParamsFor(handlerInfos);
|
865
|
-
let changes = router._qpUpdates;
|
866
|
-
let replaceUrl;
|
867
|
-
|
868
|
-
stashParamNames(router, handlerInfos);
|
869
|
-
|
870
|
-
for (let i = 0; i < qpMeta.qps.length; ++i) {
|
871
|
-
let qp = qpMeta.qps[i];
|
872
|
-
let route = qp.route;
|
873
|
-
let controller = route.controller;
|
874
|
-
let presentKey = qp.urlKey in params && qp.urlKey;
|
875
|
-
|
876
|
-
// Do a reverse lookup to see if the changed query
|
877
|
-
// param URL key corresponds to a QP property on
|
878
|
-
// this controller.
|
879
|
-
let value, svalue;
|
880
|
-
if (changes && qp.urlKey in changes) {
|
881
|
-
// Value updated in/before setupController
|
882
|
-
value = get(controller, qp.prop);
|
883
|
-
svalue = route.serializeQueryParam(value, qp.urlKey, qp.type);
|
884
|
-
} else {
|
885
|
-
if (presentKey) {
|
886
|
-
svalue = params[presentKey];
|
887
|
-
|
888
|
-
if (svalue !== undefined) {
|
889
|
-
value = route.deserializeQueryParam(svalue, qp.urlKey, qp.type);
|
890
|
-
}
|
891
|
-
} else {
|
892
|
-
// No QP provided; use default value.
|
893
|
-
svalue = qp.serializedDefaultValue;
|
894
|
-
value = copyDefaultValue(qp.defaultValue);
|
895
|
-
}
|
896
|
-
}
|
897
|
-
|
898
|
-
controller._qpDelegate = get(route, '_qp.states.inactive');
|
899
|
-
|
900
|
-
let thisQueryParamChanged = svalue !== qp.serializedValue;
|
901
|
-
if (thisQueryParamChanged) {
|
902
|
-
if (transition.queryParamsOnly && replaceUrl !== false) {
|
903
|
-
let options = route._optionsForQueryParam(qp);
|
904
|
-
let replaceConfigValue = get(options, 'replace');
|
905
|
-
if (replaceConfigValue) {
|
906
|
-
replaceUrl = true;
|
907
|
-
} else if (replaceConfigValue === false) {
|
908
|
-
// Explicit pushState wins over any other replaceStates.
|
909
|
-
replaceUrl = false;
|
910
|
-
}
|
911
|
-
}
|
912
|
-
|
913
|
-
set(controller, qp.prop, value);
|
914
|
-
}
|
915
|
-
|
916
|
-
// Stash current serialized value of controller.
|
917
|
-
qp.serializedValue = svalue;
|
918
|
-
|
919
|
-
let thisQueryParamHasDefaultValue = qp.serializedDefaultValue === svalue;
|
920
|
-
if (!thisQueryParamHasDefaultValue || transition._keepDefaultQueryParamValues) {
|
921
|
-
finalParams.push({
|
922
|
-
value: svalue,
|
923
|
-
visible: true,
|
924
|
-
key: presentKey || qp.urlKey,
|
925
|
-
});
|
926
|
-
}
|
927
|
-
}
|
928
|
-
|
929
|
-
if (replaceUrl) {
|
930
|
-
transition.method('replace');
|
931
|
-
}
|
932
|
-
|
933
|
-
qpMeta.qps.forEach(qp => {
|
934
|
-
let routeQpMeta = get(qp.route, '_qp');
|
935
|
-
let finalizedController = qp.route.controller;
|
936
|
-
finalizedController._qpDelegate = get(routeQpMeta, 'states.active');
|
937
|
-
});
|
938
|
-
|
939
|
-
router._qpUpdates = null;
|
940
|
-
},
|
941
|
-
},
|
942
|
-
|
943
|
-
/**
|
944
|
-
This hook is executed when the router completely exits this route. It is
|
945
|
-
not executed when the model for the route changes.
|
946
|
-
|
947
|
-
@method deactivate
|
948
|
-
@since 1.0.0
|
949
|
-
@public
|
950
|
-
*/
|
951
|
-
deactivate: K,
|
952
|
-
|
953
|
-
/**
|
954
|
-
This hook is executed when the router enters the route. It is not executed
|
955
|
-
when the model for the route changes.
|
956
|
-
|
957
|
-
@method activate
|
958
|
-
@since 1.0.0
|
959
|
-
@public
|
960
|
-
*/
|
961
|
-
activate: K,
|
962
|
-
|
963
|
-
/**
|
964
|
-
Transition the application into another route. The route may
|
965
|
-
be either a single route or route path:
|
966
|
-
|
967
|
-
```javascript
|
968
|
-
this.transitionTo('blogPosts');
|
969
|
-
this.transitionTo('blogPosts.recentEntries');
|
970
|
-
```
|
971
|
-
|
972
|
-
Optionally supply a model for the route in question. The model
|
973
|
-
will be serialized into the URL using the `serialize` hook of
|
974
|
-
the route:
|
975
|
-
|
976
|
-
```javascript
|
977
|
-
this.transitionTo('blogPost', aPost);
|
978
|
-
```
|
979
|
-
|
980
|
-
If a literal is passed (such as a number or a string), it will
|
981
|
-
be treated as an identifier instead. In this case, the `model`
|
982
|
-
hook of the route will be triggered:
|
983
|
-
|
984
|
-
```javascript
|
985
|
-
this.transitionTo('blogPost', 1);
|
986
|
-
```
|
987
|
-
|
988
|
-
Multiple models will be applied last to first recursively up the
|
989
|
-
route tree.
|
990
|
-
|
991
|
-
```app/routes.js
|
992
|
-
// ...
|
993
|
-
|
994
|
-
Router.map(function() {
|
995
|
-
this.route('blogPost', { path:':blogPostId' }, function() {
|
996
|
-
this.route('blogComment', { path: ':blogCommentId' });
|
997
|
-
});
|
998
|
-
});
|
999
|
-
|
1000
|
-
export default Router;
|
1001
|
-
```
|
1002
|
-
|
1003
|
-
```javascript
|
1004
|
-
this.transitionTo('blogComment', aPost, aComment);
|
1005
|
-
this.transitionTo('blogComment', 1, 13);
|
1006
|
-
```
|
1007
|
-
|
1008
|
-
It is also possible to pass a URL (a string that starts with a
|
1009
|
-
`/`). This is intended for testing and debugging purposes and
|
1010
|
-
should rarely be used in production code.
|
1011
|
-
|
1012
|
-
```javascript
|
1013
|
-
this.transitionTo('/');
|
1014
|
-
this.transitionTo('/blog/post/1/comment/13');
|
1015
|
-
this.transitionTo('/blog/posts?sort=title');
|
1016
|
-
```
|
1017
|
-
|
1018
|
-
An options hash with a `queryParams` property may be provided as
|
1019
|
-
the final argument to add query parameters to the destination URL.
|
1020
|
-
|
1021
|
-
```javascript
|
1022
|
-
this.transitionTo('blogPost', 1, {
|
1023
|
-
queryParams: { showComments: 'true' }
|
1024
|
-
});
|
1025
|
-
|
1026
|
-
// if you just want to transition the query parameters without changing the route
|
1027
|
-
this.transitionTo({ queryParams: { sort: 'date' } });
|
1028
|
-
```
|
1029
|
-
|
1030
|
-
See also [replaceWith](#method_replaceWith).
|
1031
|
-
|
1032
|
-
Simple Transition Example
|
1033
|
-
|
1034
|
-
```app/routes.js
|
1035
|
-
// ...
|
1036
|
-
|
1037
|
-
Router.map(function() {
|
1038
|
-
this.route('index');
|
1039
|
-
this.route('secret');
|
1040
|
-
this.route('fourOhFour', { path: '*:' });
|
1041
|
-
});
|
1042
|
-
|
1043
|
-
export default Router;
|
1044
|
-
```
|
1045
|
-
|
1046
|
-
```app/routes/index.js
|
1047
|
-
import Route from '@ember/routing/route';
|
1048
|
-
|
1049
|
-
export Route.extend({
|
1050
|
-
actions: {
|
1051
|
-
moveToSecret(context) {
|
1052
|
-
if (authorized()) {
|
1053
|
-
this.transitionTo('secret', context);
|
1054
|
-
} else {
|
1055
|
-
this.transitionTo('fourOhFour');
|
1056
|
-
}
|
1057
|
-
}
|
1058
|
-
}
|
1059
|
-
});
|
1060
|
-
```
|
1061
|
-
|
1062
|
-
Transition to a nested route
|
1063
|
-
|
1064
|
-
```app/router.js
|
1065
|
-
// ...
|
1066
|
-
|
1067
|
-
Router.map(function() {
|
1068
|
-
this.route('articles', { path: '/articles' }, function() {
|
1069
|
-
this.route('new');
|
1070
|
-
});
|
1071
|
-
});
|
1072
|
-
|
1073
|
-
export default Router;
|
1074
|
-
```
|
1075
|
-
|
1076
|
-
```app/routes/index.js
|
1077
|
-
import Route from '@ember/routing/route';
|
1078
|
-
|
1079
|
-
export default Route.extend({
|
1080
|
-
actions: {
|
1081
|
-
transitionToNewArticle() {
|
1082
|
-
this.transitionTo('articles.new');
|
1083
|
-
}
|
1084
|
-
}
|
1085
|
-
});
|
1086
|
-
```
|
1087
|
-
|
1088
|
-
Multiple Models Example
|
1089
|
-
|
1090
|
-
```app/router.js
|
1091
|
-
// ...
|
1092
|
-
|
1093
|
-
Router.map(function() {
|
1094
|
-
this.route('index');
|
1095
|
-
|
1096
|
-
this.route('breakfast', { path: ':breakfastId' }, function() {
|
1097
|
-
this.route('cereal', { path: ':cerealId' });
|
1098
|
-
});
|
1099
|
-
});
|
1100
|
-
|
1101
|
-
export default Router;
|
1102
|
-
```
|
1103
|
-
|
1104
|
-
```app/routes/index.js
|
1105
|
-
import Route from '@ember/routing/route';
|
1106
|
-
|
1107
|
-
export default Route.extend({
|
1108
|
-
actions: {
|
1109
|
-
moveToChocolateCereal() {
|
1110
|
-
let cereal = { cerealId: 'ChocolateYumminess' };
|
1111
|
-
let breakfast = { breakfastId: 'CerealAndMilk' };
|
1112
|
-
|
1113
|
-
this.transitionTo('breakfast.cereal', breakfast, cereal);
|
1114
|
-
}
|
1115
|
-
}
|
1116
|
-
});
|
1117
|
-
```
|
1118
|
-
|
1119
|
-
Nested Route with Query String Example
|
1120
|
-
|
1121
|
-
```app/routes.js
|
1122
|
-
// ...
|
1123
|
-
|
1124
|
-
Router.map(function() {
|
1125
|
-
this.route('fruits', function() {
|
1126
|
-
this.route('apples');
|
1127
|
-
});
|
1128
|
-
});
|
1129
|
-
|
1130
|
-
export default Router;
|
1131
|
-
```
|
1132
|
-
|
1133
|
-
```app/routes/index.js
|
1134
|
-
import Route from '@ember/routing/route';
|
1135
|
-
|
1136
|
-
export default Route.extend({
|
1137
|
-
actions: {
|
1138
|
-
transitionToApples() {
|
1139
|
-
this.transitionTo('fruits.apples', { queryParams: { color: 'red' } });
|
1140
|
-
}
|
1141
|
-
}
|
1142
|
-
});
|
1143
|
-
```
|
1144
|
-
|
1145
|
-
@method transitionTo
|
1146
|
-
@param {String} name the name of the route or a URL
|
1147
|
-
@param {...Object} models the model(s) or identifier(s) to be used while
|
1148
|
-
transitioning to the route.
|
1149
|
-
@param {Object} [options] optional hash with a queryParams property
|
1150
|
-
containing a mapping of query parameters
|
1151
|
-
@return {Transition} the transition object associated with this
|
1152
|
-
attempted transition
|
1153
|
-
@since 1.0.0
|
1154
|
-
@public
|
1155
|
-
*/
|
1156
|
-
transitionTo(/* name, context */) {
|
1157
|
-
// eslint-disable-line no-unused-vars
|
1158
|
-
return this._router.transitionTo(...prefixRouteNameArg(this, arguments));
|
1159
|
-
},
|
1160
|
-
|
1161
|
-
/**
|
1162
|
-
Perform a synchronous transition into another route without attempting
|
1163
|
-
to resolve promises, update the URL, or abort any currently active
|
1164
|
-
asynchronous transitions (i.e. regular transitions caused by
|
1165
|
-
`transitionTo` or URL changes).
|
1166
|
-
|
1167
|
-
This method is handy for performing intermediate transitions on the
|
1168
|
-
way to a final destination route, and is called internally by the
|
1169
|
-
default implementations of the `error` and `loading` handlers.
|
1170
|
-
|
1171
|
-
@method intermediateTransitionTo
|
1172
|
-
@param {String} name the name of the route
|
1173
|
-
@param {...Object} models the model(s) to be used while transitioning
|
1174
|
-
to the route.
|
1175
|
-
@since 1.2.0
|
1176
|
-
@public
|
1177
|
-
*/
|
1178
|
-
intermediateTransitionTo() {
|
1179
|
-
this._router.intermediateTransitionTo(...prefixRouteNameArg(this, arguments));
|
1180
|
-
},
|
1181
|
-
|
1182
|
-
/**
|
1183
|
-
Refresh the model on this route and any child routes, firing the
|
1184
|
-
`beforeModel`, `model`, and `afterModel` hooks in a similar fashion
|
1185
|
-
to how routes are entered when transitioning in from other route.
|
1186
|
-
The current route params (e.g. `article_id`) will be passed in
|
1187
|
-
to the respective model hooks, and if a different model is returned,
|
1188
|
-
`setupController` and associated route hooks will re-fire as well.
|
1189
|
-
|
1190
|
-
An example usage of this method is re-querying the server for the
|
1191
|
-
latest information using the same parameters as when the route
|
1192
|
-
was first entered.
|
1193
|
-
|
1194
|
-
Note that this will cause `model` hooks to fire even on routes
|
1195
|
-
that were provided a model object when the route was initially
|
1196
|
-
entered.
|
1197
|
-
|
1198
|
-
@method refresh
|
1199
|
-
@return {Transition} the transition object associated with this
|
1200
|
-
attempted transition
|
1201
|
-
@since 1.4.0
|
1202
|
-
@public
|
1203
|
-
*/
|
1204
|
-
refresh() {
|
1205
|
-
return this._router._routerMicrolib.refresh(this);
|
1206
|
-
},
|
1207
|
-
|
1208
|
-
/**
|
1209
|
-
Transition into another route while replacing the current URL, if possible.
|
1210
|
-
This will replace the current history entry instead of adding a new one.
|
1211
|
-
Beside that, it is identical to `transitionTo` in all other respects. See
|
1212
|
-
'transitionTo' for additional information regarding multiple models.
|
1213
|
-
|
1214
|
-
Example
|
1215
|
-
|
1216
|
-
```app/router.js
|
1217
|
-
// ...
|
1218
|
-
|
1219
|
-
Router.map(function() {
|
1220
|
-
this.route('index');
|
1221
|
-
this.route('secret');
|
1222
|
-
});
|
1223
|
-
|
1224
|
-
export default Router;
|
1225
|
-
```
|
1226
|
-
|
1227
|
-
```app/routes/secret.js
|
1228
|
-
import Route from '@ember/routing/route';
|
1229
|
-
|
1230
|
-
export default Route.extend({
|
1231
|
-
afterModel() {
|
1232
|
-
if (!authorized()){
|
1233
|
-
this.replaceWith('index');
|
1234
|
-
}
|
1235
|
-
}
|
1236
|
-
});
|
1237
|
-
```
|
1238
|
-
|
1239
|
-
@method replaceWith
|
1240
|
-
@param {String} name the name of the route or a URL
|
1241
|
-
@param {...Object} models the model(s) or identifier(s) to be used while
|
1242
|
-
transitioning to the route.
|
1243
|
-
@param {Object} [options] optional hash with a queryParams property
|
1244
|
-
containing a mapping of query parameters
|
1245
|
-
@return {Transition} the transition object associated with this
|
1246
|
-
attempted transition
|
1247
|
-
@since 1.0.0
|
1248
|
-
@public
|
1249
|
-
*/
|
1250
|
-
replaceWith() {
|
1251
|
-
return this._router.replaceWith(...prefixRouteNameArg(this, arguments));
|
1252
|
-
},
|
1253
|
-
|
1254
|
-
/**
|
1255
|
-
Sends an action to the router, which will delegate it to the currently
|
1256
|
-
active route hierarchy per the bubbling rules explained under `actions`.
|
1257
|
-
|
1258
|
-
Example
|
1259
|
-
|
1260
|
-
```app/router.js
|
1261
|
-
// ...
|
1262
|
-
|
1263
|
-
Router.map(function() {
|
1264
|
-
this.route('index');
|
1265
|
-
});
|
1266
|
-
|
1267
|
-
export default Router;
|
1268
|
-
```
|
1269
|
-
|
1270
|
-
```app/routes/application.js
|
1271
|
-
import Route from '@ember/routing/route';
|
1272
|
-
|
1273
|
-
export default Route.extend({
|
1274
|
-
actions: {
|
1275
|
-
track(arg) {
|
1276
|
-
console.log(arg, 'was clicked');
|
1277
|
-
}
|
1278
|
-
}
|
1279
|
-
});
|
1280
|
-
```
|
1281
|
-
|
1282
|
-
```app/routes/index.js
|
1283
|
-
import Route from '@ember/routing/route';
|
1284
|
-
|
1285
|
-
export default Route.extend({
|
1286
|
-
actions: {
|
1287
|
-
trackIfDebug(arg) {
|
1288
|
-
if (debug) {
|
1289
|
-
this.send('track', arg);
|
1290
|
-
}
|
1291
|
-
}
|
1292
|
-
}
|
1293
|
-
});
|
1294
|
-
```
|
1295
|
-
|
1296
|
-
@method send
|
1297
|
-
@param {String} name the name of the action to trigger
|
1298
|
-
@param {...*} args
|
1299
|
-
@since 1.0.0
|
1300
|
-
@public
|
1301
|
-
*/
|
1302
|
-
send(...args) {
|
1303
|
-
assert(
|
1304
|
-
`Attempted to call .send() with the action '${args[0]}' on the destroyed route '${
|
1305
|
-
this.routeName
|
1306
|
-
}'.`,
|
1307
|
-
!this.isDestroying && !this.isDestroyed
|
1308
|
-
);
|
1309
|
-
if ((this._router && this._router._routerMicrolib) || !isTesting()) {
|
1310
|
-
this._router.send(...args);
|
1311
|
-
} else {
|
1312
|
-
let name = args.shift();
|
1313
|
-
let action = this.actions[name];
|
1314
|
-
if (action) {
|
1315
|
-
return action.apply(this, args);
|
1316
|
-
}
|
1317
|
-
}
|
1318
|
-
},
|
1319
|
-
|
1320
|
-
/**
|
1321
|
-
This hook is the entry point for router.js
|
1322
|
-
|
1323
|
-
@private
|
1324
|
-
@method setup
|
1325
|
-
*/
|
1326
|
-
setup(context, transition) {
|
1327
|
-
let controller;
|
1328
|
-
|
1329
|
-
let controllerName = this.controllerName || this.routeName;
|
1330
|
-
let definedController = this.controllerFor(controllerName, true);
|
1331
|
-
|
1332
|
-
if (definedController) {
|
1333
|
-
controller = definedController;
|
1334
|
-
} else {
|
1335
|
-
controller = this.generateController(controllerName);
|
1336
|
-
}
|
1337
|
-
|
1338
|
-
// Assign the route's controller so that it can more easily be
|
1339
|
-
// referenced in action handlers. Side effects. Side effects everywhere.
|
1340
|
-
if (!this.controller) {
|
1341
|
-
let propNames = get(this, '_qp.propertyNames');
|
1342
|
-
addQueryParamsObservers(controller, propNames);
|
1343
|
-
this.controller = controller;
|
1344
|
-
}
|
1345
|
-
|
1346
|
-
let queryParams = get(this, '_qp');
|
1347
|
-
|
1348
|
-
let states = queryParams.states;
|
1349
|
-
|
1350
|
-
controller._qpDelegate = states.allowOverrides;
|
1351
|
-
|
1352
|
-
if (transition) {
|
1353
|
-
// Update the model dep values used to calculate cache keys.
|
1354
|
-
stashParamNames(this._router, transition.state.handlerInfos);
|
1355
|
-
|
1356
|
-
let cache = this._bucketCache;
|
1357
|
-
let params = transition.params;
|
1358
|
-
let allParams = queryParams.propertyNames;
|
1359
|
-
|
1360
|
-
allParams.forEach(prop => {
|
1361
|
-
let aQp = queryParams.map[prop];
|
1362
|
-
aQp.values = params;
|
1363
|
-
|
1364
|
-
let cacheKey = calculateCacheKey(aQp.route.fullRouteName, aQp.parts, aQp.values);
|
1365
|
-
let value = cache.lookup(cacheKey, prop, aQp.undecoratedDefaultValue);
|
1366
|
-
set(controller, prop, value);
|
1367
|
-
});
|
1368
|
-
|
1369
|
-
let qpValues = getQueryParamsFor(this, transition.state);
|
1370
|
-
setProperties(controller, qpValues);
|
1371
|
-
}
|
1372
|
-
|
1373
|
-
this.setupController(controller, context, transition);
|
1374
|
-
|
1375
|
-
if (this._environment.options.shouldRender) {
|
1376
|
-
this.renderTemplate(controller, context);
|
1377
|
-
}
|
1378
|
-
},
|
1379
|
-
|
1380
|
-
/*
|
1381
|
-
Called when a query parameter for this route changes, regardless of whether the route
|
1382
|
-
is currently part of the active route hierarchy. This will update the query parameter's
|
1383
|
-
value in the cache so if this route becomes active, the cache value has been updated.
|
1384
|
-
*/
|
1385
|
-
_qpChanged(prop, value, qp) {
|
1386
|
-
if (!qp) {
|
1387
|
-
return;
|
1388
|
-
}
|
1389
|
-
|
1390
|
-
// Update model-dep cache
|
1391
|
-
let cache = this._bucketCache;
|
1392
|
-
let cacheKey = calculateCacheKey(qp.route.fullRouteName, qp.parts, qp.values);
|
1393
|
-
cache.stash(cacheKey, prop, value);
|
1394
|
-
},
|
1395
|
-
|
1396
|
-
/**
|
1397
|
-
This hook is the first of the route entry validation hooks
|
1398
|
-
called when an attempt is made to transition into a route
|
1399
|
-
or one of its children. It is called before `model` and
|
1400
|
-
`afterModel`, and is appropriate for cases when:
|
1401
|
-
|
1402
|
-
1) A decision can be made to redirect elsewhere without
|
1403
|
-
needing to resolve the model first.
|
1404
|
-
2) Any async operations need to occur first before the
|
1405
|
-
model is attempted to be resolved.
|
1406
|
-
|
1407
|
-
This hook is provided the current `transition` attempt
|
1408
|
-
as a parameter, which can be used to `.abort()` the transition,
|
1409
|
-
save it for a later `.retry()`, or retrieve values set
|
1410
|
-
on it from a previous hook. You can also just call
|
1411
|
-
`this.transitionTo` to another route to implicitly
|
1412
|
-
abort the `transition`.
|
1413
|
-
|
1414
|
-
You can return a promise from this hook to pause the
|
1415
|
-
transition until the promise resolves (or rejects). This could
|
1416
|
-
be useful, for instance, for retrieving async code from
|
1417
|
-
the server that is required to enter a route.
|
1418
|
-
|
1419
|
-
@method beforeModel
|
1420
|
-
@param {Transition} transition
|
1421
|
-
@return {any | Promise<any>} if the value returned from this hook is
|
1422
|
-
a promise, the transition will pause until the transition
|
1423
|
-
resolves. Otherwise, non-promise return values are not
|
1424
|
-
utilized in any way.
|
1425
|
-
@since 1.0.0
|
1426
|
-
@public
|
1427
|
-
*/
|
1428
|
-
beforeModel: K,
|
1429
|
-
|
1430
|
-
/**
|
1431
|
-
This hook is called after this route's model has resolved.
|
1432
|
-
It follows identical async/promise semantics to `beforeModel`
|
1433
|
-
but is provided the route's resolved model in addition to
|
1434
|
-
the `transition`, and is therefore suited to performing
|
1435
|
-
logic that can only take place after the model has already
|
1436
|
-
resolved.
|
1437
|
-
|
1438
|
-
```app/routes/posts.js
|
1439
|
-
import Route from '@ember/routing/route';
|
1440
|
-
|
1441
|
-
export default Route.extend({
|
1442
|
-
afterModel(posts, transition) {
|
1443
|
-
if (posts.get('length') === 1) {
|
1444
|
-
this.transitionTo('post.show', posts.get('firstObject'));
|
1445
|
-
}
|
1446
|
-
}
|
1447
|
-
});
|
1448
|
-
```
|
1449
|
-
|
1450
|
-
Refer to documentation for `beforeModel` for a description
|
1451
|
-
of transition-pausing semantics when a promise is returned
|
1452
|
-
from this hook.
|
1453
|
-
|
1454
|
-
@method afterModel
|
1455
|
-
@param {Object} resolvedModel the value returned from `model`,
|
1456
|
-
or its resolved value if it was a promise
|
1457
|
-
@param {Transition} transition
|
1458
|
-
@return {any | Promise<any>} if the value returned from this hook is
|
1459
|
-
a promise, the transition will pause until the transition
|
1460
|
-
resolves. Otherwise, non-promise return values are not
|
1461
|
-
utilized in any way.
|
1462
|
-
@since 1.0.0
|
1463
|
-
@public
|
1464
|
-
*/
|
1465
|
-
afterModel: K,
|
1466
|
-
|
1467
|
-
/**
|
1468
|
-
A hook you can implement to optionally redirect to another route.
|
1469
|
-
|
1470
|
-
If you call `this.transitionTo` from inside of this hook, this route
|
1471
|
-
will not be entered in favor of the other hook.
|
1472
|
-
|
1473
|
-
`redirect` and `afterModel` behave very similarly and are
|
1474
|
-
called almost at the same time, but they have an important
|
1475
|
-
distinction in the case that, from one of these hooks, a
|
1476
|
-
redirect into a child route of this route occurs: redirects
|
1477
|
-
from `afterModel` essentially invalidate the current attempt
|
1478
|
-
to enter this route, and will result in this route's `beforeModel`,
|
1479
|
-
`model`, and `afterModel` hooks being fired again within
|
1480
|
-
the new, redirecting transition. Redirects that occur within
|
1481
|
-
the `redirect` hook, on the other hand, will _not_ cause
|
1482
|
-
these hooks to be fired again the second time around; in
|
1483
|
-
other words, by the time the `redirect` hook has been called,
|
1484
|
-
both the resolved model and attempted entry into this route
|
1485
|
-
are considered to be fully validated.
|
1486
|
-
|
1487
|
-
@method redirect
|
1488
|
-
@param {Object} model the model for this route
|
1489
|
-
@param {Transition} transition the transition object associated with the current transition
|
1490
|
-
@since 1.0.0
|
1491
|
-
@public
|
1492
|
-
*/
|
1493
|
-
redirect: K,
|
1494
|
-
|
1495
|
-
/**
|
1496
|
-
Called when the context is changed by router.js.
|
1497
|
-
|
1498
|
-
@private
|
1499
|
-
@method contextDidChange
|
1500
|
-
*/
|
1501
|
-
contextDidChange() {
|
1502
|
-
this.currentModel = this.context;
|
1503
|
-
},
|
1504
|
-
|
1505
|
-
/**
|
1506
|
-
A hook you can implement to convert the URL into the model for
|
1507
|
-
this route.
|
1508
|
-
|
1509
|
-
```app/router.js
|
1510
|
-
// ...
|
1511
|
-
|
1512
|
-
Router.map(function() {
|
1513
|
-
this.route('post', { path: '/posts/:post_id' });
|
1514
|
-
});
|
1515
|
-
|
1516
|
-
export default Router;
|
1517
|
-
```
|
1518
|
-
|
1519
|
-
The model for the `post` route is `store.findRecord('post', params.post_id)`.
|
1520
|
-
|
1521
|
-
By default, if your route has a dynamic segment ending in `_id`:
|
1522
|
-
|
1523
|
-
* The model class is determined from the segment (`post_id`'s
|
1524
|
-
class is `App.Post`)
|
1525
|
-
* The find method is called on the model class with the value of
|
1526
|
-
the dynamic segment.
|
1527
|
-
|
1528
|
-
Note that for routes with dynamic segments, this hook is not always
|
1529
|
-
executed. If the route is entered through a transition (e.g. when
|
1530
|
-
using the `link-to` Handlebars helper or the `transitionTo` method
|
1531
|
-
of routes), and a model context is already provided this hook
|
1532
|
-
is not called.
|
1533
|
-
|
1534
|
-
A model context does not include a primitive string or number,
|
1535
|
-
which does cause the model hook to be called.
|
1536
|
-
|
1537
|
-
Routes without dynamic segments will always execute the model hook.
|
1538
|
-
|
1539
|
-
```javascript
|
1540
|
-
// no dynamic segment, model hook always called
|
1541
|
-
this.transitionTo('posts');
|
1542
|
-
|
1543
|
-
// model passed in, so model hook not called
|
1544
|
-
thePost = store.findRecord('post', 1);
|
1545
|
-
this.transitionTo('post', thePost);
|
1546
|
-
|
1547
|
-
// integer passed in, model hook is called
|
1548
|
-
this.transitionTo('post', 1);
|
1549
|
-
|
1550
|
-
// model id passed in, model hook is called
|
1551
|
-
// useful for forcing the hook to execute
|
1552
|
-
thePost = store.findRecord('post', 1);
|
1553
|
-
this.transitionTo('post', thePost.id);
|
1554
|
-
```
|
1555
|
-
|
1556
|
-
|
1557
|
-
This hook follows the asynchronous/promise semantics
|
1558
|
-
described in the documentation for `beforeModel`. In particular,
|
1559
|
-
if a promise returned from `model` fails, the error will be
|
1560
|
-
handled by the `error` hook on `Route`.
|
1561
|
-
|
1562
|
-
Example
|
1563
|
-
|
1564
|
-
```app/routes/post.js
|
1565
|
-
import Route from '@ember/routing/route';
|
1566
|
-
|
1567
|
-
export default Route.extend({
|
1568
|
-
model(params) {
|
1569
|
-
return this.store.findRecord('post', params.post_id);
|
1570
|
-
}
|
1571
|
-
});
|
1572
|
-
```
|
1573
|
-
|
1574
|
-
@method model
|
1575
|
-
@param {Object} params the parameters extracted from the URL
|
1576
|
-
@param {Transition} transition
|
1577
|
-
@return {any | Promise<any>} the model for this route. If
|
1578
|
-
a promise is returned, the transition will pause until
|
1579
|
-
the promise resolves, and the resolved value of the promise
|
1580
|
-
will be used as the model for this route.
|
1581
|
-
@since 1.0.0
|
1582
|
-
@public
|
1583
|
-
*/
|
1584
|
-
model(params, transition) {
|
1585
|
-
let name, sawParams, value;
|
1586
|
-
let queryParams = get(this, '_qp.map');
|
1587
|
-
|
1588
|
-
for (let prop in params) {
|
1589
|
-
if (prop === 'queryParams' || (queryParams && prop in queryParams)) {
|
1590
|
-
continue;
|
1591
|
-
}
|
1592
|
-
|
1593
|
-
let match = prop.match(/^(.*)_id$/);
|
1594
|
-
if (match !== null) {
|
1595
|
-
name = match[1];
|
1596
|
-
value = params[prop];
|
1597
|
-
}
|
1598
|
-
sawParams = true;
|
1599
|
-
}
|
1600
|
-
|
1601
|
-
if (!name) {
|
1602
|
-
if (sawParams) {
|
1603
|
-
return Object.assign({}, params);
|
1604
|
-
} else {
|
1605
|
-
if (transition.resolveIndex < 1) {
|
1606
|
-
return;
|
1607
|
-
}
|
1608
|
-
return transition.state.handlerInfos[transition.resolveIndex - 1].context;
|
1609
|
-
}
|
1610
|
-
}
|
1611
|
-
|
1612
|
-
return this.findModel(name, value);
|
1613
|
-
},
|
1614
|
-
|
1615
|
-
/**
|
1616
|
-
@private
|
1617
|
-
@method deserialize
|
1618
|
-
@param {Object} params the parameters extracted from the URL
|
1619
|
-
@param {Transition} transition
|
1620
|
-
@return {any | Promise<any>} the model for this route.
|
1621
|
-
|
1622
|
-
Router.js hook.
|
1623
|
-
*/
|
1624
|
-
deserialize(params, transition) {
|
1625
|
-
return this.model(this.paramsFor(this.routeName), transition);
|
1626
|
-
},
|
1627
|
-
|
1628
|
-
/**
|
1629
|
-
|
1630
|
-
@method findModel
|
1631
|
-
@param {String} type the model type
|
1632
|
-
@param {Object} value the value passed to find
|
1633
|
-
@private
|
1634
|
-
*/
|
1635
|
-
findModel() {
|
1636
|
-
return get(this, 'store').find(...arguments);
|
1637
|
-
},
|
1638
|
-
|
1639
|
-
/**
|
1640
|
-
Store property provides a hook for data persistence libraries to inject themselves.
|
1641
|
-
|
1642
|
-
By default, this store property provides the exact same functionality previously
|
1643
|
-
in the model hook.
|
1644
|
-
|
1645
|
-
Currently, the required interface is:
|
1646
|
-
|
1647
|
-
`store.find(modelName, findArguments)`
|
1648
|
-
|
1649
|
-
@method store
|
1650
|
-
@param {Object} store
|
1651
|
-
@private
|
1652
|
-
*/
|
1653
|
-
store: computed(function() {
|
1654
|
-
let owner = getOwner(this);
|
1655
|
-
let routeName = this.routeName;
|
1656
|
-
let namespace = get(this, '_router.namespace');
|
1657
|
-
|
1658
|
-
return {
|
1659
|
-
find(name, value) {
|
1660
|
-
let modelClass = owner.factoryFor(`model:${name}`);
|
1661
|
-
|
1662
|
-
assert(
|
1663
|
-
`You used the dynamic segment ${name}_id in your route ${routeName}, but ${namespace}.${classify(
|
1664
|
-
name
|
1665
|
-
)} did not exist and you did not override your route's \`model\` hook.`,
|
1666
|
-
!!modelClass
|
1667
|
-
);
|
1668
|
-
|
1669
|
-
if (!modelClass) {
|
1670
|
-
return;
|
1671
|
-
}
|
1672
|
-
|
1673
|
-
modelClass = modelClass.class;
|
1674
|
-
|
1675
|
-
assert(`${classify(name)} has no method \`find\`.`, typeof modelClass.find === 'function');
|
1676
|
-
|
1677
|
-
return modelClass.find(value);
|
1678
|
-
},
|
1679
|
-
};
|
1680
|
-
}),
|
1681
|
-
|
1682
|
-
/**
|
1683
|
-
A hook you can implement to convert the route's model into parameters
|
1684
|
-
for the URL.
|
1685
|
-
|
1686
|
-
```app/router.js
|
1687
|
-
// ...
|
1688
|
-
|
1689
|
-
Router.map(function() {
|
1690
|
-
this.route('post', { path: '/posts/:post_id' });
|
1691
|
-
});
|
1692
|
-
|
1693
|
-
```
|
1694
|
-
|
1695
|
-
```app/routes/post.js
|
1696
|
-
import $ from 'jquery';
|
1697
|
-
import Route from '@ember/routing/route';
|
1698
|
-
|
1699
|
-
export default Route.extend({
|
1700
|
-
model(params) {
|
1701
|
-
// the server returns `{ id: 12 }`
|
1702
|
-
return $.getJSON('/posts/' + params.post_id);
|
1703
|
-
},
|
1704
|
-
|
1705
|
-
serialize(model) {
|
1706
|
-
// this will make the URL `/posts/12`
|
1707
|
-
return { post_id: model.id };
|
1708
|
-
}
|
1709
|
-
});
|
1710
|
-
```
|
1711
|
-
|
1712
|
-
The default `serialize` method will insert the model's `id` into the
|
1713
|
-
route's dynamic segment (in this case, `:post_id`) if the segment contains '_id'.
|
1714
|
-
If the route has multiple dynamic segments or does not contain '_id', `serialize`
|
1715
|
-
will return `getProperties(model, params)`
|
1716
|
-
|
1717
|
-
This method is called when `transitionTo` is called with a context
|
1718
|
-
in order to populate the URL.
|
1719
|
-
|
1720
|
-
@method serialize
|
1721
|
-
@param {Object} model the routes model
|
1722
|
-
@param {Array} params an Array of parameter names for the current
|
1723
|
-
route (in the example, `['post_id']`.
|
1724
|
-
@return {Object} the serialized parameters
|
1725
|
-
@since 1.0.0
|
1726
|
-
@public
|
1727
|
-
*/
|
1728
|
-
serialize: defaultSerialize,
|
1729
|
-
|
1730
|
-
/**
|
1731
|
-
A hook you can use to setup the controller for the current route.
|
1732
|
-
|
1733
|
-
This method is called with the controller for the current route and the
|
1734
|
-
model supplied by the `model` hook.
|
1735
|
-
|
1736
|
-
By default, the `setupController` hook sets the `model` property of
|
1737
|
-
the controller to the specified `model` when it is not `undefined`.
|
1738
|
-
|
1739
|
-
If you implement the `setupController` hook in your Route, it will
|
1740
|
-
prevent this default behavior. If you want to preserve that behavior
|
1741
|
-
when implementing your `setupController` function, make sure to call
|
1742
|
-
`_super`:
|
1743
|
-
|
1744
|
-
```app/routes/photos.js
|
1745
|
-
import Route from '@ember/routing/route';
|
1746
|
-
|
1747
|
-
export default Route.extend({
|
1748
|
-
model() {
|
1749
|
-
return this.store.findAll('photo');
|
1750
|
-
},
|
1751
|
-
|
1752
|
-
setupController(controller, model) {
|
1753
|
-
// Call _super for default behavior
|
1754
|
-
this._super(controller, model);
|
1755
|
-
// Implement your custom setup after
|
1756
|
-
this.controllerFor('application').set('showingPhotos', true);
|
1757
|
-
}
|
1758
|
-
});
|
1759
|
-
```
|
1760
|
-
|
1761
|
-
The provided controller will be one resolved based on the name
|
1762
|
-
of this route.
|
1763
|
-
|
1764
|
-
If no explicit controller is defined, Ember will automatically create one.
|
1765
|
-
|
1766
|
-
As an example, consider the router:
|
1767
|
-
|
1768
|
-
```app/router.js
|
1769
|
-
// ...
|
1770
|
-
|
1771
|
-
Router.map(function() {
|
1772
|
-
this.route('post', { path: '/posts/:post_id' });
|
1773
|
-
});
|
1774
|
-
|
1775
|
-
export default Router;
|
1776
|
-
```
|
1777
|
-
|
1778
|
-
For the `post` route, a controller named `App.PostController` would
|
1779
|
-
be used if it is defined. If it is not defined, a basic `Controller`
|
1780
|
-
instance would be used.
|
1781
|
-
|
1782
|
-
Example
|
1783
|
-
|
1784
|
-
```app/routes/post.js
|
1785
|
-
import Route from '@ember/routing/route';
|
1786
|
-
|
1787
|
-
export default Route.extend({
|
1788
|
-
setupController(controller, model) {
|
1789
|
-
controller.set('model', model);
|
1790
|
-
}
|
1791
|
-
});
|
1792
|
-
```
|
1793
|
-
|
1794
|
-
@method setupController
|
1795
|
-
@param {Controller} controller instance
|
1796
|
-
@param {Object} model
|
1797
|
-
@since 1.0.0
|
1798
|
-
@public
|
1799
|
-
*/
|
1800
|
-
setupController(controller, context /*, transition */) {
|
1801
|
-
// eslint-disable-line no-unused-vars
|
1802
|
-
if (controller && context !== undefined) {
|
1803
|
-
set(controller, 'model', context);
|
1804
|
-
}
|
1805
|
-
},
|
1806
|
-
|
1807
|
-
/**
|
1808
|
-
Returns the controller of the current route, or a parent (or any ancestor)
|
1809
|
-
route in a route hierarchy.
|
1810
|
-
|
1811
|
-
The controller instance must already have been created, either through entering the
|
1812
|
-
associated route or using `generateController`.
|
1813
|
-
|
1814
|
-
```app/routes/post.js
|
1815
|
-
import Route from '@ember/routing/route';
|
1816
|
-
|
1817
|
-
export default Route.extend({
|
1818
|
-
setupController(controller, post) {
|
1819
|
-
this._super(controller, post);
|
1820
|
-
this.controllerFor('posts').set('currentPost', post);
|
1821
|
-
}
|
1822
|
-
});
|
1823
|
-
```
|
1824
|
-
|
1825
|
-
@method controllerFor
|
1826
|
-
@param {String} name the name of the route or controller
|
1827
|
-
@return {Controller}
|
1828
|
-
@since 1.0.0
|
1829
|
-
@public
|
1830
|
-
*/
|
1831
|
-
controllerFor(name, _skipAssert) {
|
1832
|
-
let owner = getOwner(this);
|
1833
|
-
let route = owner.lookup(`route:${name}`);
|
1834
|
-
let controller;
|
1835
|
-
|
1836
|
-
if (route && route.controllerName) {
|
1837
|
-
name = route.controllerName;
|
1838
|
-
}
|
1839
|
-
|
1840
|
-
controller = owner.lookup(`controller:${name}`);
|
1841
|
-
|
1842
|
-
// NOTE: We're specifically checking that skipAssert is true, because according
|
1843
|
-
// to the old API the second parameter was model. We do not want people who
|
1844
|
-
// passed a model to skip the assertion.
|
1845
|
-
assert(
|
1846
|
-
`The controller named '${name}' could not be found. Make sure that this route exists and has already been entered at least once. If you are accessing a controller not associated with a route, make sure the controller class is explicitly defined.`,
|
1847
|
-
controller || _skipAssert === true
|
1848
|
-
);
|
1849
|
-
|
1850
|
-
return controller;
|
1851
|
-
},
|
1852
|
-
|
1853
|
-
/**
|
1854
|
-
Generates a controller for a route.
|
1855
|
-
|
1856
|
-
Example
|
1857
|
-
|
1858
|
-
```app/routes/post.js
|
1859
|
-
import Route from '@ember/routing/route';
|
1860
|
-
|
1861
|
-
export default Route.extend({
|
1862
|
-
setupController(controller, post) {
|
1863
|
-
this._super(controller, post);
|
1864
|
-
this.generateController('posts');
|
1865
|
-
}
|
1866
|
-
});
|
1867
|
-
```
|
1868
|
-
|
1869
|
-
@method generateController
|
1870
|
-
@param {String} name the name of the controller
|
1871
|
-
@private
|
1872
|
-
*/
|
1873
|
-
generateController(name) {
|
1874
|
-
let owner = getOwner(this);
|
1875
|
-
|
1876
|
-
return generateController(owner, name);
|
1877
|
-
},
|
1878
|
-
|
1879
|
-
/**
|
1880
|
-
Returns the resolved model of a parent (or any ancestor) route
|
1881
|
-
in a route hierarchy. During a transition, all routes
|
1882
|
-
must resolve a model object, and if a route
|
1883
|
-
needs access to a parent route's model in order to
|
1884
|
-
resolve a model (or just reuse the model from a parent),
|
1885
|
-
it can call `this.modelFor(theNameOfParentRoute)` to
|
1886
|
-
retrieve it. If the ancestor route's model was a promise,
|
1887
|
-
its resolved result is returned.
|
1888
|
-
|
1889
|
-
Example
|
1890
|
-
|
1891
|
-
```app/router.js
|
1892
|
-
// ...
|
1893
|
-
|
1894
|
-
Router.map(function() {
|
1895
|
-
this.route('post', { path: '/posts/:post_id' }, function() {
|
1896
|
-
this.route('comments');
|
1897
|
-
});
|
1898
|
-
});
|
1899
|
-
|
1900
|
-
export default Router;
|
1901
|
-
```
|
1902
|
-
|
1903
|
-
```app/routes/post/comments.js
|
1904
|
-
import Route from '@ember/routing/route';
|
1905
|
-
|
1906
|
-
export default Route.extend({
|
1907
|
-
model() {
|
1908
|
-
let post = this.modelFor('post');
|
1909
|
-
return post.get('comments');
|
1910
|
-
}
|
1911
|
-
});
|
1912
|
-
```
|
1913
|
-
|
1914
|
-
@method modelFor
|
1915
|
-
@param {String} name the name of the route
|
1916
|
-
@return {Object} the model object
|
1917
|
-
@since 1.0.0
|
1918
|
-
@public
|
1919
|
-
*/
|
1920
|
-
modelFor(_name) {
|
1921
|
-
let name;
|
1922
|
-
let owner = getOwner(this);
|
1923
|
-
let transition =
|
1924
|
-
this._router && this._router._routerMicrolib
|
1925
|
-
? this._router._routerMicrolib.activeTransition
|
1926
|
-
: null;
|
1927
|
-
|
1928
|
-
// Only change the route name when there is an active transition.
|
1929
|
-
// Otherwise, use the passed in route name.
|
1930
|
-
if (owner.routable && transition !== null) {
|
1931
|
-
name = getEngineRouteName(owner, _name);
|
1932
|
-
} else {
|
1933
|
-
name = _name;
|
1934
|
-
}
|
1935
|
-
|
1936
|
-
let route = owner.lookup(`route:${name}`);
|
1937
|
-
// If we are mid-transition, we want to try and look up
|
1938
|
-
// resolved parent contexts on the current transitionEvent.
|
1939
|
-
if (transition !== null) {
|
1940
|
-
let modelLookupName = (route && route.routeName) || name;
|
1941
|
-
if (transition.resolvedModels.hasOwnProperty(modelLookupName)) {
|
1942
|
-
return transition.resolvedModels[modelLookupName];
|
1943
|
-
}
|
1944
|
-
}
|
1945
|
-
|
1946
|
-
return route && route.currentModel;
|
1947
|
-
},
|
1948
|
-
|
1949
|
-
/**
|
1950
|
-
A hook you can use to render the template for the current route.
|
1951
|
-
|
1952
|
-
This method is called with the controller for the current route and the
|
1953
|
-
model supplied by the `model` hook. By default, it renders the route's
|
1954
|
-
template, configured with the controller for the route.
|
1955
|
-
|
1956
|
-
This method can be overridden to set up and render additional or
|
1957
|
-
alternative templates.
|
1958
|
-
|
1959
|
-
```app/routes/posts.js
|
1960
|
-
import Route from '@ember/routing/route';
|
1961
|
-
|
1962
|
-
export default Route.extend({
|
1963
|
-
renderTemplate(controller, model) {
|
1964
|
-
let favController = this.controllerFor('favoritePost');
|
1965
|
-
|
1966
|
-
// Render the `favoritePost` template into
|
1967
|
-
// the outlet `posts`, and display the `favoritePost`
|
1968
|
-
// controller.
|
1969
|
-
this.render('favoritePost', {
|
1970
|
-
outlet: 'posts',
|
1971
|
-
controller: favController
|
1972
|
-
});
|
1973
|
-
}
|
1974
|
-
});
|
1975
|
-
```
|
1976
|
-
|
1977
|
-
@method renderTemplate
|
1978
|
-
@param {Object} controller the route's controller
|
1979
|
-
@param {Object} model the route's model
|
1980
|
-
@since 1.0.0
|
1981
|
-
@public
|
1982
|
-
*/
|
1983
|
-
renderTemplate(/* controller, model */) {
|
1984
|
-
// eslint-disable-line no-unused-vars
|
1985
|
-
this.render();
|
1986
|
-
},
|
1987
|
-
|
1988
|
-
/**
|
1989
|
-
`render` is used to render a template into a region of another template
|
1990
|
-
(indicated by an `{{outlet}}`). `render` is used both during the entry
|
1991
|
-
phase of routing (via the `renderTemplate` hook) and later in response to
|
1992
|
-
user interaction.
|
1993
|
-
|
1994
|
-
For example, given the following minimal router and templates:
|
1995
|
-
|
1996
|
-
```app/router.js
|
1997
|
-
// ...
|
1998
|
-
|
1999
|
-
Router.map(function() {
|
2000
|
-
this.route('photos');
|
2001
|
-
});
|
2002
|
-
|
2003
|
-
export default Router;
|
2004
|
-
```
|
2005
|
-
|
2006
|
-
```handlebars
|
2007
|
-
<!-- application.hbs -->
|
2008
|
-
<div class='something-in-the-app-hbs'>
|
2009
|
-
{{outlet "anOutletName"}}
|
2010
|
-
</div>
|
2011
|
-
```
|
2012
|
-
|
2013
|
-
```handlebars
|
2014
|
-
<!-- photos.hbs -->
|
2015
|
-
<h1>Photos</h1>
|
2016
|
-
```
|
2017
|
-
|
2018
|
-
You can render `photos.hbs` into the `"anOutletName"` outlet of
|
2019
|
-
`application.hbs` by calling `render`:
|
2020
|
-
|
2021
|
-
```app/routes/post.js
|
2022
|
-
import Route from '@ember/routing/route';
|
2023
|
-
|
2024
|
-
export default Route.extend({
|
2025
|
-
renderTemplate() {
|
2026
|
-
this.render('photos', {
|
2027
|
-
into: 'application',
|
2028
|
-
outlet: 'anOutletName'
|
2029
|
-
})
|
2030
|
-
}
|
2031
|
-
});
|
2032
|
-
```
|
2033
|
-
|
2034
|
-
`render` additionally allows you to supply which `controller` and
|
2035
|
-
`model` objects should be loaded and associated with the rendered template.
|
2036
|
-
|
2037
|
-
|
2038
|
-
```app/routes/posts.js
|
2039
|
-
import Route from '@ember/routing/route';
|
2040
|
-
|
2041
|
-
export default Route.extend({
|
2042
|
-
renderTemplate(controller, model){
|
2043
|
-
this.render('posts', { // the template to render, referenced by name
|
2044
|
-
into: 'application', // the template to render into, referenced by name
|
2045
|
-
outlet: 'anOutletName', // the outlet inside `options.into` to render into.
|
2046
|
-
controller: 'someControllerName', // the controller to use for this template, referenced by name
|
2047
|
-
model: model // the model to set on `options.controller`.
|
2048
|
-
})
|
2049
|
-
}
|
2050
|
-
});
|
2051
|
-
```
|
2052
|
-
|
2053
|
-
The string values provided for the template name, and controller
|
2054
|
-
will eventually pass through to the resolver for lookup. See
|
2055
|
-
Resolver for how these are mapped to JavaScript objects in your
|
2056
|
-
application. The template to render into needs to be related to either the
|
2057
|
-
current route or one of its ancestors.
|
2058
|
-
|
2059
|
-
Not all options need to be passed to `render`. Default values will be used
|
2060
|
-
based on the name of the route specified in the router or the Route's
|
2061
|
-
`controllerName` and `templateName` properties.
|
2062
|
-
|
2063
|
-
For example:
|
2064
|
-
|
2065
|
-
```app/router.js
|
2066
|
-
// ...
|
2067
|
-
|
2068
|
-
Router.map(function() {
|
2069
|
-
this.route('index');
|
2070
|
-
this.route('post', { path: '/posts/:post_id' });
|
2071
|
-
});
|
2072
|
-
|
2073
|
-
export default Router;
|
2074
|
-
```
|
2075
|
-
|
2076
|
-
```app/routes/post.js
|
2077
|
-
import Route from '@ember/routing/route';
|
2078
|
-
|
2079
|
-
export default Route.extend({
|
2080
|
-
renderTemplate() {
|
2081
|
-
this.render(); // all defaults apply
|
2082
|
-
}
|
2083
|
-
});
|
2084
|
-
```
|
2085
|
-
|
2086
|
-
The name of the route, defined by the router, is `post`.
|
2087
|
-
|
2088
|
-
The following equivalent default options will be applied when
|
2089
|
-
the Route calls `render`:
|
2090
|
-
|
2091
|
-
```javascript
|
2092
|
-
this.render('post', { // the template name associated with 'post' Route
|
2093
|
-
into: 'application', // the parent route to 'post' Route
|
2094
|
-
outlet: 'main', // {{outlet}} and {{outlet 'main'}} are synonymous,
|
2095
|
-
controller: 'post', // the controller associated with the 'post' Route
|
2096
|
-
})
|
2097
|
-
```
|
2098
|
-
|
2099
|
-
By default the controller's `model` will be the route's model, so it does not
|
2100
|
-
need to be passed unless you wish to change which model is being used.
|
2101
|
-
|
2102
|
-
@method render
|
2103
|
-
@param {String} name the name of the template to render
|
2104
|
-
@param {Object} [options] the options
|
2105
|
-
@param {String} [options.into] the template to render into,
|
2106
|
-
referenced by name. Defaults to the parent template
|
2107
|
-
@param {String} [options.outlet] the outlet inside `options.into` to render into.
|
2108
|
-
Defaults to 'main'
|
2109
|
-
@param {String|Object} [options.controller] the controller to use for this template,
|
2110
|
-
referenced by name or as a controller instance. Defaults to the Route's paired controller
|
2111
|
-
@param {Object} [options.model] the model object to set on `options.controller`.
|
2112
|
-
Defaults to the return value of the Route's model hook
|
2113
|
-
@since 1.0.0
|
2114
|
-
@public
|
2115
|
-
*/
|
2116
|
-
render(_name, options) {
|
2117
|
-
let name;
|
2118
|
-
let isDefaultRender = arguments.length === 0;
|
2119
|
-
if (!isDefaultRender) {
|
2120
|
-
if (typeof _name === 'object' && !options) {
|
2121
|
-
name = this.templateName || this.routeName;
|
2122
|
-
options = _name;
|
2123
|
-
} else {
|
2124
|
-
assert('The name in the given arguments is undefined or empty string', !isEmpty(_name));
|
2125
|
-
name = _name;
|
2126
|
-
}
|
2127
|
-
}
|
2128
|
-
|
2129
|
-
let renderOptions = buildRenderOptions(this, isDefaultRender, name, options);
|
2130
|
-
this.connections.push(renderOptions);
|
2131
|
-
once(this._router, '_setOutlets');
|
2132
|
-
},
|
2133
|
-
|
2134
|
-
/**
|
2135
|
-
Disconnects a view that has been rendered into an outlet.
|
2136
|
-
|
2137
|
-
You may pass any or all of the following options to `disconnectOutlet`:
|
2138
|
-
|
2139
|
-
* `outlet`: the name of the outlet to clear (default: 'main')
|
2140
|
-
* `parentView`: the name of the view containing the outlet to clear
|
2141
|
-
(default: the view rendered by the parent route)
|
2142
|
-
|
2143
|
-
Example:
|
2144
|
-
|
2145
|
-
```app/routes/application.js
|
2146
|
-
import Route from '@ember/routing/route';
|
2147
|
-
|
2148
|
-
export default Route.extend({
|
2149
|
-
actions: {
|
2150
|
-
showModal(evt) {
|
2151
|
-
this.render(evt.modalName, {
|
2152
|
-
outlet: 'modal',
|
2153
|
-
into: 'application'
|
2154
|
-
});
|
2155
|
-
},
|
2156
|
-
|
2157
|
-
hideModal(evt) {
|
2158
|
-
this.disconnectOutlet({
|
2159
|
-
outlet: 'modal',
|
2160
|
-
parentView: 'application'
|
2161
|
-
});
|
2162
|
-
}
|
2163
|
-
}
|
2164
|
-
});
|
2165
|
-
```
|
2166
|
-
|
2167
|
-
Alternatively, you can pass the `outlet` name directly as a string.
|
2168
|
-
|
2169
|
-
Example:
|
2170
|
-
|
2171
|
-
```app/routes/application.js
|
2172
|
-
import Route from '@ember/routing/route';
|
2173
|
-
|
2174
|
-
export default Route.extend({
|
2175
|
-
actions: {
|
2176
|
-
showModal(evt) {
|
2177
|
-
// ...
|
2178
|
-
},
|
2179
|
-
hideModal(evt) {
|
2180
|
-
this.disconnectOutlet('modal');
|
2181
|
-
}
|
2182
|
-
}
|
2183
|
-
});
|
2184
|
-
```
|
2185
|
-
|
2186
|
-
@method disconnectOutlet
|
2187
|
-
@param {Object|String} options the options hash or outlet name
|
2188
|
-
@since 1.0.0
|
2189
|
-
@public
|
2190
|
-
*/
|
2191
|
-
disconnectOutlet(options) {
|
2192
|
-
let outletName;
|
2193
|
-
let parentView;
|
2194
|
-
if (options) {
|
2195
|
-
if (typeof options === 'string') {
|
2196
|
-
outletName = options;
|
2197
|
-
} else {
|
2198
|
-
outletName = options.outlet;
|
2199
|
-
parentView = options.parentView ? options.parentView.replace(/\//g, '.') : undefined;
|
2200
|
-
|
2201
|
-
assert(
|
2202
|
-
'You passed undefined as the outlet name.',
|
2203
|
-
!('outlet' in options && options.outlet === undefined)
|
2204
|
-
);
|
2205
|
-
}
|
2206
|
-
}
|
2207
|
-
|
2208
|
-
outletName = outletName || 'main';
|
2209
|
-
this._disconnectOutlet(outletName, parentView);
|
2210
|
-
let handlerInfos = this._router._routerMicrolib.currentHandlerInfos;
|
2211
|
-
for (let i = 0; i < handlerInfos.length; i++) {
|
2212
|
-
// This non-local state munging is sadly necessary to maintain
|
2213
|
-
// backward compatibility with our existing semantics, which allow
|
2214
|
-
// any route to disconnectOutlet things originally rendered by any
|
2215
|
-
// other route. This should all get cut in 2.0.
|
2216
|
-
handlerInfos[i].handler._disconnectOutlet(outletName, parentView);
|
2217
|
-
}
|
2218
|
-
},
|
2219
|
-
|
2220
|
-
_disconnectOutlet(outletName, parentView) {
|
2221
|
-
let parent = parentRoute(this);
|
2222
|
-
if (parent && parentView === parent.routeName) {
|
2223
|
-
parentView = undefined;
|
2224
|
-
}
|
2225
|
-
for (let i = 0; i < this.connections.length; i++) {
|
2226
|
-
let connection = this.connections[i];
|
2227
|
-
if (connection.outlet === outletName && connection.into === parentView) {
|
2228
|
-
// This neuters the disconnected outlet such that it doesn't
|
2229
|
-
// render anything, but it leaves an entry in the outlet
|
2230
|
-
// hierarchy so that any existing other renders that target it
|
2231
|
-
// don't suddenly blow up. They will still stick themselves
|
2232
|
-
// into its outlets, which won't render anywhere. All of this
|
2233
|
-
// statefulness should get the machete in 2.0.
|
2234
|
-
this.connections[i] = {
|
2235
|
-
owner: connection.owner,
|
2236
|
-
into: connection.into,
|
2237
|
-
outlet: connection.outlet,
|
2238
|
-
name: connection.name,
|
2239
|
-
controller: undefined,
|
2240
|
-
template: undefined,
|
2241
|
-
};
|
2242
|
-
once(this._router, '_setOutlets');
|
2243
|
-
}
|
2244
|
-
}
|
2245
|
-
},
|
2246
|
-
|
2247
|
-
willDestroy() {
|
2248
|
-
this.teardownViews();
|
2249
|
-
},
|
2250
|
-
|
2251
|
-
/**
|
2252
|
-
@private
|
2253
|
-
|
2254
|
-
@method teardownViews
|
2255
|
-
*/
|
2256
|
-
teardownViews() {
|
2257
|
-
if (this.connections && this.connections.length > 0) {
|
2258
|
-
this.connections = [];
|
2259
|
-
once(this._router, '_setOutlets');
|
2260
|
-
}
|
2261
|
-
},
|
2262
|
-
});
|
2263
|
-
|
2264
|
-
Route.reopenClass({
|
2265
|
-
isRouteFactory: true,
|
2266
|
-
});
|
2267
|
-
|
2268
|
-
function parentRoute(route) {
|
2269
|
-
let handlerInfo = handlerInfoFor(route, route._router._routerMicrolib.state.handlerInfos, -1);
|
2270
|
-
return handlerInfo && handlerInfo.handler;
|
2271
|
-
}
|
2272
|
-
|
2273
|
-
function handlerInfoFor(route, handlerInfos, offset = 0) {
|
2274
|
-
if (!handlerInfos) {
|
2275
|
-
return;
|
2276
|
-
}
|
2277
|
-
|
2278
|
-
let current;
|
2279
|
-
for (let i = 0; i < handlerInfos.length; i++) {
|
2280
|
-
current = handlerInfos[i].handler;
|
2281
|
-
if (current === route) {
|
2282
|
-
return handlerInfos[i + offset];
|
2283
|
-
}
|
2284
|
-
}
|
2285
|
-
}
|
2286
|
-
|
2287
|
-
function buildRenderOptions(route, isDefaultRender, _name, options) {
|
2288
|
-
assert(
|
2289
|
-
'You passed undefined as the outlet name.',
|
2290
|
-
isDefaultRender || !(options && 'outlet' in options && options.outlet === undefined)
|
2291
|
-
);
|
2292
|
-
|
2293
|
-
let owner = getOwner(route);
|
2294
|
-
let name, templateName, into, outlet, controller, model;
|
2295
|
-
if (options) {
|
2296
|
-
into = options.into && options.into.replace(/\//g, '.');
|
2297
|
-
outlet = options.outlet;
|
2298
|
-
controller = options.controller;
|
2299
|
-
model = options.model;
|
2300
|
-
}
|
2301
|
-
outlet = outlet || 'main';
|
2302
|
-
|
2303
|
-
if (isDefaultRender) {
|
2304
|
-
name = route.routeName;
|
2305
|
-
templateName = route.templateName || name;
|
2306
|
-
} else {
|
2307
|
-
name = _name.replace(/\//g, '.');
|
2308
|
-
templateName = name;
|
2309
|
-
}
|
2310
|
-
|
2311
|
-
if (!controller) {
|
2312
|
-
if (isDefaultRender) {
|
2313
|
-
controller = route.controllerName || owner.lookup(`controller:${name}`);
|
2314
|
-
} else {
|
2315
|
-
controller = owner.lookup(`controller:${name}`) || route.controllerName || route.routeName;
|
2316
|
-
}
|
2317
|
-
}
|
2318
|
-
|
2319
|
-
if (typeof controller === 'string') {
|
2320
|
-
let controllerName = controller;
|
2321
|
-
controller = owner.lookup(`controller:${controllerName}`);
|
2322
|
-
assert(
|
2323
|
-
`You passed \`controller: '${controllerName}'\` into the \`render\` method, but no such controller could be found.`,
|
2324
|
-
isDefaultRender || controller
|
2325
|
-
);
|
2326
|
-
}
|
2327
|
-
|
2328
|
-
if (model) {
|
2329
|
-
controller.set('model', model);
|
2330
|
-
}
|
2331
|
-
|
2332
|
-
let template = owner.lookup(`template:${templateName}`);
|
2333
|
-
assert(
|
2334
|
-
`Could not find "${templateName}" template, view, or component.`,
|
2335
|
-
isDefaultRender || template
|
2336
|
-
);
|
2337
|
-
|
2338
|
-
let parent;
|
2339
|
-
if (into && (parent = parentRoute(route)) && into === parent.routeName) {
|
2340
|
-
into = undefined;
|
2341
|
-
}
|
2342
|
-
|
2343
|
-
let renderOptions = {
|
2344
|
-
owner,
|
2345
|
-
into,
|
2346
|
-
outlet,
|
2347
|
-
name,
|
2348
|
-
controller,
|
2349
|
-
template: template || route._topLevelViewTemplate,
|
2350
|
-
};
|
2351
|
-
|
2352
|
-
if (DEBUG) {
|
2353
|
-
let LOG_VIEW_LOOKUPS = get(route._router, 'namespace.LOG_VIEW_LOOKUPS');
|
2354
|
-
if (LOG_VIEW_LOOKUPS && !template) {
|
2355
|
-
info(`Could not find "${name}" template. Nothing will be rendered`, {
|
2356
|
-
fullName: `template:${name}`,
|
2357
|
-
});
|
2358
|
-
}
|
2359
|
-
}
|
2360
|
-
|
2361
|
-
return renderOptions;
|
2362
|
-
}
|
2363
|
-
|
2364
|
-
function getFullQueryParams(router, state) {
|
2365
|
-
if (state.fullQueryParams) {
|
2366
|
-
return state.fullQueryParams;
|
2367
|
-
}
|
2368
|
-
|
2369
|
-
state.fullQueryParams = {};
|
2370
|
-
assign(state.fullQueryParams, state.queryParams);
|
2371
|
-
|
2372
|
-
router._deserializeQueryParams(state.handlerInfos, state.fullQueryParams);
|
2373
|
-
return state.fullQueryParams;
|
2374
|
-
}
|
2375
|
-
|
2376
|
-
function getQueryParamsFor(route, state) {
|
2377
|
-
state.queryParamsFor = state.queryParamsFor || {};
|
2378
|
-
let name = route.fullRouteName;
|
2379
|
-
|
2380
|
-
if (state.queryParamsFor[name]) {
|
2381
|
-
return state.queryParamsFor[name];
|
2382
|
-
}
|
2383
|
-
|
2384
|
-
let fullQueryParams = getFullQueryParams(route._router, state);
|
2385
|
-
|
2386
|
-
let params = (state.queryParamsFor[name] = {});
|
2387
|
-
|
2388
|
-
// Copy over all the query params for this route/controller into params hash.
|
2389
|
-
let qpMeta = get(route, '_qp');
|
2390
|
-
let qps = qpMeta.qps;
|
2391
|
-
for (let i = 0; i < qps.length; ++i) {
|
2392
|
-
// Put deserialized qp on params hash.
|
2393
|
-
let qp = qps[i];
|
2394
|
-
|
2395
|
-
let qpValueWasPassedIn = qp.prop in fullQueryParams;
|
2396
|
-
params[qp.prop] = qpValueWasPassedIn
|
2397
|
-
? fullQueryParams[qp.prop]
|
2398
|
-
: copyDefaultValue(qp.defaultValue);
|
2399
|
-
}
|
2400
|
-
|
2401
|
-
return params;
|
2402
|
-
}
|
2403
|
-
|
2404
|
-
function copyDefaultValue(value) {
|
2405
|
-
if (Array.isArray(value)) {
|
2406
|
-
return emberA(value.slice());
|
2407
|
-
}
|
2408
|
-
return value;
|
2409
|
-
}
|
2410
|
-
|
2411
|
-
/*
|
2412
|
-
Merges all query parameters from a controller with those from
|
2413
|
-
a route, returning a new object and avoiding any mutations to
|
2414
|
-
the existing objects.
|
2415
|
-
*/
|
2416
|
-
function mergeEachQueryParams(controllerQP, routeQP) {
|
2417
|
-
let qps = {};
|
2418
|
-
let keysAlreadyMergedOrSkippable = {
|
2419
|
-
defaultValue: true,
|
2420
|
-
type: true,
|
2421
|
-
scope: true,
|
2422
|
-
as: true,
|
2423
|
-
};
|
2424
|
-
|
2425
|
-
// first loop over all controller qps, merging them with any matching route qps
|
2426
|
-
// into a new empty object to avoid mutating.
|
2427
|
-
for (let cqpName in controllerQP) {
|
2428
|
-
if (!controllerQP.hasOwnProperty(cqpName)) {
|
2429
|
-
continue;
|
2430
|
-
}
|
2431
|
-
|
2432
|
-
let newControllerParameterConfiguration = {};
|
2433
|
-
assign(newControllerParameterConfiguration, controllerQP[cqpName], routeQP[cqpName]);
|
2434
|
-
|
2435
|
-
qps[cqpName] = newControllerParameterConfiguration;
|
2436
|
-
|
2437
|
-
// allows us to skip this QP when we check route QPs.
|
2438
|
-
keysAlreadyMergedOrSkippable[cqpName] = true;
|
2439
|
-
}
|
2440
|
-
|
2441
|
-
// loop over all route qps, skipping those that were merged in the first pass
|
2442
|
-
// because they also appear in controller qps
|
2443
|
-
for (let rqpName in routeQP) {
|
2444
|
-
if (!routeQP.hasOwnProperty(rqpName) || keysAlreadyMergedOrSkippable[rqpName]) {
|
2445
|
-
continue;
|
2446
|
-
}
|
2447
|
-
|
2448
|
-
let newRouteParameterConfiguration = {};
|
2449
|
-
assign(newRouteParameterConfiguration, routeQP[rqpName], controllerQP[rqpName]);
|
2450
|
-
qps[rqpName] = newRouteParameterConfiguration;
|
2451
|
-
}
|
2452
|
-
|
2453
|
-
return qps;
|
2454
|
-
}
|
2455
|
-
|
2456
|
-
function addQueryParamsObservers(controller, propNames) {
|
2457
|
-
propNames.forEach(prop => {
|
2458
|
-
controller.addObserver(`${prop}.[]`, controller, controller._qpChanged);
|
2459
|
-
});
|
2460
|
-
}
|
2461
|
-
|
2462
|
-
function getEngineRouteName(engine, routeName) {
|
2463
|
-
if (engine.routable) {
|
2464
|
-
let prefix = engine.mountPoint;
|
2465
|
-
|
2466
|
-
if (routeName === 'application') {
|
2467
|
-
return prefix;
|
2468
|
-
} else {
|
2469
|
-
return `${prefix}.${routeName}`;
|
2470
|
-
}
|
2471
|
-
}
|
2472
|
-
|
2473
|
-
return routeName;
|
2474
|
-
}
|
2475
|
-
|
2476
|
-
export default Route;
|