travis-web/assets/scripts/app/router.coffee
Piotr Sarnacki b0b1ef305b Change the way config is stored
On ember-cli config is stored in config/environment.js file and it can be
accessed at any time of app being booted. Till now we were using Travis.config
which was making things hard, because we needed an application instance to get
any config value. This commit moves config to config/environment.js and allows
to access it at any point of loading the app.
2015-01-30 15:29:46 +01:00

58 lines
1.6 KiB
CoffeeScript

require 'travis/location'
require 'routes/application'
config = ENV.config
Router = Ember.Router.extend
location: 'history'
handleURL: (url) ->
url = url.replace(/#.*?$/, '')
@_super(url)
didTransition: ->
@_super.apply @, arguments
if Travis.config.ga_code
_gaq.push ['_trackPageview', location.pathname]
Router.map ->
@resource 'dashboard', ->
@route 'repositories', path: '/'
@resource 'main', path: '/', ->
@resource 'getting_started'
@route 'recent'
@route 'repositories'
@route 'my_repositories'
@route 'search', path: '/search/:phrase'
@resource 'repo', path: '/:owner/:name', ->
@route 'index', path: '/'
@resource 'build', path: '/builds/:build_id'
@resource 'job', path: '/jobs/:job_id'
@resource 'builds', path: '/builds'
@resource 'pullRequests', path: '/pull_requests'
@resource 'branches', path: '/branches'
@resource 'requests', path: '/requests'
@resource 'caches', path: '/caches' if config.endpoints.caches
@resource 'request', path: '/requests/:request_id'
@resource 'settings', ->
@route 'index', path: '/'
@resource 'env_vars', ->
@route 'new'
@resource 'ssh_key' if config.endpoints.ssh_key
@route 'first_sync'
@route 'insufficient_oauth_permissions'
@route 'auth', path: '/auth'
@resource 'profile', path: '/profile', ->
@resource 'accounts', path: '/', ->
@resource 'account', path: '/:login'
@route 'info', path: '/info'
@route 'notFound', path: "/*path"
Travis.Router = Router