commit stuff for piotr
This commit is contained in:
parent
0ee887c792
commit
e15b2d680f
|
@ -3,6 +3,7 @@ require 'ext/jquery'
|
|||
|
||||
# $.mockjaxSettings.log = false
|
||||
# Ember.LOG_BINDINGS = true
|
||||
|
||||
@Travis = Em.Namespace.create
|
||||
CONFIG_KEYS: ['rvm', 'gemfile', 'env', 'otp_release', 'php', 'node_js', 'perl', 'python', 'scala']
|
||||
|
||||
|
|
|
@ -2,11 +2,27 @@ require 'helpers'
|
|||
require 'travis/ticker'
|
||||
|
||||
Travis.Controllers = Em.Namespace.create
|
||||
RepositoriesController: Em.ArrayController.extend()
|
||||
RepositoryController: Em.ObjectController.extend(Travis.Urls.Repository)
|
||||
BuildsController: Em.ArrayController.extend()
|
||||
BuildController: Em.ObjectController.extend(Travis.Urls.Commit)
|
||||
JobController: Em.ObjectController.extend(Travis.Urls.Commit)
|
||||
RepositoriesController: Em.ArrayController.extend
|
||||
contentBinding: 'layout.repositories'
|
||||
|
||||
RepositoryController: Em.Controller.extend # Travis.Urls.Repository,
|
||||
repositoryBinding: 'layout.repository'
|
||||
|
||||
TabsController: Em.Controller.extend
|
||||
repositoryBinding: 'layout.repository'
|
||||
buildBinding: 'layout.build'
|
||||
jobBinding: 'layout.job'
|
||||
tabBinding: 'layout.tab'
|
||||
|
||||
BuildsController: Em.ArrayController.extend
|
||||
contentBinding: 'layout.builds'
|
||||
|
||||
BuildController: Em.Controller.extend # Travis.Urls.Commit,
|
||||
buildBinding: 'layout.build'
|
||||
|
||||
JobController: Em.Controller.extend # Travis.Urls.Commit,
|
||||
jobBinding: 'layout.job'
|
||||
|
||||
QueuesController: Em.ArrayController.extend()
|
||||
UserController: Em.ObjectController.extend()
|
||||
HooksController: Em.ArrayController.extend()
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
Repository:
|
||||
urlGithub: (->
|
||||
"http://github.com/#{@get('slug')}"
|
||||
).property('slug'),
|
||||
"http://github.com/#{@getPath('repository.slug')}"
|
||||
).property('repository.slug'),
|
||||
|
||||
urlGithubWatchers: (->
|
||||
"http://github.com/#{@get('slug')}/watchers"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
Travis.Layout = Em.Namespace.create()
|
||||
|
||||
require 'layout/home'
|
||||
require 'layout/left'
|
||||
require 'layout/sidebar'
|
||||
require 'layout/profile'
|
||||
require 'layout/stats'
|
||||
|
|
|
@ -2,7 +2,7 @@ Travis.Layout.Base = Em.Object.extend
|
|||
init: ->
|
||||
@parent = @get('parent')
|
||||
|
||||
@setup(Array.prototype.slice.apply(arguments).concat(@get('name')))
|
||||
@setup(Array.prototype.slice.apply(arguments).concat([@get('name'), 'top']))
|
||||
@connect()
|
||||
|
||||
setup: (controllers) ->
|
||||
|
@ -14,7 +14,7 @@ Travis.Layout.Base = Em.Object.extend
|
|||
key = "#{$.camelize(name, false)}Controller"
|
||||
name = $.camelize(key)
|
||||
klass = Travis.Controllers[name] || Em.Controller
|
||||
this[key] = klass.create(namespace: this, controllers: this)
|
||||
this[key] = klass.create(layout: this, namespace: this, controllers: this)
|
||||
|
||||
@controller = this["#{$.camelize(@get('name'), false)}Controller"]
|
||||
@viewClass = Travis.Views["#{$.camelize(@get('name'))}Layout"]
|
||||
|
@ -31,5 +31,6 @@ Travis.Layout.Base = Em.Object.extend
|
|||
@topController.set('tab', @get('name'))
|
||||
|
||||
activate: (action, params) ->
|
||||
this["view#{$.camelize(action)}"](params)
|
||||
@set('params', params)
|
||||
this["view#{$.camelize(action)}"]()
|
||||
|
||||
|
|
|
@ -4,83 +4,67 @@ Travis.Layout.Home = Travis.Layout.Base.extend
|
|||
name: 'home'
|
||||
|
||||
init: ->
|
||||
@_super('top', 'repositories', 'repository', 'tabs', 'builds', 'build', 'job')
|
||||
@connectLeft(Travis.Repository.find())
|
||||
Travis.Layout.Sidebar.create(homeController: @get('homeController'))
|
||||
@_super('repositories', 'repository', 'tabs', 'builds', 'build', 'job')
|
||||
# Travis.Layout.Sidebar.create(parent: @controller)
|
||||
|
||||
viewIndex: (params) ->
|
||||
onceLoaded @repositories, =>
|
||||
repository = @repositories.get('firstObject')
|
||||
@connectRepository(repository)
|
||||
@connectTabs('current')
|
||||
@connectBuild(repository.get('lastBuild'))
|
||||
@controller.connectOutlet(outletName: 'left', name: 'repositories')
|
||||
@controller.connectOutlet(outletName: 'main', name: 'repository')
|
||||
@controller.connectOutlet(outletName: 'tabs', name: 'tabs')
|
||||
|
||||
viewCurrent: (params) ->
|
||||
@viewRepository params, (repository) =>
|
||||
@connectTabs('current')
|
||||
@connectBuild(repository.get('lastBuild'))
|
||||
@set('repositories', Travis.Repository.find())
|
||||
|
||||
viewBuilds: (params) ->
|
||||
@viewRepository params, (repository) =>
|
||||
@connectTabs('builds')
|
||||
@connectBuilds(repository.get('builds'))
|
||||
activate: (action, params) ->
|
||||
@set('tab', if action == 'index' then 'current' else action)
|
||||
@_super(action, params)
|
||||
|
||||
viewBuild: (params) ->
|
||||
@viewRepository params
|
||||
@buildBy params.id, (build) =>
|
||||
@connectTabs('build', build)
|
||||
@connectBuild(build)
|
||||
viewIndex: ->
|
||||
@bindRepository('repositories.firstObject')
|
||||
@bindBuild('repository.lastBuild')
|
||||
@connectTab('build')
|
||||
|
||||
viewJob: (params) ->
|
||||
@viewRepository params
|
||||
@jobBy params.id, (job) =>
|
||||
@connectTabs('job', job.get('build'), job)
|
||||
@connectJob(job)
|
||||
viewCurrent: ->
|
||||
@bindRepository('repositoryByParams')
|
||||
@bindBuild('repository.lastBuild')
|
||||
@connectTab('build')
|
||||
|
||||
viewBuilds: ->
|
||||
@bind('repository', 'repositoriesByParams.firstObject')
|
||||
@bind('builds', 'repository.builds')
|
||||
@connectTab('builds')
|
||||
|
||||
viewRepository: (params, callback) ->
|
||||
@repositoryBy params, (repository) =>
|
||||
@connectRepository(repository)
|
||||
callback(repository) if callback
|
||||
viewBuild: ->
|
||||
@bindRepository('repositoryByParams')
|
||||
@bindBuild('buildById')
|
||||
@connectTab('build')
|
||||
|
||||
repositoryBy: (params, callback) ->
|
||||
repositories = Travis.Repository.bySlug("#{params.owner}/#{params.name}")
|
||||
onceLoaded repositories, =>
|
||||
callback(repositories.get('firstObject'))
|
||||
viewJob: ->
|
||||
@bindRepository('repositoryByParams')
|
||||
@bindJob('jobById')
|
||||
@connectTab('job')
|
||||
|
||||
buildBy: (id, callback) =>
|
||||
build = Travis.Build.find(id)
|
||||
onceLoaded build, =>
|
||||
callback(build)
|
||||
repositoryByParamsBinding: 'repositoriesByParams.firstObject'
|
||||
|
||||
jobBy: (id, callback) ->
|
||||
job = Travis.Job.find(id)
|
||||
onceLoaded job, =>
|
||||
callback(job)
|
||||
repositoriesByParams: (->
|
||||
console.log('repositoriesByParams', @getPath('params.owner'), @getPath('params.name'))
|
||||
Travis.Repository.bySlug("#{params.owner}/#{params.name}") if params = @get('params')
|
||||
).property('params')
|
||||
|
||||
buildById: (->
|
||||
console.log('buildByParams', @getPath('params.id'))
|
||||
Travis.Build.find(id) if id = @getPath('params.id')
|
||||
).property('params.id')
|
||||
|
||||
connectLeft: (repositories) ->
|
||||
@repositories = repositories
|
||||
@homeController.connectOutlet(outletName: 'left', name: 'repositories', context: repositories)
|
||||
jobById: (->
|
||||
console.log('jobByParams', @getPath('params.id'))
|
||||
Travis.Job.find(id) if id = @getPath('params.id')
|
||||
).property('params.id')
|
||||
|
||||
connectRepository: (repository) ->
|
||||
@repository = repository
|
||||
@homeController.connectOutlet(outletName: 'main', name: 'repository', context: repository)
|
||||
bindRepository: (from) ->
|
||||
Ember.oneWay(this, 'repository', from)
|
||||
|
||||
connectTabs: (tab, build, job) ->
|
||||
@tabsController.set('tab', tab)
|
||||
@tabsController.set('repository', @repository)
|
||||
@tabsController.set('build', build)
|
||||
@tabsController.set('job', job)
|
||||
@homeController.connectOutlet(outletName: 'tabs', name: 'tabs')
|
||||
|
||||
connectBuilds: (builds) ->
|
||||
@homeController.connectOutlet(outletName: 'tab', name: 'builds', context: builds)
|
||||
|
||||
connectBuild: (build) ->
|
||||
@homeController.connectOutlet(outletName: 'tab', name: 'build', context: build)
|
||||
|
||||
connectJob: (job) ->
|
||||
@homeController.connectOutlet(outletName: 'tab', name: 'job', context: job)
|
||||
bindBuild: (from) ->
|
||||
Ember.oneWay(this, 'build', from)
|
||||
|
||||
connectTab: (tab) ->
|
||||
@controller.connectOutlet(outletName: 'tab', name: tab)
|
||||
|
||||
|
|
16
assets/javascripts/app/layout/left.coffee
Normal file
16
assets/javascripts/app/layout/left.coffee
Normal file
|
@ -0,0 +1,16 @@
|
|||
require 'layout/base'
|
||||
|
||||
Travis.Layout.Left = Travis.Layout.Base.extend
|
||||
name: 'sidebar'
|
||||
|
||||
init: ->
|
||||
@_super('repositories')
|
||||
@parent = @get('parent')
|
||||
@connectLeft(Travis.Repository.find())
|
||||
|
||||
connect: ->
|
||||
@parent.connectOutlet(outletName: 'right', name: 'sidebar')
|
||||
|
||||
connectLeft: (repositories) ->
|
||||
@parent.set('repositories', repositories)
|
||||
@parent.connectOutlet(outletName: 'left', name: 'repositories', context: repositories)
|
|
@ -5,7 +5,7 @@ Travis.Layout.Sidebar = Travis.Layout.Base.extend
|
|||
|
||||
init: ->
|
||||
@_super('sponsors', 'workers', 'queues')
|
||||
@homeController = @get('homeController')
|
||||
@parent = @get('parent')
|
||||
|
||||
@connectSponsors(Travis.Sponsor.decks(), Travis.Sponsor.links())
|
||||
@connectWorkers(Travis.Worker.find())
|
||||
|
@ -14,13 +14,13 @@ Travis.Layout.Sidebar = Travis.Layout.Base.extend
|
|||
Travis.Ticker.create(target: this, interval: Travis.INTERVALS.sponsors)
|
||||
|
||||
connect: ->
|
||||
@homeController.connectOutlet(outletName: 'right', name: 'sidebar')
|
||||
@parent.connectOutlet(outletName: 'right', name: 'sidebar')
|
||||
|
||||
connectSponsors: (decks, links) ->
|
||||
@sponsorsController = Em.Controller.create
|
||||
decks: Travis.Controllers.SponsorsController.create(perPage: 1, content: decks)
|
||||
links: Travis.Controllers.SponsorsController.create(perPage: 6, content: links)
|
||||
@homeController.set 'sponsors', @sponsorsController
|
||||
@parent.set 'sponsors', @sponsorsController
|
||||
|
||||
tick: ->
|
||||
@sponsorsController.get('decks').next()
|
||||
|
@ -28,7 +28,7 @@ Travis.Layout.Sidebar = Travis.Layout.Base.extend
|
|||
|
||||
connectWorkers: (workers) ->
|
||||
@workersController.set('content', workers)
|
||||
@homeController.set('workers', @workersController)
|
||||
@parent.set('workers', @workersController)
|
||||
|
||||
connectQueues: (queues) ->
|
||||
queues = for queue in queues
|
||||
|
@ -36,5 +36,5 @@ Travis.Layout.Sidebar = Travis.Layout.Base.extend
|
|||
content: Travis.Job.queued(queue.name)
|
||||
name: queue.display
|
||||
@queuesController.set('content', queues)
|
||||
@homeController.set('queues', @queuesController)
|
||||
@parent.set('queues', @queuesController)
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
{{#with controller.builds}}
|
||||
<table id="builds" class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -20,6 +21,8 @@
|
|||
<td class="finished_at timeago" {{bindAttr title="finished_at"}}>{{formatTime finished_at}}</td>
|
||||
</tr>
|
||||
{{/view}}
|
||||
{{else}}
|
||||
Loading ...
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -29,3 +32,4 @@
|
|||
{{t builds.show_more}}
|
||||
</button>
|
||||
</p>
|
||||
{{/with}}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
{{#with controller.build}}
|
||||
{{#unless isLoaded}}
|
||||
Loading ...
|
||||
{{else}}
|
||||
|
@ -5,7 +6,7 @@
|
|||
<dl id="summary">
|
||||
<div class="left">
|
||||
<dt>{{t builds.name}}</dt>
|
||||
<dd class="number"><a {{bindAttr href="view.urlBuild"}}>{{number}}</a></dd>
|
||||
<dd class="number"><a {{bindAttr href="controller.view.urlBuild"}}>{{number}}</a></dd>
|
||||
<dt class="finished_at_label">{{t builds.finished_at}}</dt>
|
||||
<dd class="finished_at timeago" {{bindAttr title="finished_at"}}>{{formatTime finished_at}}</dd>
|
||||
<dt>{{t builds.duration}}</dt>
|
||||
|
@ -46,3 +47,4 @@
|
|||
{{/if}}
|
||||
</div>
|
||||
{{/unless}}
|
||||
{{/with}}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{{#if view.jobs.length}}
|
||||
{{#with controller.build}}
|
||||
{{#if jobs.length}}
|
||||
{{#if view.required}}
|
||||
<table id="jobs" class="list">
|
||||
<caption>
|
||||
|
@ -54,3 +55,4 @@
|
|||
</div>
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
{{/with}}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
{{#with controller.job}}
|
||||
{{#if isLoaded}}
|
||||
<div {{bindAttr class="view.color"}}>
|
||||
<dl id="summary">
|
||||
<div class="left">
|
||||
|
@ -34,4 +36,5 @@
|
|||
|
||||
{{view Travis.Views.LogView}}
|
||||
</div>
|
||||
|
||||
{{/if}}
|
||||
{{/with}}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<ul id="repositories">
|
||||
{{#each repository in content}}
|
||||
{{#each repository in controller.content}}
|
||||
{{#view Travis.Views.RepositoriesItemView contextBinding="repository"}}
|
||||
<li {{bindAttr class="view.classes"}}>
|
||||
<a {{bindAttr href="view.urlRepository"}} class="current">{{slug}}</a>
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
{{#with controller.repository}}
|
||||
{{#unless isLoaded}}
|
||||
Loading ...
|
||||
{{else}}
|
||||
<div id="repository">
|
||||
<h3>
|
||||
<a {{bindAttr href="urlGithub"}}>{{slug}}</a>
|
||||
<a {{bindAttr href="controller.urlGithub"}}>{{slug}}</a>
|
||||
</h3>
|
||||
|
||||
<p class="description">{{description}}</p>
|
||||
|
||||
<ul class="github-stats">
|
||||
<li class="language">{{last_build_language}}</li>
|
||||
<li class="language">{{lastBuildLanguage}}</li>
|
||||
<li><a class="watchers" title="Watches" {{bindAttr href="urlGithubWatchers"}}>{{stats.watchers}}</a></li>
|
||||
<li><a class="forks" title="Forks" {{bindAttr href="urlGithubNetwork"}}>{{stats.forks}}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
{{/unless}}
|
||||
{{/with}}
|
||||
|
|
|
@ -11,16 +11,20 @@
|
|||
<li id="tab_branches" {{bindAttr class="view.classBranches"}}>
|
||||
<h5><a {{bindAttr href="view.urlBranches"}}>{{t repositories.tabs.branches}}</a></h5>
|
||||
</li>
|
||||
{{#if build}}
|
||||
{{#with controller.build}}
|
||||
{{#if isLoaded}}
|
||||
<li id="tab_build" {{bindAttr class="view.classBuild"}}>
|
||||
<h5><a {{bindAttr href="view.urlBuild"}}>{{t repositories.tabs.build}} #{{build.number}}</a></h5>
|
||||
<h5><a {{bindAttr href="view.urlBuild"}}>{{t repositories.tabs.build}} #{{number}}</a></h5>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if job}}
|
||||
{{/with}}
|
||||
{{#with controller.job}}
|
||||
{{#if isLoaded}}
|
||||
<li id="tab_job" {{bindAttr class="view.classJob"}}>
|
||||
<h5><a {{bindAttr href="view.urlJob"}}>{{t repositories.tabs.job}} #{{job.number}}</a></h5>
|
||||
<h5><a {{bindAttr href="view.urlJob"}}>{{t repositories.tabs.job}} #{{number}}</a></h5>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{/with}}
|
||||
</ul>
|
||||
|
||||
<div id="tools">
|
||||
|
|
|
@ -15,19 +15,21 @@
|
|||
templateName: 'builds/show'
|
||||
|
||||
color: (->
|
||||
Travis.Helpers.colorForResult(@getPath('controller.content.result'))
|
||||
).property('controller.content.result')
|
||||
Travis.Helpers.colorForResult(@getPath('controller.build.result'))
|
||||
).property('controller.build.result')
|
||||
|
||||
requiredJobs: (->
|
||||
@getPath('controller.content.jobs').filter((job) -> job.get('allow_failure') != true)
|
||||
).property('controller.content') # TODO same here with binding to 'context.data.job_ids'
|
||||
jobs = @getPath('controller.build.jobs')
|
||||
jobs.filter((job) -> job.get('allow_failure') != true) if jobs
|
||||
).property('controller.build.jobs')
|
||||
|
||||
allowedFailureJobs: (->
|
||||
@getPath('controller.content.jobs').filter((job) -> job.get('allow_failure'))
|
||||
).property('controller.content')
|
||||
jobs = @getPath('controller.build.jobs')
|
||||
jobs.filter((job) -> job.get('allow_failure')) if jobs
|
||||
).property('controller.build.jobs')
|
||||
|
||||
urlBuild: (->
|
||||
Travis.Urls.build(@getPath('context.repository'), @get('context'))
|
||||
).property('controller.content.repository.id', 'controller.content.id')
|
||||
).property('controller.build.repository.id', 'controller.build.id')
|
||||
|
||||
|
||||
|
|
99
assets/javascripts/vendor/ember.js
vendored
99
assets/javascripts/vendor/ember.js
vendored
|
@ -1,5 +1,5 @@
|
|||
// Version: v0.9.8.1-451-g50ee26d
|
||||
// Last commit: 50ee26d (2012-06-26 18:06:44 -0700)
|
||||
// Version: v0.9.8.1-468-g3097ea8
|
||||
// Last commit: 3097ea8 (2012-07-04 14:42:40 -0700)
|
||||
|
||||
|
||||
(function() {
|
||||
|
@ -136,8 +136,8 @@ window.ember_deprecateFunc = Ember.deprecateFunc("ember_deprecateFunc is deprec
|
|||
|
||||
})();
|
||||
|
||||
// Version: v0.9.8.1-451-g50ee26d
|
||||
// Last commit: 50ee26d (2012-06-26 18:06:44 -0700)
|
||||
// Version: v0.9.8.1-468-g3097ea8
|
||||
// Last commit: 3097ea8 (2012-07-04 14:42:40 -0700)
|
||||
|
||||
|
||||
(function() {
|
||||
|
@ -1414,11 +1414,6 @@ function normalizeTuple(target, path) {
|
|||
return TUPLE_RET;
|
||||
}
|
||||
|
||||
/** @private */
|
||||
Ember.isGlobal = function(path) {
|
||||
return IS_GLOBAL.test(path);
|
||||
};
|
||||
|
||||
/**
|
||||
@private
|
||||
|
||||
|
@ -1482,7 +1477,8 @@ Ember.getPath = function(root, path) {
|
|||
Ember.setPath = function(root, path, value, tolerant) {
|
||||
var keyName;
|
||||
|
||||
if (typeof root === 'string' && IS_GLOBAL.test(root)) {
|
||||
if (typeof root === 'string') {
|
||||
Ember.assert("Path '" + root + "' must be global if no root is given.", IS_GLOBAL.test(root));
|
||||
value = path;
|
||||
path = root;
|
||||
root = null;
|
||||
|
@ -1536,7 +1532,7 @@ Ember.trySetPath = function(root, path, value) {
|
|||
@returns Boolean
|
||||
*/
|
||||
Ember.isGlobalPath = function(path) {
|
||||
return !HAS_THIS.test(path) && IS_GLOBAL.test(path);
|
||||
return IS_GLOBAL.test(path);
|
||||
};
|
||||
|
||||
})();
|
||||
|
@ -10632,9 +10628,17 @@ var get = Ember.get, set = Ember.set;
|
|||
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());
|
||||
},
|
||||
|
||||
/**
|
||||
@private
|
||||
|
||||
Used to give history a starting reference
|
||||
*/
|
||||
_initialURL: null,
|
||||
|
||||
/**
|
||||
@private
|
||||
|
||||
|
@ -10650,12 +10654,13 @@ Ember.HistoryLocation = Ember.Object.extend({
|
|||
Uses `history.pushState` to update the url without a page reload.
|
||||
*/
|
||||
setURL: function(path) {
|
||||
var state = window.history.state;
|
||||
var state = window.history.state,
|
||||
initialURL = get(this, '_initialURL');
|
||||
|
||||
if (path === "") { path = '/'; }
|
||||
// We only want pushState to be executed if we are passing
|
||||
// in a new path, otherwise a new state will be inserted
|
||||
// for the same path.
|
||||
if (!state || (state && state.path !== path)) {
|
||||
|
||||
if ((initialURL && initialURL !== path) || (state && state.path !== path)) {
|
||||
set(this, '_initialURL', null);
|
||||
window.history.pushState({ path: path }, null, path);
|
||||
}
|
||||
},
|
||||
|
@ -11524,8 +11529,6 @@ Ember.ControllerMixin.reopen({
|
|||
if (controller && context) { controller.set('content', context); }
|
||||
view = viewClass.create();
|
||||
if (controller) { set(view, 'controller', controller); }
|
||||
|
||||
/* console.log(view, view.toString()) */
|
||||
set(this, outletName, view);
|
||||
|
||||
return view;
|
||||
|
@ -11577,6 +11580,17 @@ 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);
|
||||
|
||||
|
@ -12045,17 +12059,7 @@ Ember.View = Ember.Object.extend(Ember.Evented,
|
|||
|
||||
@type Object
|
||||
*/
|
||||
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(),
|
||||
|
||||
controller: controllerProperty,
|
||||
/**
|
||||
A view may contain a layout. A layout is a regular template but
|
||||
supersedes the `template` property during rendering. It is the
|
||||
|
@ -12120,20 +12124,22 @@ Ember.View = Ember.Object.extend(Ember.Evented,
|
|||
to be re-rendered.
|
||||
*/
|
||||
_context: Ember.computed(function(key, value) {
|
||||
var parentView, controller;
|
||||
var parentView, context;
|
||||
|
||||
if (arguments.length === 2) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (VIEW_PRESERVES_CONTEXT) {
|
||||
if (controller = get(this, 'controller')) {
|
||||
return controller;
|
||||
if (Ember.meta(this).descs.controller !== controllerProperty) {
|
||||
if (context = get(this, 'controller')) {
|
||||
return context;
|
||||
}
|
||||
}
|
||||
|
||||
parentView = get(this, '_parentView');
|
||||
if (parentView) {
|
||||
return get(parentView, '_context');
|
||||
if (parentView && (context = get(parentView, '_context'))) {
|
||||
return context;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14803,6 +14809,12 @@ Ember.State = Ember.Object.extend(Ember.Evented,
|
|||
return !get(this, 'childStates').length;
|
||||
}).cacheable(),
|
||||
|
||||
/**
|
||||
A boolean value indicating whether the state takes a context.
|
||||
By default we assume all states take contexts.
|
||||
*/
|
||||
hasContext: true,
|
||||
|
||||
/**
|
||||
This is the default transition event.
|
||||
|
||||
|
@ -15323,7 +15335,6 @@ Ember.StateManager = Ember.State.extend(
|
|||
|
||||
send: function(event, context) {
|
||||
Ember.assert('Cannot send event "' + event + '" while currentState is ' + get(this, 'currentState'), get(this, 'currentState'));
|
||||
if (arguments.length === 1) { context = {}; }
|
||||
return this.sendRecursively(event, get(this, 'currentState'), context);
|
||||
},
|
||||
|
||||
|
@ -15472,7 +15483,7 @@ Ember.StateManager = Ember.State.extend(
|
|||
exitStates.shift();
|
||||
}
|
||||
|
||||
currentState.pathsCache[name] = {
|
||||
currentState.pathsCache[path] = {
|
||||
exitStates: exitStates,
|
||||
enterStates: enterStates,
|
||||
resolveState: resolveState
|
||||
|
@ -15490,7 +15501,7 @@ Ember.StateManager = Ember.State.extend(
|
|||
exitStates.unshift(state);
|
||||
}
|
||||
|
||||
useContext = context && (!get(state, 'isRoutable') || get(state, 'isDynamic'));
|
||||
useContext = context && get(state, 'hasContext');
|
||||
matchedContexts.unshift(useContext ? contexts.pop() : null);
|
||||
}
|
||||
|
||||
|
@ -15502,6 +15513,7 @@ Ember.StateManager = Ember.State.extend(
|
|||
state = getPath(state, 'states.'+initialState);
|
||||
if (!state) { break; }
|
||||
enterStates.push(state);
|
||||
matchedContexts.push(undefined);
|
||||
}
|
||||
|
||||
while (enterStates.length > 0) {
|
||||
|
@ -15732,9 +15744,10 @@ Ember.Routable = Ember.Mixin.create({
|
|||
/**
|
||||
@private
|
||||
|
||||
Check whether the route has dynamic segments
|
||||
Check whether the route has dynamic segments and therefore takes
|
||||
a context.
|
||||
*/
|
||||
isDynamic: Ember.computed(function() {
|
||||
hasContext: Ember.computed(function() {
|
||||
var routeMatcher = get(this, 'routeMatcher');
|
||||
if (routeMatcher) {
|
||||
return routeMatcher.identifiers.length > 0;
|
||||
|
@ -16339,7 +16352,7 @@ var get = Ember.get, getPath = Ember.getPath, set = Ember.set;
|
|||
{{/each}}
|
||||
</script>
|
||||
|
||||
See Handlebars.helpers.actions for additional usage examples.
|
||||
See Handlebars.helpers.action for additional usage examples.
|
||||
|
||||
|
||||
## Changing View Hierarchy in Response To State Change
|
||||
|
@ -17959,7 +17972,7 @@ EmberHandlebars.registerHelper('with', function(context, options) {
|
|||
|
||||
Ember.assert("You must pass a block to the with helper", options.fn && options.fn !== Handlebars.VM.noop);
|
||||
|
||||
if (Ember.isGlobal(path)) {
|
||||
if (Ember.isGlobalPath(path)) {
|
||||
Ember.bind(options.data.keywords, keywordName, path);
|
||||
} else {
|
||||
normalized = normalizePath(this, path, options.data);
|
||||
|
@ -20114,8 +20127,8 @@ Ember.$(document).ready(
|
|||
|
||||
})();
|
||||
|
||||
// Version: v0.9.8.1-451-g50ee26d
|
||||
// Last commit: 50ee26d (2012-06-26 18:06:44 -0700)
|
||||
// Version: v0.9.8.1-468-g3097ea8
|
||||
// Last commit: 3097ea8 (2012-07-04 14:42:40 -0700)
|
||||
|
||||
|
||||
(function() {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1952,8 +1952,8 @@ Handlebars.VM = {
|
|||
|
||||
Handlebars.template = Handlebars.VM.template;
|
||||
;
|
||||
// Version: v0.9.8.1-451-g50ee26d
|
||||
// Last commit: 50ee26d (2012-06-26 18:06:44 -0700)
|
||||
// Version: v0.9.8.1-468-g3097ea8
|
||||
// Last commit: 3097ea8 (2012-07-04 14:42:40 -0700)
|
||||
|
||||
|
||||
(function() {
|
||||
|
@ -2090,8 +2090,8 @@ window.ember_deprecateFunc = Ember.deprecateFunc("ember_deprecateFunc is deprec
|
|||
|
||||
})();
|
||||
|
||||
// Version: v0.9.8.1-451-g50ee26d
|
||||
// Last commit: 50ee26d (2012-06-26 18:06:44 -0700)
|
||||
// Version: v0.9.8.1-468-g3097ea8
|
||||
// Last commit: 3097ea8 (2012-07-04 14:42:40 -0700)
|
||||
|
||||
|
||||
(function() {
|
||||
|
@ -3368,11 +3368,6 @@ function normalizeTuple(target, path) {
|
|||
return TUPLE_RET;
|
||||
}
|
||||
|
||||
/** @private */
|
||||
Ember.isGlobal = function(path) {
|
||||
return IS_GLOBAL.test(path);
|
||||
};
|
||||
|
||||
/**
|
||||
@private
|
||||
|
||||
|
@ -3436,7 +3431,8 @@ Ember.getPath = function(root, path) {
|
|||
Ember.setPath = function(root, path, value, tolerant) {
|
||||
var keyName;
|
||||
|
||||
if (typeof root === 'string' && IS_GLOBAL.test(root)) {
|
||||
if (typeof root === 'string') {
|
||||
Ember.assert("Path '" + root + "' must be global if no root is given.", IS_GLOBAL.test(root));
|
||||
value = path;
|
||||
path = root;
|
||||
root = null;
|
||||
|
@ -3490,7 +3486,7 @@ Ember.trySetPath = function(root, path, value) {
|
|||
@returns Boolean
|
||||
*/
|
||||
Ember.isGlobalPath = function(path) {
|
||||
return !HAS_THIS.test(path) && IS_GLOBAL.test(path);
|
||||
return IS_GLOBAL.test(path);
|
||||
};
|
||||
|
||||
})();
|
||||
|
@ -12586,9 +12582,17 @@ var get = Ember.get, set = Ember.set;
|
|||
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());
|
||||
},
|
||||
|
||||
/**
|
||||
@private
|
||||
|
||||
Used to give history a starting reference
|
||||
*/
|
||||
_initialURL: null,
|
||||
|
||||
/**
|
||||
@private
|
||||
|
||||
|
@ -12604,12 +12608,13 @@ Ember.HistoryLocation = Ember.Object.extend({
|
|||
Uses `history.pushState` to update the url without a page reload.
|
||||
*/
|
||||
setURL: function(path) {
|
||||
var state = window.history.state;
|
||||
var state = window.history.state,
|
||||
initialURL = get(this, '_initialURL');
|
||||
|
||||
if (path === "") { path = '/'; }
|
||||
// We only want pushState to be executed if we are passing
|
||||
// in a new path, otherwise a new state will be inserted
|
||||
// for the same path.
|
||||
if (!state || (state && state.path !== path)) {
|
||||
|
||||
if ((initialURL && initialURL !== path) || (state && state.path !== path)) {
|
||||
set(this, '_initialURL', null);
|
||||
window.history.pushState({ path: path }, null, path);
|
||||
}
|
||||
},
|
||||
|
@ -13478,8 +13483,6 @@ Ember.ControllerMixin.reopen({
|
|||
if (controller && context) { controller.set('content', context); }
|
||||
view = viewClass.create();
|
||||
if (controller) { set(view, 'controller', controller); }
|
||||
|
||||
/* console.log(view, view.toString()) */
|
||||
set(this, outletName, view);
|
||||
|
||||
return view;
|
||||
|
@ -13531,6 +13534,17 @@ 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);
|
||||
|
||||
|
@ -13999,17 +14013,7 @@ Ember.View = Ember.Object.extend(Ember.Evented,
|
|||
|
||||
@type Object
|
||||
*/
|
||||
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(),
|
||||
|
||||
controller: controllerProperty,
|
||||
/**
|
||||
A view may contain a layout. A layout is a regular template but
|
||||
supersedes the `template` property during rendering. It is the
|
||||
|
@ -14074,20 +14078,22 @@ Ember.View = Ember.Object.extend(Ember.Evented,
|
|||
to be re-rendered.
|
||||
*/
|
||||
_context: Ember.computed(function(key, value) {
|
||||
var parentView, controller;
|
||||
var parentView, context;
|
||||
|
||||
if (arguments.length === 2) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (VIEW_PRESERVES_CONTEXT) {
|
||||
if (controller = get(this, 'controller')) {
|
||||
return controller;
|
||||
if (Ember.meta(this).descs.controller !== controllerProperty) {
|
||||
if (context = get(this, 'controller')) {
|
||||
return context;
|
||||
}
|
||||
}
|
||||
|
||||
parentView = get(this, '_parentView');
|
||||
if (parentView) {
|
||||
return get(parentView, '_context');
|
||||
if (parentView && (context = get(parentView, '_context'))) {
|
||||
return context;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16757,6 +16763,12 @@ Ember.State = Ember.Object.extend(Ember.Evented,
|
|||
return !get(this, 'childStates').length;
|
||||
}).cacheable(),
|
||||
|
||||
/**
|
||||
A boolean value indicating whether the state takes a context.
|
||||
By default we assume all states take contexts.
|
||||
*/
|
||||
hasContext: true,
|
||||
|
||||
/**
|
||||
This is the default transition event.
|
||||
|
||||
|
@ -17277,7 +17289,6 @@ Ember.StateManager = Ember.State.extend(
|
|||
|
||||
send: function(event, context) {
|
||||
Ember.assert('Cannot send event "' + event + '" while currentState is ' + get(this, 'currentState'), get(this, 'currentState'));
|
||||
if (arguments.length === 1) { context = {}; }
|
||||
return this.sendRecursively(event, get(this, 'currentState'), context);
|
||||
},
|
||||
|
||||
|
@ -17426,7 +17437,7 @@ Ember.StateManager = Ember.State.extend(
|
|||
exitStates.shift();
|
||||
}
|
||||
|
||||
currentState.pathsCache[name] = {
|
||||
currentState.pathsCache[path] = {
|
||||
exitStates: exitStates,
|
||||
enterStates: enterStates,
|
||||
resolveState: resolveState
|
||||
|
@ -17444,7 +17455,7 @@ Ember.StateManager = Ember.State.extend(
|
|||
exitStates.unshift(state);
|
||||
}
|
||||
|
||||
useContext = context && (!get(state, 'isRoutable') || get(state, 'isDynamic'));
|
||||
useContext = context && get(state, 'hasContext');
|
||||
matchedContexts.unshift(useContext ? contexts.pop() : null);
|
||||
}
|
||||
|
||||
|
@ -17456,6 +17467,7 @@ Ember.StateManager = Ember.State.extend(
|
|||
state = getPath(state, 'states.'+initialState);
|
||||
if (!state) { break; }
|
||||
enterStates.push(state);
|
||||
matchedContexts.push(undefined);
|
||||
}
|
||||
|
||||
while (enterStates.length > 0) {
|
||||
|
@ -17686,9 +17698,10 @@ Ember.Routable = Ember.Mixin.create({
|
|||
/**
|
||||
@private
|
||||
|
||||
Check whether the route has dynamic segments
|
||||
Check whether the route has dynamic segments and therefore takes
|
||||
a context.
|
||||
*/
|
||||
isDynamic: Ember.computed(function() {
|
||||
hasContext: Ember.computed(function() {
|
||||
var routeMatcher = get(this, 'routeMatcher');
|
||||
if (routeMatcher) {
|
||||
return routeMatcher.identifiers.length > 0;
|
||||
|
@ -18293,7 +18306,7 @@ var get = Ember.get, getPath = Ember.getPath, set = Ember.set;
|
|||
{{/each}}
|
||||
</script>
|
||||
|
||||
See Handlebars.helpers.actions for additional usage examples.
|
||||
See Handlebars.helpers.action for additional usage examples.
|
||||
|
||||
|
||||
## Changing View Hierarchy in Response To State Change
|
||||
|
@ -19913,7 +19926,7 @@ EmberHandlebars.registerHelper('with', function(context, options) {
|
|||
|
||||
Ember.assert("You must pass a block to the with helper", options.fn && options.fn !== Handlebars.VM.noop);
|
||||
|
||||
if (Ember.isGlobal(path)) {
|
||||
if (Ember.isGlobalPath(path)) {
|
||||
Ember.bind(options.data.keywords, keywordName, path);
|
||||
} else {
|
||||
normalized = normalizePath(this, path, options.data);
|
||||
|
@ -22068,8 +22081,8 @@ Ember.$(document).ready(
|
|||
|
||||
})();
|
||||
|
||||
// Version: v0.9.8.1-451-g50ee26d
|
||||
// Last commit: 50ee26d (2012-06-26 18:06:44 -0700)
|
||||
// Version: v0.9.8.1-468-g3097ea8
|
||||
// Last commit: 3097ea8 (2012-07-04 14:42:40 -0700)
|
||||
|
||||
|
||||
(function() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user