Merge branch 'ps-ember-update' of github.com:travis-ci/travis-web into ps-ember-update
This commit is contained in:
commit
4c699f18c3
|
@ -5,3 +5,6 @@ Travis.AccountIndexController = Em.Controller.extend
|
||||||
|
|
||||||
sync: ->
|
sync: ->
|
||||||
@get('user').sync()
|
@get('user').sync()
|
||||||
|
|
||||||
|
toggle: (hook) ->
|
||||||
|
hook.toggle()
|
||||||
|
|
|
@ -23,6 +23,9 @@ Travis.ProfileController = Travis.Controller.extend
|
||||||
sync: ->
|
sync: ->
|
||||||
@get('user').sync()
|
@get('user').sync()
|
||||||
|
|
||||||
|
toggle: (hook) ->
|
||||||
|
hook.toggle()
|
||||||
|
|
||||||
activate: (action, params) ->
|
activate: (action, params) ->
|
||||||
@setParams(params || @get('params'))
|
@setParams(params || @get('params'))
|
||||||
this["view#{$.camelize(action)}"]()
|
this["view#{$.camelize(action)}"]()
|
||||||
|
|
|
@ -73,7 +73,7 @@ require 'config/emoij'
|
||||||
string
|
string
|
||||||
|
|
||||||
_nowUtc: ->
|
_nowUtc: ->
|
||||||
@_toUtc new Date()
|
@_toUtc Travis.currentDate()
|
||||||
|
|
||||||
_toUtc: (date) ->
|
_toUtc: (date) ->
|
||||||
Date.UTC date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()
|
Date.UTC date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()
|
||||||
|
|
|
@ -102,6 +102,18 @@ Travis.RestAdapter = DS.RESTAdapter.extend
|
||||||
merge: (store, record, serialized) ->
|
merge: (store, record, serialized) ->
|
||||||
@get('serializer').merge(record, serialized)
|
@get('serializer').merge(record, serialized)
|
||||||
|
|
||||||
|
didSaveRecord: (store, type, record, payload) ->
|
||||||
|
# API sometimes return { result: true } response
|
||||||
|
# which does not play nice with ember-data. For now
|
||||||
|
# let's just change payload to have serialized record
|
||||||
|
# included, but ideally it should be fixed in the API
|
||||||
|
# to be consistent across all the endpoints.
|
||||||
|
if payload?.result == true
|
||||||
|
payload = {}
|
||||||
|
payload[type.singularName()] = record.serialize()
|
||||||
|
|
||||||
|
@_super(store, type, record, payload)
|
||||||
|
|
||||||
Travis.RestAdapter.map 'Travis.Commit', {}
|
Travis.RestAdapter.map 'Travis.Commit', {}
|
||||||
|
|
||||||
Travis.RestAdapter.map 'Travis.Build', {
|
Travis.RestAdapter.map 'Travis.Build', {
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<a {{bindAttr href="hook.urlGithubAdmin"}} class="github-admin tool-tip" title="Github service hooks admin page"></a>
|
<a {{bindAttr href="hook.urlGithubAdmin"}} class="github-admin tool-tip" title="Github service hooks admin page"></a>
|
||||||
<a {{action toggle target="hook"}} class="switch">
|
<a {{action toggle hook}} class="switch">
|
||||||
{{#if hook.active}}
|
{{#if hook.active}}
|
||||||
ON
|
ON
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
|
@ -33,13 +33,13 @@ Travis.ajax = Em.Object.create
|
||||||
|
|
||||||
success = options.success || (->)
|
success = options.success || (->)
|
||||||
options.success = (data) =>
|
options.success = (data) =>
|
||||||
Travis.lookup('controller:flash').loadFlashes(data.flash) if data.flash
|
Travis.lookup('controller:flash').loadFlashes(data.flash) if data?.flash
|
||||||
delete data.flash if data?
|
delete data.flash if data?
|
||||||
success.apply(this, arguments)
|
success.apply(this, arguments)
|
||||||
|
|
||||||
error = options.error || (->)
|
error = options.error || (->)
|
||||||
options.error = (data) =>
|
options.error = (data) =>
|
||||||
Travis.lookup('controller:flash').pushObject(data.flash) if data.flash
|
Travis.lookup('controller:flash').pushObject(data.flash) if data?.flash
|
||||||
delete data.flash if data?
|
delete data.flash if data?
|
||||||
error.apply(this, arguments)
|
error.apply(this, arguments)
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,10 @@ minispade.require 'app'
|
||||||
url = "/#{url}" unless url.match /^\//
|
url = "/#{url}" unless url.match /^\//
|
||||||
Travis.__container__.lookup('router:main').handleURL(url)
|
Travis.__container__.lookup('router:main').handleURL(url)
|
||||||
|
|
||||||
_Date = Date
|
|
||||||
@Date = (date) ->
|
now = -> new Date('2012-07-02T00:03:00Z')
|
||||||
new _Date(date || '2012-07-02T00:03:00Z')
|
$.timeago.settings.nowFunction = -> now().getTime()
|
||||||
@Date.UTC = _Date.UTC
|
Travis.currentDate = now
|
||||||
|
|
||||||
# hacks for missing features in webkit
|
# hacks for missing features in webkit
|
||||||
unless Function::bind
|
unless Function::bind
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
require 'ext/jquery'
|
require 'ext/jquery'
|
||||||
require 'ext/ember/namespace'
|
require 'ext/ember/namespace'
|
||||||
|
|
||||||
|
window.ENV ||= {}
|
||||||
|
window.ENV.RAISE_ON_DEPRECATION = true
|
||||||
|
|
||||||
# TODO: how can I put it in Travis namespace and use immediately?
|
# TODO: how can I put it in Travis namespace and use immediately?
|
||||||
Storage = Em.Object.extend
|
Storage = Em.Object.extend
|
||||||
init: ->
|
init: ->
|
||||||
|
@ -77,6 +80,9 @@ window.Travis = Em.Application.extend(Ember.Evented,
|
||||||
location.href = location.href.replace('#!/', '') if location.hash.slice(0, 2) == '#!'
|
location.href = location.href.replace('#!/', '') if location.hash.slice(0, 2) == '#!'
|
||||||
I18n.fallbacks = true
|
I18n.fallbacks = true
|
||||||
@setLocale 'locale', @get('defaultLocale')
|
@setLocale 'locale', @get('defaultLocale')
|
||||||
|
|
||||||
|
currentDate: ->
|
||||||
|
new Date()
|
||||||
).create()
|
).create()
|
||||||
|
|
||||||
Travis.deferReadiness()
|
Travis.deferReadiness()
|
||||||
|
|
7
assets/scripts/vendor/jquery.timeago.js
vendored
7
assets/scripts/vendor/jquery.timeago.js
vendored
|
@ -41,8 +41,9 @@
|
||||||
months: '%d months',
|
months: '%d months',
|
||||||
year: 'about a year',
|
year: 'about a year',
|
||||||
years: '%d years',
|
years: '%d years',
|
||||||
numbers: []
|
numbers: [],
|
||||||
}
|
},
|
||||||
|
nowFunction: function() { return new Date().getTime(); }
|
||||||
},
|
},
|
||||||
distanceInWords: function(date) {
|
distanceInWords: function(date) {
|
||||||
if(!date) {
|
if(!date) {
|
||||||
|
@ -95,7 +96,7 @@
|
||||||
return (this.now() - date.getTime());
|
return (this.now() - date.getTime());
|
||||||
},
|
},
|
||||||
now: function() {
|
now: function() {
|
||||||
return new Date().getTime();
|
return this.settings.nowFunction.call(this);
|
||||||
},
|
},
|
||||||
parse: function(iso8601) {
|
parse: function(iso8601) {
|
||||||
var s = $.trim(iso8601);
|
var s = $.trim(iso8601);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user