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: ->
|
||||
@get('user').sync()
|
||||
|
||||
toggle: (hook) ->
|
||||
hook.toggle()
|
||||
|
|
|
@ -23,6 +23,9 @@ Travis.ProfileController = Travis.Controller.extend
|
|||
sync: ->
|
||||
@get('user').sync()
|
||||
|
||||
toggle: (hook) ->
|
||||
hook.toggle()
|
||||
|
||||
activate: (action, params) ->
|
||||
@setParams(params || @get('params'))
|
||||
this["view#{$.camelize(action)}"]()
|
||||
|
|
|
@ -73,7 +73,7 @@ require 'config/emoij'
|
|||
string
|
||||
|
||||
_nowUtc: ->
|
||||
@_toUtc new Date()
|
||||
@_toUtc Travis.currentDate()
|
||||
|
||||
_toUtc: (date) ->
|
||||
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) ->
|
||||
@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.Build', {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
<div class="controls">
|
||||
<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}}
|
||||
ON
|
||||
{{else}}
|
||||
|
|
|
@ -33,13 +33,13 @@ Travis.ajax = Em.Object.create
|
|||
|
||||
success = options.success || (->)
|
||||
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?
|
||||
success.apply(this, arguments)
|
||||
|
||||
error = options.error || (->)
|
||||
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?
|
||||
error.apply(this, arguments)
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ minispade.require 'app'
|
|||
url = "/#{url}" unless url.match /^\//
|
||||
Travis.__container__.lookup('router:main').handleURL(url)
|
||||
|
||||
_Date = Date
|
||||
@Date = (date) ->
|
||||
new _Date(date || '2012-07-02T00:03:00Z')
|
||||
@Date.UTC = _Date.UTC
|
||||
|
||||
now = -> new Date('2012-07-02T00:03:00Z')
|
||||
$.timeago.settings.nowFunction = -> now().getTime()
|
||||
Travis.currentDate = now
|
||||
|
||||
# hacks for missing features in webkit
|
||||
unless Function::bind
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
require 'ext/jquery'
|
||||
require 'ext/ember/namespace'
|
||||
|
||||
window.ENV ||= {}
|
||||
window.ENV.RAISE_ON_DEPRECATION = true
|
||||
|
||||
# TODO: how can I put it in Travis namespace and use immediately?
|
||||
Storage = Em.Object.extend
|
||||
init: ->
|
||||
|
@ -77,6 +80,9 @@ window.Travis = Em.Application.extend(Ember.Evented,
|
|||
location.href = location.href.replace('#!/', '') if location.hash.slice(0, 2) == '#!'
|
||||
I18n.fallbacks = true
|
||||
@setLocale 'locale', @get('defaultLocale')
|
||||
|
||||
currentDate: ->
|
||||
new Date()
|
||||
).create()
|
||||
|
||||
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',
|
||||
year: 'about a year',
|
||||
years: '%d years',
|
||||
numbers: []
|
||||
}
|
||||
numbers: [],
|
||||
},
|
||||
nowFunction: function() { return new Date().getTime(); }
|
||||
},
|
||||
distanceInWords: function(date) {
|
||||
if(!date) {
|
||||
|
@ -95,7 +96,7 @@
|
|||
return (this.now() - date.getTime());
|
||||
},
|
||||
now: function() {
|
||||
return new Date().getTime();
|
||||
return this.settings.nowFunction.call(this);
|
||||
},
|
||||
parse: function(iso8601) {
|
||||
var s = $.trim(iso8601);
|
||||
|
|
Loading…
Reference in New Issue
Block a user