This commit is contained in:
Sven Fuchs 2012-07-07 18:17:38 +02:00
parent 1150a5f703
commit 54b140d91b
17 changed files with 447 additions and 401 deletions

View File

@ -2,6 +2,17 @@ require 'helpers'
require 'travis/ticker'
Travis.reopen
Controller: Em.Controller.extend
init: ->
for name in Array.prototype.slice.apply(arguments)
name = "#{$.camelize(name, false)}Controller"
klass = Travis[$.camelize(name)] || Em.Controller
this[name] = klass.create(parent: this, namespace: Travis, controllers: this)
connectTop: ->
@connectOutlet(outletName: 'top', controller: @topController, viewClass: Travis.TopView)
@topController.set('tab', @get('name'))
RepositoriesController: Ember.ArrayController.extend
# sortProperties: ['sortOrder']
# sortAscending: false
@ -19,7 +30,6 @@ Travis.reopen
# TopController: Em.Controller.extend
# userBinding: 'Travis.app.currentUser'
require 'controllers/base'
require 'controllers/home'
require 'controllers/profile'
require 'controllers/repository'

View File

@ -1,11 +0,0 @@
Travis.Controller = Em.Controller.extend
init: ->
for name in Array.prototype.slice.apply(arguments)
name = "#{$.camelize(name, false)}Controller"
klass = Travis[$.camelize(name)] || Em.Controller
this[name] = klass.create(parent: this, namespace: Travis, controllers: this)
connectTop: ->
@connectOutlet(outletName: 'top', controller: @topController, viewClass: Travis.TopView)
@topController.set('tab', @get('name'))

View File

@ -1,43 +1,45 @@
Travis.RepositoryController = Travis.Controller.extend
bindings: []
params: {}
init: ->
@_super('builds', 'build', 'job')
activate: (action, params) ->
@_unbind()
@setParams(params)
# console.log "view#{$.camelize(action)}"
this["view#{$.camelize(action)}"]()
@set('params', params)
viewIndex: ->
@connectTab('current')
@_bind('repository', 'controllers.repositoriesController.firstObject')
@_bind('build', 'repository.lastBuild')
@connectTab('current')
viewCurrent: ->
@connectTab('current')
@_bind('repository', 'repositoriesByParams.firstObject')
@_bind('build', 'repository.lastBuild')
@connectTab('current')
viewBuilds: ->
@connectTab('builds')
@_bind('repository', 'repositoriesByParams.firstObject')
@_bind('builds', 'repository.builds')
@connectTab('builds')
viewBuild: ->
@connectTab('build')
@_bind('repository', 'repositoriesByParams.firstObject')
@_bind('build', 'buildById')
@connectTab('build')
viewJob: ->
@connectTab('job')
@_bind('repository', 'repositoriesByParams.firstObject')
@_bind('build', 'job.build')
@_bind('job', 'jobById')
@connectTab('job')
repositoriesByParams: (->
Travis.Repository.bySlug("#{params.owner}/#{params.name}") if params = @get('params')
).property('params')
Travis.Repository.bySlug("#{@getPath('params.owner')}/#{@getPath('params.name')}")
).property('params.owner', 'params.name')
buildById: (->
Travis.Build.find(id) if id = @getPath('params.id')
@ -48,9 +50,14 @@ Travis.RepositoryController = Travis.Controller.extend
).property('params.id')
connectTab: (tab) ->
@set('tab', tab)
name = if tab == 'current' then 'build' else tab
@connectOutlet(outletName: 'pane', controller: this, viewClass: Travis["#{$.camelize(name)}View"])
unless tab == @get('tab')
@set('tab', tab)
name = if tab == 'current' then 'build' else tab
@connectOutlet(outletName: 'pane', controller: this, viewClass: Travis["#{$.camelize(name)}View"])
setParams: (params) ->
# TODO if we just @set('params', params) it will update the repositoriesByParams property
@setPath("params.#{key}", params[key]) for key, value of params
_bind: (to, from) ->
@bindings.push Ember.oneWay(this, to, from)

View File

@ -60,15 +60,13 @@ require 'travis/model'
@find(search: query, orderBy: 'name')
bySlug: (slug) ->
# TODO use filter?
repo = $.detect(@find().toArray(), (repo) -> repo.get('slug') == slug)
if repo then Ember.ArrayProxy.create(content: [repo]) else @find(slug: slug)
@find(slug: slug)
select: (id) ->
@find().forEach (repository) ->
repository.set 'selected', repository.get('id') is id
buildURL: (slug) ->
if slug then slug else 'repositories'
# buildURL: (slug) ->
# if slug then slug else 'repositories'

View File

@ -23,5 +23,5 @@ Travis.Router = Em.Object.extend
action: (name, action, params) ->
# this needs to be a global reference because Em.routes is global
layout = Travis.app.connectLayout(name)
layout.activate(action, params)
layout.activate(action, params || {})
$('body').attr('id', name)

View File

@ -1,8 +1,14 @@
<pre id="log">{{{formatLog log.body}}}</pre>
{{#if log.isLoaded}}
<pre id="log">{{{formatLog log.body}}}</pre>
{{#if sponsor.name}}
<p class="sponsor">
{{t builds.messages.sponsored_by}}
<a {{bindAttr href="sponsor.url"}}>{{sponsor.name}}</a>
</p>
{{#if sponsor.name}}
<p class="sponsor">
{{t builds.messages.sponsored_by}}
<a {{bindAttr href="sponsor.url"}}>{{sponsor.name}}</a>
</p>
{{/if}}
{{else}}
<div id="log" class="loading">
<span>Loading</span>
</div>
{{/if}}

View File

@ -36,5 +36,9 @@
{{view Travis.LogView contextBinding="job"}}}
</div>
{{else}}
<div id="job" class="loading">
<span>Loading</span>
</div>
{{/if}}
{{/with}}

View File

@ -20,5 +20,6 @@ require 'views/build'
require 'views/job'
require 'views/repo'
require 'views/profile'
require 'views/tabs'
require 'views/top'

View File

@ -41,75 +41,3 @@
urlGithubNetwork: (->
Travis.Urls.githubNetwork(@getPath('repository.slug'))
).property('repository.slug'),
TabsView: Em.View.extend
templateName: 'repositories/tabs'
repositoryBinding: 'controller.repository'
buildBinding: 'controller.build'
jobBinding: 'controller.job'
tabBinding: 'controller.tab'
toggleTools: ->
$('#tools .pane').toggle()
# hrm. how to parametrize bindAttr?
classCurrent: (->
'active' if @get('tab') == 'current'
).property('tab')
classBuilds: (->
'active' if @get('tab') == 'builds'
).property('tab')
classBuild: (->
tab = @get('tab')
classes = []
classes.push('active') if tab == 'build'
classes.push('display') if tab == 'build' || tab == 'job'
classes.join(' ')
).property('tab')
classJob: (->
'active display' if @get('tab') == 'job'
).property('tab')
urlRepository: (->
Travis.Urls.repository(@getPath('repository.slug'))
).property('repository.slug')
urlBuilds: (->
Travis.Urls.builds(@getPath('repository.slug'))
).property('repository.slug')
urlBuild: (->
Travis.Urls.build(@getPath('repository.slug'), @getPath('build.id'))
).property('repository.slug', 'build.id')
urlJob: (->
Travis.Urls.job(@getPath('repository.slug'), @getPath('job.id'))
).property('repository.slug', 'job.id')
branches: (->
@getPath('repository.branches')
).property('repository.id')
urlStatusImage: (->
Travis.Urls.statusImage(@getPath('repository.slug'), @getPath('branch.commit.branch'))
).property('repository.slug', 'branch')
markdownStatusImage: (->
"[![Build Status](#{@get('urlStatusImage')})](#{@get('urlRepository')})"
).property('urlStatusImage')
textileStatusImage: (->
"!#{@get('urlStatusImage')}!:#{@get('urlRepository')}"
).property('urlStatusImage')
rdocStatusImage: (->
"{<img src=\"#{@get('urlStatusImage')}\" alt=\"Build Status\" />}[#{@get('urlRepository')}]"
).property('urlStatusImage')

View File

@ -0,0 +1,74 @@
@Travis.reopen
TabsView: Em.View.extend
templateName: 'repositories/tabs'
repositoryBinding: 'controller.repository'
buildBinding: 'controller.build'
jobBinding: 'controller.job'
tabBinding: 'controller.tab'
toggleTools: ->
$('#tools .pane').toggle()
# hrm. how to parametrize bindAttr?
classCurrent: (->
'active' if @get('tab') == 'current'
).property('tab')
classBuilds: (->
'active' if @get('tab') == 'builds'
).property('tab')
classBuild: (->
tab = @get('tab')
classes = []
classes.push('active') if tab == 'build'
classes.push('display') if tab == 'build' || tab == 'job'
classes.join(' ')
).property('tab')
classJob: (->
'active display' if @get('tab') == 'job'
).property('tab')
urlRepository: (->
Travis.Urls.repository(@getPath('repository.slug'))
).property('repository.slug')
urlBuilds: (->
Travis.Urls.builds(@getPath('repository.slug'))
).property('repository.slug')
urlBuild: (->
Travis.Urls.build(@getPath('repository.slug'), @getPath('build.id'))
).property('repository.slug', 'build.id')
urlJob: (->
Travis.Urls.job(@getPath('repository.slug'), @getPath('job.id'))
).property('repository.slug', 'job.id')
branches: (->
@getPath('repository.branches')
).property('repository.id')
urlStatusImage: (->
Travis.Urls.statusImage(@getPath('repository.slug'), @getPath('branch.commit.branch'))
).property('repository.slug', 'branch')
markdownStatusImage: (->
"[![Build Status](#{@get('urlStatusImage')})](#{@get('urlRepository')})"
).property('urlStatusImage')
textileStatusImage: (->
"!#{@get('urlStatusImage')}!:#{@get('urlRepository')}"
).property('urlStatusImage')
rdocStatusImage: (->
"{<img src=\"#{@get('urlStatusImage')}\" alt=\"Build Status\" />}[#{@get('urlRepository')}]"
).property('urlStatusImage')

View File

@ -60,6 +60,7 @@ hooks = [
$.mockjax
url: '/repositories'
data: {}
responseTime: responseTime
responseText: { repositories: repositories }
@ -69,6 +70,12 @@ for repository in repositories
responseTime: responseTime
responseText: { repository: repository }
$.mockjax
url: '/repositories'
data: { slug: repository.slug }
responseTime: responseTime
responseText: { repositories: [repository] }
for build in builds
$.mockjax
url: '/builds/' + build.id

View File

@ -136,8 +136,8 @@ window.ember_deprecateFunc = Ember.deprecateFunc("ember_deprecateFunc is deprec
})();
// Version: v0.9.8.1-468-g3097ea8
// Last commit: 3097ea8 (2012-07-04 14:42:40 -0700)
// Version: v0.9.8.1-484-g73ac0a4
// Last commit: 73ac0a4 (2012-07-06 11:52:32 -0700)
(function() {
@ -944,7 +944,7 @@ Ember.isArray = function(obj) {
Ember.makeArray(); => []
Ember.makeArray(null); => []
Ember.makeArray(undefined); => []
Ember.makeArray('lindsay'); => ['lindsay']
Ember.makeArray('lindsay'); => ['lindsay']
Ember.makeArray([1,2,42]); => [1,2,42]
var controller = Ember.ArrayProxy.create({ content: [] });
@ -3642,7 +3642,7 @@ Ember.RunLoop = RunLoop;
call.
Ember.run(function(){
// code to be execute within a RunLoop
// code to be execute within a RunLoop
});
@name run
@ -3680,7 +3680,7 @@ var run = Ember.run;
an lower-level way to use a RunLoop instead of using Ember.run().
Ember.run.begin();
// code to be execute within a RunLoop
// code to be execute within a RunLoop
Ember.run.end();
@ -3696,7 +3696,7 @@ Ember.run.begin = function() {
instead of using Ember.run().
Ember.run.begin();
// code to be execute within a RunLoop
// code to be execute within a RunLoop
Ember.run.end();
@returns {void}
@ -5444,7 +5444,7 @@ Ember.inspect = function(obj) {
/**
Compares two objects, returning true if they are logically equal. This is
a deeper comparison than a simple triple equal. For sets it will compare the
internal objects. For any other object that implements `isEqual()` it will
internal objects. For any other object that implements `isEqual()` it will
respect that method.
Ember.isEqual('hello', 'hello'); => true
@ -5626,7 +5626,7 @@ Ember.String = {
> beta
> gamma
@param {String} str
@param {String} str
The string to split
@returns {String} split string
@ -5635,7 +5635,7 @@ Ember.String = {
/**
Converts a camelized string into all lower case separated by underscores.
'innerHTML'.decamelize() => 'inner_html'
'action_name'.decamelize() => 'action_name'
'css-class-name'.decamelize() => 'css-class-name'
@ -5652,7 +5652,7 @@ Ember.String = {
/**
Replaces underscores or spaces with dashes.
'innerHTML'.dasherize() => 'inner-html'
'action_name'.dasherize() => 'action-name'
'css-class-name'.dasherize() => 'css-class-name'
@ -5819,7 +5819,7 @@ if (Ember.EXTEND_PROTOTYPES) {
/**
The `property` extension of Javascript's Function prototype is available
when Ember.EXTEND_PROTOTYPES is true, which is the default.
when Ember.EXTEND_PROTOTYPES is true, which is the default.
Computed properties allow you to treat a function like a property:
@ -5874,7 +5874,7 @@ if (Ember.EXTEND_PROTOTYPES) {
/**
The `observes` extension of Javascript's Function prototype is available
when Ember.EXTEND_PROTOTYPES is true, which is the default.
when Ember.EXTEND_PROTOTYPES is true, which is the default.
You can observe property changes simply by adding the `observes`
call to the end of your method declarations in classes that you write.
@ -5885,7 +5885,7 @@ if (Ember.EXTEND_PROTOTYPES) {
// Executes whenever the "value" property changes
}.observes('value')
});
@see Ember.Observable
*/
Function.prototype.observes = function() {
@ -5895,7 +5895,7 @@ if (Ember.EXTEND_PROTOTYPES) {
/**
The `observesBefore` extension of Javascript's Function prototype is
available when Ember.EXTEND_PROTOTYPES is true, which is the default.
available when Ember.EXTEND_PROTOTYPES is true, which is the default.
You can get notified when a property changes is about to happen by
by adding the `observesBefore` call to the end of your method
@ -5906,7 +5906,7 @@ if (Ember.EXTEND_PROTOTYPES) {
// Executes whenever the "value" property is about to change
}.observesBefore('value')
});
@see Ember.Observable
*/
Function.prototype.observesBefore = function() {
@ -6505,9 +6505,9 @@ Ember.Enumerable = Ember.Mixin.create(
/**
Returns a copy of the array with all null elements removed.
var arr = ["a", null, "c", null];
arr.compact(); => ["a", "c"]
arr.compact(); => ["a", "c"]
@returns {Array} the array without null elements.
*/
@ -7510,7 +7510,7 @@ Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,
colors.clear(); => []
colors.length(); => 0
@returns {Ember.Array} An empty Array.
@returns {Ember.Array} An empty Array.
*/
clear: function () {
var len = get(this, 'length');
@ -7704,15 +7704,15 @@ var get = Ember.get, set = Ember.set;
@class
## Overview
This mixin provides properties and property observing functionality, core
features of the Ember object model.
Properties and observers allow one object to observe changes to a
property on another object. This is one of the fundamental ways that
models, controllers and views communicate with each other in an Ember
application.
Any object that has this mixin applied can be used in observer
operations. That includes Ember.Object and most objects you will
interact with as you write your Ember application.
@ -7720,16 +7720,16 @@ var get = Ember.get, set = Ember.set;
Note that you will not generally apply this mixin to classes yourself,
but you will use the features provided by this module frequently, so it
is important to understand how to use it.
## Using get() and set()
Because of Ember's support for bindings and observers, you will always
access properties using the get method, and set properties using the
set method. This allows the observing objects to be notified and
computed properties to be handled properly.
More documentation about `get` and `set` are below.
## Observing Property Changes
You typically observe property changes simply by adding the `observes`
@ -7741,7 +7741,7 @@ var get = Ember.get, set = Ember.set;
// Executes whenever the "value" property changes
}.observes('value')
});
Although this is the most common way to add an observer, this capability
is actually built into the Ember.Object class on top of two methods
defined in this mixin: `addObserver` and `removeObserver`. You can use
@ -7754,12 +7754,12 @@ var get = Ember.get, set = Ember.set;
This will call the `targetAction` method on the `targetObject` to be called
whenever the value of the `propertyKey` changes.
Note that if `propertyKey` is a computed property, the observer will be
called when any of the property dependencies are changed, even if the
Note that if `propertyKey` is a computed property, the observer will be
called when any of the property dependencies are changed, even if the
resulting value of the computed property is unchanged. This is necessary
because computed properties are not computed until `get` is called.
@extends Ember.Mixin
*/
Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
@ -7773,7 +7773,7 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
This method is usually similar to using object[keyName] or object.keyName,
however it supports both computed properties and the unknownProperty
handler.
Because `get` unifies the syntax for accessing all these kinds
of properties, it can make many refactorings easier, such as replacing a
simple property with a computed property, or vice versa.
@ -7969,11 +7969,11 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
Ember.propertyDidChange(this, keyName);
return this;
},
/**
Convenience method to call `propertyWillChange` and `propertyDidChange` in
succession.
@param {String} keyName The property key to be notified about.
@returns {Ember.Observable}
*/
@ -8065,7 +8065,7 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
This method will be called when a client attempts to get the value of a
property that has not been defined in one of the typical ways. Override
this method to create "virtual" properties.
@param {String} key The name of the unknown property that was requested.
@returns {Object} The property value or undefined. Default is undefined.
*/
@ -8077,7 +8077,7 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
This method will be called when a client attempts to set the value of a
property that has not been defined in one of the typical ways. Override
this method to create "virtual" properties.
@param {String} key The name of the unknown property to be set.
@param {Object} value The value the unknown property is to be set to.
*/
@ -8088,7 +8088,7 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
/**
This is like `get`, but allows you to pass in a dot-separated property
path.
person.getPath('address.zip'); // return the zip
person.getPath('children.firstObject.age'); // return the first kid's age
@ -8104,7 +8104,7 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
/**
This is like `set`, but allows you to specify the property you want to
set as a dot-separated property path.
person.setPath('address.zip', 10011); // set the zip to 10011
person.setPath('children.firstObject.age', 6); // set the first kid's age to 6
@ -8122,9 +8122,9 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
/**
Retrieves the value of a property, or a default value in the case that the property
returns undefined.
person.getWithDefault('lastName', 'Doe');
@param {String} keyName The name of the property to retrieve
@param {Object} defaultValue The value to return if the property value is undefined
@returns {Object} The property value or the defaultValue.
@ -8135,10 +8135,10 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
/**
Set the value of a property to the current value plus some amount.
person.incrementProperty('age');
team.incrementProperty('score', 2);
@param {String} keyName The name of the property to increment
@param {Object} increment The amount to increment by. Defaults to 1
@returns {Object} The new property value
@ -8148,13 +8148,13 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
set(this, keyName, (get(this, keyName) || 0)+increment);
return get(this, keyName);
},
/**
Set the value of a property to the current value minus some amount.
player.decrementProperty('lives');
orc.decrementProperty('health', 5);
@param {String} keyName The name of the property to decrement
@param {Object} increment The amount to decrement by. Defaults to 1
@returns {Object} The new property value
@ -8168,9 +8168,9 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
/**
Set the value of a boolean property to the opposite of it's
current value.
starship.toggleProperty('warpDriveEnaged');
@param {String} keyName The name of the property to toggle
@returns {Object} The new property value
*/
@ -9292,6 +9292,8 @@ Ember.ArrayProxy = Ember.Object.extend(Ember.MutableArray,
var content = get(this, 'content'),
len = content ? get(content, 'length') : 0;
Ember.assert("Can't set ArrayProxy's content to itself", content !== this);
if (content) {
content.addArrayObserver(this, {
willChange: 'contentArrayWillChange',
@ -9318,6 +9320,8 @@ Ember.ArrayProxy = Ember.Object.extend(Ember.MutableArray,
var arrangedContent = get(this, 'arrangedContent'),
len = arrangedContent ? get(arrangedContent, 'length') : 0;
Ember.assert("Can't set ArrayProxy's content to itself", arrangedContent !== this);
if (arrangedContent) {
arrangedContent.addArrayObserver(this, {
willChange: 'arrangedContentArrayWillChange',
@ -9516,6 +9520,10 @@ Ember.ObjectProxy = Ember.Object.extend(
*/
content: null,
/** @private */
_contentDidChange: Ember.observer(function() {
Ember.assert("Can't set ObjectProxy's content to itself", this.get('content') !== this);
}, 'content'),
/** @private */
delegateGet: function (key) {
var content = get(this, 'content');
if (content) {
@ -10540,7 +10548,6 @@ var get = Ember.get, set = Ember.set;
Ember.HashLocation = Ember.Object.extend({
init: function() {
set(this, 'location', get(this, 'location') || window.location);
set(this, 'callbacks', Ember.A());
},
/**
@ -10573,22 +10580,16 @@ Ember.HashLocation = Ember.Object.extend({
*/
onUpdateURL: function(callback) {
var self = this;
var guid = Ember.guidFor(this);
var hashchange = function() {
Ember.$(window).bind('hashchange.ember-location-'+guid, function() {
var path = location.hash.substr(1);
if (get(self, 'lastSetURL') === path) { return; }
set(self, 'lastSetURL', null);
callback(location.hash.substr(1));
};
get(this, 'callbacks').pushObject(hashchange);
// This won't work on old browsers anyway, but this check prevents errors
if (window.addEventListener) {
window.addEventListener('hashchange', hashchange, false);
}
});
},
/**
@ -10605,10 +10606,9 @@ Ember.HashLocation = Ember.Object.extend({
},
willDestroy: function() {
get(this, 'callbacks').forEach(function(callback) {
window.removeEventListener('hashchange', callback, false);
});
set(this, 'callbacks', null);
var guid = Ember.guidFor(this);
Ember.$(window).unbind('hashchange.ember-location-'+guid);
}
});
@ -10629,7 +10629,6 @@ Ember.HistoryLocation = Ember.Object.extend({
init: function() {
set(this, 'location', get(this, 'location') || window.location);
set(this, '_initialURL', get(this, 'location').pathname);
set(this, 'callbacks', Ember.A());
},
/**
@ -10672,18 +10671,11 @@ Ember.HistoryLocation = Ember.Object.extend({
history changes, including using forward and back buttons.
*/
onUpdateURL: function(callback) {
var self = this;
var guid = Ember.guidFor(this);
var popstate = function(e) {
Ember.$(window).bind('popstate.ember-location-'+guid, function(e) {
callback(location.pathname);
};
get(this, 'callbacks').pushObject(popstate);
// This won't work on old browsers anyway, but this check prevents errors
if (window.addEventListener) {
window.addEventListener('popstate', popstate, false);
}
});
},
/**
@ -10697,10 +10689,9 @@ Ember.HistoryLocation = Ember.Object.extend({
},
willDestroy: function() {
get(this, 'callbacks').forEach(function(callback) {
window.removeEventListener('popstate', callback, false);
});
set(this, 'callbacks', null);
var guid = Ember.guidFor(this);
Ember.$(window).unbind('popstate.ember-location-'+guid);
}
});
@ -11520,6 +11511,8 @@ Ember.ControllerMixin.reopen({
var viewClassName = name.charAt(0).toUpperCase() + name.substr(1) + "View";
viewClass = get(namespace, viewClassName);
controller = get(controllers, name + 'Controller');
Ember.assert("The name you supplied " + name + " did not resolve to a view " + viewClassName, !!viewClass);
Ember.assert("The name you supplied " + name + " did not resolve to a controller " + name + 'Controller', (!!controller && !!context) || !context);
}
@ -11578,17 +11571,6 @@ var childViewsProperty = Ember.computed(function() {
return ret;
}).property().cacheable();
var controllerProperty = Ember.computed(function(key, value) {
var parentView;
if (arguments.length === 2) {
return value;
} else {
parentView = get(this, 'parentView');
return parentView ? get(parentView, 'controller') : null;
}
}).property().cacheable();
var VIEW_PRESERVES_CONTEXT = Ember.VIEW_PRESERVES_CONTEXT;
Ember.warn("The way that the {{view}} helper affects templates is about to change. Previously, templates inside child views would use the new view as the context. Soon, views will preserve their parent context when rendering their template. You can opt-in early to the new behavior by setting `ENV.VIEW_PRESERVES_CONTEXT = true`. For more information, see https://gist.github.com/2494968. You should update your templates as soon as possible; this default will change soon, and the option will be eliminated entirely before the 1.0 release.", VIEW_PRESERVES_CONTEXT);
@ -11617,7 +11599,7 @@ var invokeForState = {
`Ember.View` is the class in Ember responsible for encapsulating templates of HTML
content, combining templates with data to render as sections of a page's DOM, and
registering and responding to user-initiated events.
## HTML Tag
The default HTML tag name used for a view's DOM representation is `div`. This can be
customized by setting the `tagName` property. The following view class:
@ -11643,7 +11625,7 @@ var invokeForState = {
<div id="ember1" class="ember-view my-class my-other-class"></div>
`class` attribute values can also be set by providing a `classNameBindings` property
set to an array of properties names for the view. The return value of these properties
set to an array of properties names for the view. The return value of these properties
will be added as part of the value for the view's `class` attribute. These properties
can be computed properties:
@ -11672,7 +11654,7 @@ var invokeForState = {
<div id="ember1" class="ember-view hovered"></div>
When using boolean class name bindings you can supply a string value other than the
When using boolean class name bindings you can supply a string value other than the
property name for use as the `class` HTML attribute by appending the preferred value after
a ":" character when defining the binding:
@ -11713,11 +11695,11 @@ var invokeForState = {
<div id="ember1" class="ember-view empty"></div>
Updates to the the value of a class name binding will result in automatic update
Updates to the the value of a class name binding will result in automatic update
of the HTML `class` attribute in the view's rendered HTML representation.
If the value becomes `false` or `undefined` the class name will be removed.
Both `classNames` and `classNameBindings` are concatenated properties.
Both `classNames` and `classNameBindings` are concatenated properties.
See `Ember.Object` documentation for more information about concatenated properties.
## HTML Attributes
@ -11763,7 +11745,7 @@ var invokeForState = {
}.property()
})
Updates to the the property of an attribute binding will result in automatic update
Updates to the the property of an attribute binding will result in automatic update
of the HTML attribute in the view's rendered HTML representation.
`attributeBindings` is a concatenated property. See `Ember.Object` documentation
@ -11854,7 +11836,7 @@ var invokeForState = {
primary templates, layouts can be any function that accepts an optional context
parameter and returns a string of HTML that will be inserted inside view's tag. Views whose HTML
element is self closing (e.g. `<input />`) cannot have a layout and this property will be ignored.
Most typically in Ember a layout will be a compiled Ember.Handlebars template.
A view's layout can be set directly with the `layout` property or reference an
@ -11879,7 +11861,7 @@ var invokeForState = {
See `Handlebars.helpers.yield` for more information.
## Responding to Browser Events
Views can respond to user-initiated events in one of three ways: method implementation,
Views can respond to user-initiated events in one of three ways: method implementation,
through an event manager, and through `{{action}}` helper use in their template or layout.
### Method Implementation
@ -11896,8 +11878,8 @@ var invokeForState = {
### Event Managers
Views can define an object as their `eventManager` property. This object can then
implement methods that match the desired event names. Matching events that occur
on the view's rendered HTML or the rendered HTML of any of its DOM descendants
will trigger this method. A `jQuery.Event` object will be passed as the first
on the view's rendered HTML or the rendered HTML of any of its DOM descendants
will trigger this method. A `jQuery.Event` object will be passed as the first
argument to the method and an `Ember.View` object as the second. The `Ember.View`
will be the view whose rendered HTML was interacted with. This may be the view with
the `eventManager` property or one of its descendent views.
@ -11931,7 +11913,7 @@ var invokeForState = {
Similarly a view's event manager will take precedence for events of any views
rendered as a descendent. A method name that matches an event name will not be called
if the view instance was rendered inside the HTML representation of a view that has
if the view instance was rendered inside the HTML representation of a view that has
an `eventManager` property defined that handles events of the name. Events not handled
by the event manager will still trigger method calls on the descendent.
@ -11953,7 +11935,7 @@ var invokeForState = {
// eventManager doesn't handle click events
},
mouseEnter: function(event){
// will never be called if rendered inside
// will never be called if rendered inside
// an OuterView.
}
})
@ -11974,7 +11956,7 @@ var invokeForState = {
Form events: 'submit', 'change', 'focusIn', 'focusOut', 'input'
HTML5 drag and drop events: 'dragStart', 'drag', 'dragEnter', 'dragLeave', 'drop', 'dragEnd'
## Handlebars `{{view}}` Helper
Other `Ember.View` instances can be included as part of a view's template by using the `{{view}}`
Handlebars helper. See `Handlebars.helpers.view` for additional information.
@ -12057,7 +12039,17 @@ Ember.View = Ember.Object.extend(Ember.Evented,
@type Object
*/
controller: controllerProperty,
controller: Ember.computed(function(key, value) {
var parentView;
if (arguments.length === 2) {
return value;
} else {
parentView = get(this, 'parentView');
return parentView ? get(parentView, 'controller') : null;
}
}).property().cacheable(),
/**
A view may contain a layout. A layout is a regular template but
supersedes the `template` property during rendering. It is the
@ -12122,22 +12114,20 @@ Ember.View = Ember.Object.extend(Ember.Evented,
to be re-rendered.
*/
_context: Ember.computed(function(key, value) {
var parentView, context;
var parentView, controller;
if (arguments.length === 2) {
return value;
}
if (VIEW_PRESERVES_CONTEXT) {
if (Ember.meta(this).descs.controller !== controllerProperty) {
if (context = get(this, 'controller')) {
return context;
}
if (controller = get(this, 'controller')) {
return controller;
}
parentView = get(this, '_parentView');
if (parentView && (context = get(parentView, '_context'))) {
return context;
if (parentView) {
return get(parentView, '_context');
}
}
@ -14344,7 +14334,7 @@ var get = Ember.get, set = Ember.set, fmt = Ember.String.fmt;
@class
`Ember.CollectionView` is an `Ember.View` descendent responsible for managing a
collection (an array or array-like object) by maintaing a child view object and
collection (an array or array-like object) by maintaing a child view object and
associated DOM representation for each item in the array and ensuring that child
views and their associated rendered HTML are updated when items in the array
are added, removed, or replaced.
@ -14388,7 +14378,7 @@ var get = Ember.get, set = Ember.set, fmt = Ember.String.fmt;
## Automatic matching of parent/child tagNames
Setting the `tagName` property of a `CollectionView` to any of
Setting the `tagName` property of a `CollectionView` to any of
"ul", "ol", "table", "thead", "tbody", "tfoot", "tr", or "select" will result
in the item views receiving an appropriately matched `tagName` property.
@ -15241,15 +15231,15 @@ var arrayForEach = Ember.ArrayPolyfills.forEach;
robotManager.getPath('currentState.name') // 'rampaging'
Transition actions can also be created using the `transitionTo` method of the Ember.State class. The
following example StateManagers are equivalent:
following example StateManagers are equivalent:
aManager = Ember.StateManager.create({
stateOne: Ember.State.create({
changeToStateTwo: Ember.State.transitionTo('stateTwo')
}),
stateTwo: Ember.State.create({})
})
bManager = Ember.StateManager.create({
stateOne: Ember.State.create({
changeToStateTwo: function(manager, context){
@ -15330,7 +15320,7 @@ Ember.StateManager = Ember.State.extend(
@default true
*/
errorOnUnhandledEvent: true,
send: function(event, context) {
Ember.assert('Cannot send event "' + event + '" while currentState is ' + get(this, 'currentState'), get(this, 'currentState'));
return this.sendRecursively(event, get(this, 'currentState'), context);
@ -16539,6 +16529,7 @@ Ember.StateManager.reopen(
view;
while (currentState) {
// TODO: Remove this when view state is removed
if (get(currentState, 'isViewState')) {
view = get(currentState, 'view');
if (view) { return view; }
@ -18409,7 +18400,7 @@ EmberHandlebars.ViewHelper = Ember.Object.create({
Will result in HTML structure:
<body>
<!-- Note: the handlebars template script
<!-- Note: the handlebars template script
also results in a rendered Ember.View
which is the outer <div> here -->
@ -18431,7 +18422,7 @@ EmberHandlebars.ViewHelper = Ember.Object.create({
})
aView.appendTo('body')
Will result in HTML structure:
<div id="ember1" class="ember-view">
@ -18505,7 +18496,7 @@ EmberHandlebars.ViewHelper = Ember.Object.create({
Will result in the following HTML:
<div id="ember1" class="ember-view">
<div id="ember2" class="ember-view a-custom-view-class-as-property">
<div id="ember2" class="ember-view a-custom-view-class-as-property">
hi
</div>
</div>
@ -18665,7 +18656,7 @@ var get = Ember.get, getPath = Ember.Handlebars.getPath, fmt = Ember.String.fmt;
<p class="ember-view greeting">Howdy Mary</p>
<p class="ember-view greeting">Howdy Sara</p>
</div>
@name Handlebars.helpers.collection
@param {String} path
@param {Hash} options
@ -18950,6 +18941,7 @@ ActionHelper.registerAction = function(actionName, eventName, target, view, cont
if (target.isState && typeof target.send === 'function') {
return target.send(actionName, event);
} else {
Ember.assert(Ember.String.fmt('Target %@ does not have action %@', [target, actionName]), target[actionName]);
return target[actionName].call(target, event);
}
}
@ -19279,7 +19271,7 @@ var set = Ember.set, get = Ember.get;
/**
@class
Creates an HTML input of type 'checkbox' with HTML related properties
Creates an HTML input of type 'checkbox' with HTML related properties
applied directly to the input.
{{view Ember.Checkbox classNames="applicaton-specific-checkbox"}}
@ -19298,7 +19290,7 @@ var set = Ember.set, get = Ember.get;
through the Ember object or by interacting with its rendered element representation
via the mouse, keyboard, or touch. Updating the value of the checkbox via jQuery will
result in the checked value of the object and its element losing synchronization.
## Layout and LayoutName properties
Because HTML `input` elements are self closing `layout` and `layoutName` properties will
not be applied. See `Ember.View`'s layout section for more information.
@ -19410,7 +19402,7 @@ var get = Ember.get, set = Ember.set;
## Layout and LayoutName properties
Because HTML `input` elements are self closing `layout` and `layoutName` properties will
not be applied. See `Ember.View`'s layout section for more information.
@extends Ember.TextSupport
*/
Ember.TextField = Ember.View.extend(Ember.TextSupport,
@ -19587,7 +19579,7 @@ var get = Ember.get, set = Ember.set;
## Layout and LayoutName properties
Because HTML `textarea` elements do not contain inner HTML the `layout` and `layoutName`
Because HTML `textarea` elements do not contain inner HTML the `layout` and `layoutName`
properties will not be applied. See `Ember.View`'s layout section for more information.
@extends Ember.TextSupport
@ -19618,7 +19610,12 @@ Ember.TextArea = Ember.View.extend(Ember.TextSupport,
(function() {
Ember.TabContainerView = Ember.View.extend();
Ember.TabContainerView = Ember.View.extend({
init: function() {
Ember.deprecate("Ember.TabContainerView is deprecated and will be removed from future releases.");
this._super();
}
});
})();
@ -19634,7 +19631,12 @@ Ember.TabPaneView = Ember.View.extend({
isVisible: Ember.computed(function() {
return get(this, 'viewName') === getPath(this, 'tabsContainer.currentView');
}).property('tabsContainer.currentView').volatile()
}).property('tabsContainer.currentView').volatile(),
init: function() {
Ember.deprecate("Ember.TabPaneView is deprecated and will be removed from future releases.");
this._super();
}
});
})();
@ -19651,6 +19653,11 @@ Ember.TabView = Ember.View.extend({
mouseUp: function() {
setPath(this, 'tabsContainer.currentView', get(this, 'value'));
},
init: function() {
Ember.deprecate("Ember.TabView is deprecated and will be removed from future releases.");
this._super();
}
});
@ -20057,7 +20064,7 @@ Ember.Handlebars.bootstrap = function(ctx) {
// id if no name is found.
templateName = script.attr('data-template-name') || script.attr('id'),
template = compile(script.html()),
view, viewPath, elementId, tagName, options;
view, viewPath, elementId, options;
if (templateName) {
// For templates which have a name, we save them and then remove them from the DOM
@ -20086,13 +20093,8 @@ Ember.Handlebars.bootstrap = function(ctx) {
// Look for data-element-id attribute.
elementId = script.attr('data-element-id');
// Users can optionally specify a custom tag name to use by setting the
// data-tag-name attribute on the script tag.
tagName = script.attr('data-tag-name');
options = { template: template };
if (elementId) { options.elementId = elementId; }
if (tagName) { options.tagName = tagName; }
view = view.create(options);
@ -20125,8 +20127,8 @@ Ember.$(document).ready(
})();
// Version: v0.9.8.1-468-g3097ea8
// Last commit: 3097ea8 (2012-07-04 14:42:40 -0700)
// Version: v0.9.8.1-484-g73ac0a4
// Last commit: 73ac0a4 (2012-07-06 11:52:32 -0700)
(function() {

View File

@ -130,7 +130,13 @@
function logMock( mockHandler, requestSettings ) {
var c = $.extend({}, $.mockjaxSettings, mockHandler);
if ( c.log && $.isFunction(c.log) ) {
c.log('MOCK ' + requestSettings.type.toUpperCase() + ': ' + requestSettings.url, $.extend({}, requestSettings));
var url = requestSettings.url
if(requestSettings.data) {
params = []
for(key in requestSettings.data) params.push(key + '=' + requestSettings.data[key])
url = url + '?' + params.join('&')
}
c.log('MOCK ' + requestSettings.type.toUpperCase() + ': ' + url, $.extend({}, requestSettings));
}
}

View File

@ -5,7 +5,7 @@
font-size: 13px
color: #999
#log
pre#log
clear: left
white-space: pre-wrap
word-wrap: break-word
@ -82,6 +82,7 @@
.bg-white
background-color: white
#log.loading
padding: 25px 0 0 10px

File diff suppressed because one or more lines are too long

View File

@ -2090,8 +2090,8 @@ window.ember_deprecateFunc = Ember.deprecateFunc("ember_deprecateFunc is deprec
})();
// Version: v0.9.8.1-468-g3097ea8
// Last commit: 3097ea8 (2012-07-04 14:42:40 -0700)
// Version: v0.9.8.1-484-g73ac0a4
// Last commit: 73ac0a4 (2012-07-06 11:52:32 -0700)
(function() {
@ -2898,7 +2898,7 @@ Ember.isArray = function(obj) {
Ember.makeArray(); => []
Ember.makeArray(null); => []
Ember.makeArray(undefined); => []
Ember.makeArray('lindsay'); => ['lindsay']
Ember.makeArray('lindsay'); => ['lindsay']
Ember.makeArray([1,2,42]); => [1,2,42]
var controller = Ember.ArrayProxy.create({ content: [] });
@ -5596,7 +5596,7 @@ Ember.RunLoop = RunLoop;
call.
Ember.run(function(){
// code to be execute within a RunLoop
// code to be execute within a RunLoop
});
@name run
@ -5634,7 +5634,7 @@ var run = Ember.run;
an lower-level way to use a RunLoop instead of using Ember.run().
Ember.run.begin();
// code to be execute within a RunLoop
// code to be execute within a RunLoop
Ember.run.end();
@ -5650,7 +5650,7 @@ Ember.run.begin = function() {
instead of using Ember.run().
Ember.run.begin();
// code to be execute within a RunLoop
// code to be execute within a RunLoop
Ember.run.end();
@returns {void}
@ -7398,7 +7398,7 @@ Ember.inspect = function(obj) {
/**
Compares two objects, returning true if they are logically equal. This is
a deeper comparison than a simple triple equal. For sets it will compare the
internal objects. For any other object that implements `isEqual()` it will
internal objects. For any other object that implements `isEqual()` it will
respect that method.
Ember.isEqual('hello', 'hello'); => true
@ -7580,7 +7580,7 @@ Ember.String = {
> beta
> gamma
@param {String} str
@param {String} str
The string to split
@returns {String} split string
@ -7589,7 +7589,7 @@ Ember.String = {
/**
Converts a camelized string into all lower case separated by underscores.
'innerHTML'.decamelize() => 'inner_html'
'action_name'.decamelize() => 'action_name'
'css-class-name'.decamelize() => 'css-class-name'
@ -7606,7 +7606,7 @@ Ember.String = {
/**
Replaces underscores or spaces with dashes.
'innerHTML'.dasherize() => 'inner-html'
'action_name'.dasherize() => 'action-name'
'css-class-name'.dasherize() => 'css-class-name'
@ -7773,7 +7773,7 @@ if (Ember.EXTEND_PROTOTYPES) {
/**
The `property` extension of Javascript's Function prototype is available
when Ember.EXTEND_PROTOTYPES is true, which is the default.
when Ember.EXTEND_PROTOTYPES is true, which is the default.
Computed properties allow you to treat a function like a property:
@ -7828,7 +7828,7 @@ if (Ember.EXTEND_PROTOTYPES) {
/**
The `observes` extension of Javascript's Function prototype is available
when Ember.EXTEND_PROTOTYPES is true, which is the default.
when Ember.EXTEND_PROTOTYPES is true, which is the default.
You can observe property changes simply by adding the `observes`
call to the end of your method declarations in classes that you write.
@ -7839,7 +7839,7 @@ if (Ember.EXTEND_PROTOTYPES) {
// Executes whenever the "value" property changes
}.observes('value')
});
@see Ember.Observable
*/
Function.prototype.observes = function() {
@ -7849,7 +7849,7 @@ if (Ember.EXTEND_PROTOTYPES) {
/**
The `observesBefore` extension of Javascript's Function prototype is
available when Ember.EXTEND_PROTOTYPES is true, which is the default.
available when Ember.EXTEND_PROTOTYPES is true, which is the default.
You can get notified when a property changes is about to happen by
by adding the `observesBefore` call to the end of your method
@ -7860,7 +7860,7 @@ if (Ember.EXTEND_PROTOTYPES) {
// Executes whenever the "value" property is about to change
}.observesBefore('value')
});
@see Ember.Observable
*/
Function.prototype.observesBefore = function() {
@ -8459,9 +8459,9 @@ Ember.Enumerable = Ember.Mixin.create(
/**
Returns a copy of the array with all null elements removed.
var arr = ["a", null, "c", null];
arr.compact(); => ["a", "c"]
arr.compact(); => ["a", "c"]
@returns {Array} the array without null elements.
*/
@ -9464,7 +9464,7 @@ Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,
colors.clear(); => []
colors.length(); => 0
@returns {Ember.Array} An empty Array.
@returns {Ember.Array} An empty Array.
*/
clear: function () {
var len = get(this, 'length');
@ -9658,15 +9658,15 @@ var get = Ember.get, set = Ember.set;
@class
## Overview
This mixin provides properties and property observing functionality, core
features of the Ember object model.
Properties and observers allow one object to observe changes to a
property on another object. This is one of the fundamental ways that
models, controllers and views communicate with each other in an Ember
application.
Any object that has this mixin applied can be used in observer
operations. That includes Ember.Object and most objects you will
interact with as you write your Ember application.
@ -9674,16 +9674,16 @@ var get = Ember.get, set = Ember.set;
Note that you will not generally apply this mixin to classes yourself,
but you will use the features provided by this module frequently, so it
is important to understand how to use it.
## Using get() and set()
Because of Ember's support for bindings and observers, you will always
access properties using the get method, and set properties using the
set method. This allows the observing objects to be notified and
computed properties to be handled properly.
More documentation about `get` and `set` are below.
## Observing Property Changes
You typically observe property changes simply by adding the `observes`
@ -9695,7 +9695,7 @@ var get = Ember.get, set = Ember.set;
// Executes whenever the "value" property changes
}.observes('value')
});
Although this is the most common way to add an observer, this capability
is actually built into the Ember.Object class on top of two methods
defined in this mixin: `addObserver` and `removeObserver`. You can use
@ -9708,12 +9708,12 @@ var get = Ember.get, set = Ember.set;
This will call the `targetAction` method on the `targetObject` to be called
whenever the value of the `propertyKey` changes.
Note that if `propertyKey` is a computed property, the observer will be
called when any of the property dependencies are changed, even if the
Note that if `propertyKey` is a computed property, the observer will be
called when any of the property dependencies are changed, even if the
resulting value of the computed property is unchanged. This is necessary
because computed properties are not computed until `get` is called.
@extends Ember.Mixin
*/
Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
@ -9727,7 +9727,7 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
This method is usually similar to using object[keyName] or object.keyName,
however it supports both computed properties and the unknownProperty
handler.
Because `get` unifies the syntax for accessing all these kinds
of properties, it can make many refactorings easier, such as replacing a
simple property with a computed property, or vice versa.
@ -9923,11 +9923,11 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
Ember.propertyDidChange(this, keyName);
return this;
},
/**
Convenience method to call `propertyWillChange` and `propertyDidChange` in
succession.
@param {String} keyName The property key to be notified about.
@returns {Ember.Observable}
*/
@ -10019,7 +10019,7 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
This method will be called when a client attempts to get the value of a
property that has not been defined in one of the typical ways. Override
this method to create "virtual" properties.
@param {String} key The name of the unknown property that was requested.
@returns {Object} The property value or undefined. Default is undefined.
*/
@ -10031,7 +10031,7 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
This method will be called when a client attempts to set the value of a
property that has not been defined in one of the typical ways. Override
this method to create "virtual" properties.
@param {String} key The name of the unknown property to be set.
@param {Object} value The value the unknown property is to be set to.
*/
@ -10042,7 +10042,7 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
/**
This is like `get`, but allows you to pass in a dot-separated property
path.
person.getPath('address.zip'); // return the zip
person.getPath('children.firstObject.age'); // return the first kid's age
@ -10058,7 +10058,7 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
/**
This is like `set`, but allows you to specify the property you want to
set as a dot-separated property path.
person.setPath('address.zip', 10011); // set the zip to 10011
person.setPath('children.firstObject.age', 6); // set the first kid's age to 6
@ -10076,9 +10076,9 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
/**
Retrieves the value of a property, or a default value in the case that the property
returns undefined.
person.getWithDefault('lastName', 'Doe');
@param {String} keyName The name of the property to retrieve
@param {Object} defaultValue The value to return if the property value is undefined
@returns {Object} The property value or the defaultValue.
@ -10089,10 +10089,10 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
/**
Set the value of a property to the current value plus some amount.
person.incrementProperty('age');
team.incrementProperty('score', 2);
@param {String} keyName The name of the property to increment
@param {Object} increment The amount to increment by. Defaults to 1
@returns {Object} The new property value
@ -10102,13 +10102,13 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
set(this, keyName, (get(this, keyName) || 0)+increment);
return get(this, keyName);
},
/**
Set the value of a property to the current value minus some amount.
player.decrementProperty('lives');
orc.decrementProperty('health', 5);
@param {String} keyName The name of the property to decrement
@param {Object} increment The amount to decrement by. Defaults to 1
@returns {Object} The new property value
@ -10122,9 +10122,9 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
/**
Set the value of a boolean property to the opposite of it's
current value.
starship.toggleProperty('warpDriveEnaged');
@param {String} keyName The name of the property to toggle
@returns {Object} The new property value
*/
@ -11246,6 +11246,8 @@ Ember.ArrayProxy = Ember.Object.extend(Ember.MutableArray,
var content = get(this, 'content'),
len = content ? get(content, 'length') : 0;
Ember.assert("Can't set ArrayProxy's content to itself", content !== this);
if (content) {
content.addArrayObserver(this, {
willChange: 'contentArrayWillChange',
@ -11272,6 +11274,8 @@ Ember.ArrayProxy = Ember.Object.extend(Ember.MutableArray,
var arrangedContent = get(this, 'arrangedContent'),
len = arrangedContent ? get(arrangedContent, 'length') : 0;
Ember.assert("Can't set ArrayProxy's content to itself", arrangedContent !== this);
if (arrangedContent) {
arrangedContent.addArrayObserver(this, {
willChange: 'arrangedContentArrayWillChange',
@ -11470,6 +11474,10 @@ Ember.ObjectProxy = Ember.Object.extend(
*/
content: null,
/** @private */
_contentDidChange: Ember.observer(function() {
Ember.assert("Can't set ObjectProxy's content to itself", this.get('content') !== this);
}, 'content'),
/** @private */
delegateGet: function (key) {
var content = get(this, 'content');
if (content) {
@ -12494,7 +12502,6 @@ var get = Ember.get, set = Ember.set;
Ember.HashLocation = Ember.Object.extend({
init: function() {
set(this, 'location', get(this, 'location') || window.location);
set(this, 'callbacks', Ember.A());
},
/**
@ -12527,22 +12534,16 @@ Ember.HashLocation = Ember.Object.extend({
*/
onUpdateURL: function(callback) {
var self = this;
var guid = Ember.guidFor(this);
var hashchange = function() {
Ember.$(window).bind('hashchange.ember-location-'+guid, function() {
var path = location.hash.substr(1);
if (get(self, 'lastSetURL') === path) { return; }
set(self, 'lastSetURL', null);
callback(location.hash.substr(1));
};
get(this, 'callbacks').pushObject(hashchange);
// This won't work on old browsers anyway, but this check prevents errors
if (window.addEventListener) {
window.addEventListener('hashchange', hashchange, false);
}
});
},
/**
@ -12559,10 +12560,9 @@ Ember.HashLocation = Ember.Object.extend({
},
willDestroy: function() {
get(this, 'callbacks').forEach(function(callback) {
window.removeEventListener('hashchange', callback, false);
});
set(this, 'callbacks', null);
var guid = Ember.guidFor(this);
Ember.$(window).unbind('hashchange.ember-location-'+guid);
}
});
@ -12583,7 +12583,6 @@ Ember.HistoryLocation = Ember.Object.extend({
init: function() {
set(this, 'location', get(this, 'location') || window.location);
set(this, '_initialURL', get(this, 'location').pathname);
set(this, 'callbacks', Ember.A());
},
/**
@ -12626,18 +12625,11 @@ Ember.HistoryLocation = Ember.Object.extend({
history changes, including using forward and back buttons.
*/
onUpdateURL: function(callback) {
var self = this;
var guid = Ember.guidFor(this);
var popstate = function(e) {
Ember.$(window).bind('popstate.ember-location-'+guid, function(e) {
callback(location.pathname);
};
get(this, 'callbacks').pushObject(popstate);
// This won't work on old browsers anyway, but this check prevents errors
if (window.addEventListener) {
window.addEventListener('popstate', popstate, false);
}
});
},
/**
@ -12651,10 +12643,9 @@ Ember.HistoryLocation = Ember.Object.extend({
},
willDestroy: function() {
get(this, 'callbacks').forEach(function(callback) {
window.removeEventListener('popstate', callback, false);
});
set(this, 'callbacks', null);
var guid = Ember.guidFor(this);
Ember.$(window).unbind('popstate.ember-location-'+guid);
}
});
@ -13474,6 +13465,8 @@ Ember.ControllerMixin.reopen({
var viewClassName = name.charAt(0).toUpperCase() + name.substr(1) + "View";
viewClass = get(namespace, viewClassName);
controller = get(controllers, name + 'Controller');
Ember.assert("The name you supplied " + name + " did not resolve to a view " + viewClassName, !!viewClass);
Ember.assert("The name you supplied " + name + " did not resolve to a controller " + name + 'Controller', (!!controller && !!context) || !context);
}
@ -13532,17 +13525,6 @@ var childViewsProperty = Ember.computed(function() {
return ret;
}).property().cacheable();
var controllerProperty = Ember.computed(function(key, value) {
var parentView;
if (arguments.length === 2) {
return value;
} else {
parentView = get(this, 'parentView');
return parentView ? get(parentView, 'controller') : null;
}
}).property().cacheable();
var VIEW_PRESERVES_CONTEXT = Ember.VIEW_PRESERVES_CONTEXT;
Ember.warn("The way that the {{view}} helper affects templates is about to change. Previously, templates inside child views would use the new view as the context. Soon, views will preserve their parent context when rendering their template. You can opt-in early to the new behavior by setting `ENV.VIEW_PRESERVES_CONTEXT = true`. For more information, see https://gist.github.com/2494968. You should update your templates as soon as possible; this default will change soon, and the option will be eliminated entirely before the 1.0 release.", VIEW_PRESERVES_CONTEXT);
@ -13571,7 +13553,7 @@ var invokeForState = {
`Ember.View` is the class in Ember responsible for encapsulating templates of HTML
content, combining templates with data to render as sections of a page's DOM, and
registering and responding to user-initiated events.
## HTML Tag
The default HTML tag name used for a view's DOM representation is `div`. This can be
customized by setting the `tagName` property. The following view class:
@ -13597,7 +13579,7 @@ var invokeForState = {
<div id="ember1" class="ember-view my-class my-other-class"></div>
`class` attribute values can also be set by providing a `classNameBindings` property
set to an array of properties names for the view. The return value of these properties
set to an array of properties names for the view. The return value of these properties
will be added as part of the value for the view's `class` attribute. These properties
can be computed properties:
@ -13626,7 +13608,7 @@ var invokeForState = {
<div id="ember1" class="ember-view hovered"></div>
When using boolean class name bindings you can supply a string value other than the
When using boolean class name bindings you can supply a string value other than the
property name for use as the `class` HTML attribute by appending the preferred value after
a ":" character when defining the binding:
@ -13667,11 +13649,11 @@ var invokeForState = {
<div id="ember1" class="ember-view empty"></div>
Updates to the the value of a class name binding will result in automatic update
Updates to the the value of a class name binding will result in automatic update
of the HTML `class` attribute in the view's rendered HTML representation.
If the value becomes `false` or `undefined` the class name will be removed.
Both `classNames` and `classNameBindings` are concatenated properties.
Both `classNames` and `classNameBindings` are concatenated properties.
See `Ember.Object` documentation for more information about concatenated properties.
## HTML Attributes
@ -13717,7 +13699,7 @@ var invokeForState = {
}.property()
})
Updates to the the property of an attribute binding will result in automatic update
Updates to the the property of an attribute binding will result in automatic update
of the HTML attribute in the view's rendered HTML representation.
`attributeBindings` is a concatenated property. See `Ember.Object` documentation
@ -13808,7 +13790,7 @@ var invokeForState = {
primary templates, layouts can be any function that accepts an optional context
parameter and returns a string of HTML that will be inserted inside view's tag. Views whose HTML
element is self closing (e.g. `<input />`) cannot have a layout and this property will be ignored.
Most typically in Ember a layout will be a compiled Ember.Handlebars template.
A view's layout can be set directly with the `layout` property or reference an
@ -13833,7 +13815,7 @@ var invokeForState = {
See `Handlebars.helpers.yield` for more information.
## Responding to Browser Events
Views can respond to user-initiated events in one of three ways: method implementation,
Views can respond to user-initiated events in one of three ways: method implementation,
through an event manager, and through `{{action}}` helper use in their template or layout.
### Method Implementation
@ -13850,8 +13832,8 @@ var invokeForState = {
### Event Managers
Views can define an object as their `eventManager` property. This object can then
implement methods that match the desired event names. Matching events that occur
on the view's rendered HTML or the rendered HTML of any of its DOM descendants
will trigger this method. A `jQuery.Event` object will be passed as the first
on the view's rendered HTML or the rendered HTML of any of its DOM descendants
will trigger this method. A `jQuery.Event` object will be passed as the first
argument to the method and an `Ember.View` object as the second. The `Ember.View`
will be the view whose rendered HTML was interacted with. This may be the view with
the `eventManager` property or one of its descendent views.
@ -13885,7 +13867,7 @@ var invokeForState = {
Similarly a view's event manager will take precedence for events of any views
rendered as a descendent. A method name that matches an event name will not be called
if the view instance was rendered inside the HTML representation of a view that has
if the view instance was rendered inside the HTML representation of a view that has
an `eventManager` property defined that handles events of the name. Events not handled
by the event manager will still trigger method calls on the descendent.
@ -13907,7 +13889,7 @@ var invokeForState = {
// eventManager doesn't handle click events
},
mouseEnter: function(event){
// will never be called if rendered inside
// will never be called if rendered inside
// an OuterView.
}
})
@ -13928,7 +13910,7 @@ var invokeForState = {
Form events: 'submit', 'change', 'focusIn', 'focusOut', 'input'
HTML5 drag and drop events: 'dragStart', 'drag', 'dragEnter', 'dragLeave', 'drop', 'dragEnd'
## Handlebars `{{view}}` Helper
Other `Ember.View` instances can be included as part of a view's template by using the `{{view}}`
Handlebars helper. See `Handlebars.helpers.view` for additional information.
@ -14011,7 +13993,17 @@ Ember.View = Ember.Object.extend(Ember.Evented,
@type Object
*/
controller: controllerProperty,
controller: Ember.computed(function(key, value) {
var parentView;
if (arguments.length === 2) {
return value;
} else {
parentView = get(this, 'parentView');
return parentView ? get(parentView, 'controller') : null;
}
}).property().cacheable(),
/**
A view may contain a layout. A layout is a regular template but
supersedes the `template` property during rendering. It is the
@ -14076,22 +14068,20 @@ Ember.View = Ember.Object.extend(Ember.Evented,
to be re-rendered.
*/
_context: Ember.computed(function(key, value) {
var parentView, context;
var parentView, controller;
if (arguments.length === 2) {
return value;
}
if (VIEW_PRESERVES_CONTEXT) {
if (Ember.meta(this).descs.controller !== controllerProperty) {
if (context = get(this, 'controller')) {
return context;
}
if (controller = get(this, 'controller')) {
return controller;
}
parentView = get(this, '_parentView');
if (parentView && (context = get(parentView, '_context'))) {
return context;
if (parentView) {
return get(parentView, '_context');
}
}
@ -16298,7 +16288,7 @@ var get = Ember.get, set = Ember.set, fmt = Ember.String.fmt;
@class
`Ember.CollectionView` is an `Ember.View` descendent responsible for managing a
collection (an array or array-like object) by maintaing a child view object and
collection (an array or array-like object) by maintaing a child view object and
associated DOM representation for each item in the array and ensuring that child
views and their associated rendered HTML are updated when items in the array
are added, removed, or replaced.
@ -16342,7 +16332,7 @@ var get = Ember.get, set = Ember.set, fmt = Ember.String.fmt;
## Automatic matching of parent/child tagNames
Setting the `tagName` property of a `CollectionView` to any of
Setting the `tagName` property of a `CollectionView` to any of
"ul", "ol", "table", "thead", "tbody", "tfoot", "tr", or "select" will result
in the item views receiving an appropriately matched `tagName` property.
@ -17195,15 +17185,15 @@ var arrayForEach = Ember.ArrayPolyfills.forEach;
robotManager.getPath('currentState.name') // 'rampaging'
Transition actions can also be created using the `transitionTo` method of the Ember.State class. The
following example StateManagers are equivalent:
following example StateManagers are equivalent:
aManager = Ember.StateManager.create({
stateOne: Ember.State.create({
changeToStateTwo: Ember.State.transitionTo('stateTwo')
}),
stateTwo: Ember.State.create({})
})
bManager = Ember.StateManager.create({
stateOne: Ember.State.create({
changeToStateTwo: function(manager, context){
@ -17284,7 +17274,7 @@ Ember.StateManager = Ember.State.extend(
@default true
*/
errorOnUnhandledEvent: true,
send: function(event, context) {
Ember.assert('Cannot send event "' + event + '" while currentState is ' + get(this, 'currentState'), get(this, 'currentState'));
return this.sendRecursively(event, get(this, 'currentState'), context);
@ -18493,6 +18483,7 @@ Ember.StateManager.reopen(
view;
while (currentState) {
// TODO: Remove this when view state is removed
if (get(currentState, 'isViewState')) {
view = get(currentState, 'view');
if (view) { return view; }
@ -20363,7 +20354,7 @@ EmberHandlebars.ViewHelper = Ember.Object.create({
Will result in HTML structure:
<body>
<!-- Note: the handlebars template script
<!-- Note: the handlebars template script
also results in a rendered Ember.View
which is the outer <div> here -->
@ -20385,7 +20376,7 @@ EmberHandlebars.ViewHelper = Ember.Object.create({
})
aView.appendTo('body')
Will result in HTML structure:
<div id="ember1" class="ember-view">
@ -20459,7 +20450,7 @@ EmberHandlebars.ViewHelper = Ember.Object.create({
Will result in the following HTML:
<div id="ember1" class="ember-view">
<div id="ember2" class="ember-view a-custom-view-class-as-property">
<div id="ember2" class="ember-view a-custom-view-class-as-property">
hi
</div>
</div>
@ -20619,7 +20610,7 @@ var get = Ember.get, getPath = Ember.Handlebars.getPath, fmt = Ember.String.fmt;
<p class="ember-view greeting">Howdy Mary</p>
<p class="ember-view greeting">Howdy Sara</p>
</div>
@name Handlebars.helpers.collection
@param {String} path
@param {Hash} options
@ -20904,6 +20895,7 @@ ActionHelper.registerAction = function(actionName, eventName, target, view, cont
if (target.isState && typeof target.send === 'function') {
return target.send(actionName, event);
} else {
Ember.assert(Ember.String.fmt('Target %@ does not have action %@', [target, actionName]), target[actionName]);
return target[actionName].call(target, event);
}
}
@ -21233,7 +21225,7 @@ var set = Ember.set, get = Ember.get;
/**
@class
Creates an HTML input of type 'checkbox' with HTML related properties
Creates an HTML input of type 'checkbox' with HTML related properties
applied directly to the input.
{{view Ember.Checkbox classNames="applicaton-specific-checkbox"}}
@ -21252,7 +21244,7 @@ var set = Ember.set, get = Ember.get;
through the Ember object or by interacting with its rendered element representation
via the mouse, keyboard, or touch. Updating the value of the checkbox via jQuery will
result in the checked value of the object and its element losing synchronization.
## Layout and LayoutName properties
Because HTML `input` elements are self closing `layout` and `layoutName` properties will
not be applied. See `Ember.View`'s layout section for more information.
@ -21364,7 +21356,7 @@ var get = Ember.get, set = Ember.set;
## Layout and LayoutName properties
Because HTML `input` elements are self closing `layout` and `layoutName` properties will
not be applied. See `Ember.View`'s layout section for more information.
@extends Ember.TextSupport
*/
Ember.TextField = Ember.View.extend(Ember.TextSupport,
@ -21541,7 +21533,7 @@ var get = Ember.get, set = Ember.set;
## Layout and LayoutName properties
Because HTML `textarea` elements do not contain inner HTML the `layout` and `layoutName`
Because HTML `textarea` elements do not contain inner HTML the `layout` and `layoutName`
properties will not be applied. See `Ember.View`'s layout section for more information.
@extends Ember.TextSupport
@ -21572,7 +21564,12 @@ Ember.TextArea = Ember.View.extend(Ember.TextSupport,
(function() {
Ember.TabContainerView = Ember.View.extend();
Ember.TabContainerView = Ember.View.extend({
init: function() {
Ember.deprecate("Ember.TabContainerView is deprecated and will be removed from future releases.");
this._super();
}
});
})();
@ -21588,7 +21585,12 @@ Ember.TabPaneView = Ember.View.extend({
isVisible: Ember.computed(function() {
return get(this, 'viewName') === getPath(this, 'tabsContainer.currentView');
}).property('tabsContainer.currentView').volatile()
}).property('tabsContainer.currentView').volatile(),
init: function() {
Ember.deprecate("Ember.TabPaneView is deprecated and will be removed from future releases.");
this._super();
}
});
})();
@ -21605,6 +21607,11 @@ Ember.TabView = Ember.View.extend({
mouseUp: function() {
setPath(this, 'tabsContainer.currentView', get(this, 'value'));
},
init: function() {
Ember.deprecate("Ember.TabView is deprecated and will be removed from future releases.");
this._super();
}
});
@ -22011,7 +22018,7 @@ Ember.Handlebars.bootstrap = function(ctx) {
// id if no name is found.
templateName = script.attr('data-template-name') || script.attr('id'),
template = compile(script.html()),
view, viewPath, elementId, tagName, options;
view, viewPath, elementId, options;
if (templateName) {
// For templates which have a name, we save them and then remove them from the DOM
@ -22040,13 +22047,8 @@ Ember.Handlebars.bootstrap = function(ctx) {
// Look for data-element-id attribute.
elementId = script.attr('data-element-id');
// Users can optionally specify a custom tag name to use by setting the
// data-tag-name attribute on the script tag.
tagName = script.attr('data-tag-name');
options = { template: template };
if (elementId) { options.elementId = elementId; }
if (tagName) { options.tagName = tagName; }
view = view.create(options);
@ -22079,8 +22081,8 @@ Ember.$(document).ready(
})();
// Version: v0.9.8.1-468-g3097ea8
// Last commit: 3097ea8 (2012-07-04 14:42:40 -0700)
// Version: v0.9.8.1-484-g73ac0a4
// Last commit: 73ac0a4 (2012-07-06 11:52:32 -0700)
(function() {
@ -27982,7 +27984,13 @@ function popState(event) {
function logMock( mockHandler, requestSettings ) {
var c = $.extend({}, $.mockjaxSettings, mockHandler);
if ( c.log && $.isFunction(c.log) ) {
c.log('MOCK ' + requestSettings.type.toUpperCase() + ': ' + requestSettings.url, $.extend({}, requestSettings));
var url = requestSettings.url
if(requestSettings.data) {
params = []
for(key in requestSettings.data) params.push(key + '=' + requestSettings.data[key])
url = url + '?' + params.join('&')
}
c.log('MOCK ' + requestSettings.type.toUpperCase() + ': ' + url, $.extend({}, requestSettings));
}
}

View File

@ -343,7 +343,7 @@ table.list td:last-child {
}
/* line 8, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log {
pre#log {
clear: left;
white-space: pre-wrap;
word-wrap: break-word;
@ -360,116 +360,121 @@ table.list td:last-child {
border-radius: 4px;
}
/* line 21, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log p {
pre#log p {
position: relative;
padding: 0 15px 0 50px;
margin: 0;
min-height: 16px;
}
/* line 26, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log p:hover {
pre#log p:hover {
background-color: rgba(255, 255, 255, 0.05);
}
/* line 28, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log p.highlight {
pre#log p.highlight {
background-color: rgba(255, 255, 255, 0.5);
}
/* line 30, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log p a {
pre#log p a {
position: absolute;
margin-left: -40px;
cursor: pointer;
}
/* line 35, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .fold {
pre#log .fold {
height: 16px;
overflow: hidden;
cursor: pointer;
}
/* line 39, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .fold.open {
pre#log .fold.open {
height: auto;
}
/* line 42, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .bold {
pre#log .bold {
font-weight: bold;
}
/* line 44, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .italic {
pre#log .italic {
font-style: italic;
}
/* line 46, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .underscore {
pre#log .underscore {
/* monochrome displays only according to http://ascii-table.com/ansi-escape-sequences.php */
}
/* line 49, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .black {
pre#log .black {
color: black;
}
/* line 51, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .red {
pre#log .red {
color: red;
}
/* line 53, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .green {
pre#log .green {
color: lime;
}
/* line 55, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .yellow {
pre#log .yellow {
color: yellow;
}
/* line 57, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .blue {
pre#log .blue {
color: blue;
}
/* line 59, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .magenta {
pre#log .magenta {
color: magenta;
}
/* line 61, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .cyan {
pre#log .cyan {
color: cyan;
}
/* line 63, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .white {
pre#log .white {
color: white;
}
/* line 65, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .black.bright {
pre#log .black.bright {
color: #999999;
}
/* line 68, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .bg-black {
pre#log .bg-black {
background-color: black;
}
/* line 70, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .bg-red {
pre#log .bg-red {
background-color: red;
}
/* line 72, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .bg-green {
pre#log .bg-green {
background-color: lime;
}
/* line 74, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .bg-yellow {
pre#log .bg-yellow {
background-color: yellow;
}
/* line 76, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .bg-blue {
pre#log .bg-blue {
background-color: blue;
}
/* line 78, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .bg-magenta {
pre#log .bg-magenta {
background-color: magenta;
}
/* line 80, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .bg-cyan {
pre#log .bg-cyan {
background-color: cyan;
}
/* line 82, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log .bg-white {
pre#log .bg-white {
background-color: white;
}
/* line 85, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/log.sass */
#log.loading {
padding: 25px 0 0 10px;
}
/* line 3, /Volumes/Users/sven/Development/projects/travis/travis-ember/assets/stylesheets/main/repository.sass */
#repository {
position: relative;