make things even more generic
This commit is contained in:
parent
d6d6ef3009
commit
152dde6e05
|
@ -1,4 +1,3 @@
|
||||||
require 'travis' # hrm.
|
|
||||||
require 'auth'
|
require 'auth'
|
||||||
require 'controllers'
|
require 'controllers'
|
||||||
require 'helpers'
|
require 'helpers'
|
||||||
|
@ -56,4 +55,3 @@ Travis.reopen
|
||||||
element = $('<span></span>')
|
element = $('<span></span>')
|
||||||
$('#repository').append(element)
|
$('#repository').append(element)
|
||||||
Em.run.later (-> element.remove()), 10
|
Em.run.later (-> element.remove()), 10
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Travis.Router = Ember.Router.extend
|
Travis.Router = Ember.Router.extend
|
||||||
location: 'history'
|
location: 'history'
|
||||||
enableLogging: true
|
enableLogging: false
|
||||||
initialState: 'loading'
|
initialState: 'loading'
|
||||||
|
|
||||||
goToRoot: Ember.Route.transitionTo('root.home.show')
|
goToRoot: Ember.Route.transitionTo('root.home.show')
|
||||||
|
|
|
@ -27,14 +27,7 @@ jQuery.support.cors = true
|
||||||
|
|
||||||
$.ajax($.extend(options, @DEFAULT_OPTIONS))
|
$.ajax($.extend(options, @DEFAULT_OPTIONS))
|
||||||
|
|
||||||
@Travis.Ajax.instance = Em.Object.create(@Travis.Ajax)
|
@Travis.ajax = Em.Object.create @Travis.Ajax,
|
||||||
|
|
||||||
$.extend @Travis,
|
|
||||||
get: (url, callback) ->
|
get: (url, callback) ->
|
||||||
@ajax(url, 'get', success: callback)
|
@ajax(url, 'get', success: callback)
|
||||||
|
|
||||||
post: (url, data, callback) ->
|
|
||||||
@Ajax.instance.post(url, data, callback)
|
|
||||||
|
|
||||||
ajax: (url, method, options) ->
|
|
||||||
@Ajax.instance.ajax(url, method, options)
|
|
||||||
|
|
|
@ -34,26 +34,27 @@ require 'ext/ember/namespace'
|
||||||
INTERVALS: { sponsors: -1, times: -1, updateTimes: 1000 }
|
INTERVALS: { sponsors: -1, times: -1, updateTimes: 1000 }
|
||||||
|
|
||||||
run: (attrs) ->
|
run: (attrs) ->
|
||||||
$ =>
|
|
||||||
@redirectOnHashbang()
|
|
||||||
@loadConfig (config) =>
|
|
||||||
app = Travis.App.create(attrs || {})
|
|
||||||
# TODO: router expects the classes for controllers on main namespace, so
|
|
||||||
# if we want to keep app at Travis.app, we need to copy that, it would
|
|
||||||
# be ideal to send a patch to ember and get rid of this
|
|
||||||
$.each Travis, (key, value) ->
|
|
||||||
app[key] = value if value && value.isClass && key != 'constructor'
|
|
||||||
|
|
||||||
@app = app
|
|
||||||
@store = app.store
|
|
||||||
|
|
||||||
app.initialize()
|
|
||||||
|
|
||||||
redirectOnHashbang: ->
|
|
||||||
location.href = location.href.replace('#!/', '') if location.hash.slice(0, 2) == '#!'
|
location.href = location.href.replace('#!/', '') if location.hash.slice(0, 2) == '#!'
|
||||||
|
|
||||||
|
@loadConfig (config) =>
|
||||||
|
app = Travis.App.create(attrs || {})
|
||||||
|
# TODO: router expects the classes for controllers on main namespace, so
|
||||||
|
# if we want to keep app at Travis.app, we need to copy that, it would
|
||||||
|
# be ideal to send a patch to ember and get rid of this
|
||||||
|
$.each Travis, (key, value) ->
|
||||||
|
app[key] = value if value && value.isClass && key != 'constructor'
|
||||||
|
|
||||||
|
@app = app
|
||||||
|
@store = app.store
|
||||||
|
|
||||||
|
$ =>
|
||||||
|
app.initialize()
|
||||||
|
|
||||||
loadConfig: (callback) ->
|
loadConfig: (callback) ->
|
||||||
@get '/config', (data) =>
|
@ajax.get '/config', (data) =>
|
||||||
$.extend @config, data.config
|
$.extend @config, data.config
|
||||||
console.log "Connecting to #{data.config.api_endpoint}"
|
console.log "Connecting to #{data.config.api_endpoint}"
|
||||||
callback(data.config)
|
callback(data.config)
|
||||||
|
|
||||||
|
require 'travis/ajax'
|
||||||
|
require 'app'
|
||||||
|
|
|
@ -40,7 +40,7 @@ module Travis
|
||||||
end
|
end
|
||||||
|
|
||||||
def name(path)
|
def name(path)
|
||||||
path.sub(%r(^app/templates/), '').sub(/\.hbs$/, '')
|
path.gsub(%r(app/|templates/|.hbs), '')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
<title>Travis CI - Distributed Continuous Integration Platform for the Open Source Community</title>
|
<title>Travis CI - Distributed Continuous Integration Platform for the Open Source Community</title>
|
||||||
<link rel="icon" type="image/png" href="/favicon.ico">
|
<link rel="icon" type="image/png" href="/favicon.ico">
|
||||||
<link rel="stylesheet" href="/styles/app.css">
|
<link rel="stylesheet" href="/styles/app.css">
|
||||||
<script src="/scripts/app.min.js"></script>
|
<script src="/scripts/app.js"></script>
|
||||||
<script>
|
<script>
|
||||||
minispade.require('app')
|
minispade.require('travis')
|
||||||
Travis.run()
|
Travis.run()
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
File diff suppressed because one or more lines are too long
6
public/scripts/app.min.js
vendored
6
public/scripts/app.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
||||||
1028fd23
|
b424b81b
|
Loading…
Reference in New Issue
Block a user