Inject config into controllers.

Avoid deprecations from globals in template.
This commit is contained in:
Robert Jackson 2014-11-05 15:29:26 -05:00
parent aa7fab4cc0
commit e40d8a282f
No known key found for this signature in database
GPG Key ID: B3D10EF8171F7219
4 changed files with 13 additions and 4 deletions

View File

@ -75,7 +75,7 @@
{{/if}}
</h5>
</li>
{{#if Travis.config.caches_enabled}}
{{#if config.caches_enabled}}
<li id="tab_caches" {{bind-attr class="view.classCaches"}}>
<h5>
{{#if repo.slug}}

View File

@ -19,7 +19,7 @@
<li>
{{#link-to "requests" view.repo}}Requests{{/link-to}}
</li>
{{#if Travis.config.caches_enabled}}
{{#if config.caches_enabled}}
<li>
{{#link-to "caches" view.repo}}Caches{{/link-to}}
</li>
@ -68,7 +68,7 @@
<p>
Integrating <a href="https://codeclimate.com">Code Climate's test coverage</a> reporting with your test
suite on Travis CI allows to track changes in coverage over time. If you haven't tried it out already, <a
{{bind-attr href="Travis.config.code_climate_url"}}" target="_blank">sign
{{bind-attr href=config.code_climate_url}}" target="_blank">sign
up today</a> to improve your code's quality. New customers get 20% off for the first three months!
</p>

View File

@ -1,7 +1,7 @@
<ul class="navigation">
<li>{{#link-to "settings.index"}}General Settings{{/link-to}}</li>
<li>{{#link-to "env_vars"}}Environment Variables{{/link-to}}</li>
{{#if Travis.config.ssh_key_enabled}}
{{#if config.ssh_key_enabled}}
<li>{{#link-to "ssh_key"}}SSH Key{{/link-to}}</li>
{{/if}}
</ul>

View File

@ -154,6 +154,15 @@ Travis.initializer
s = document.getElementsByTagName('script')[0]
s.parentNode.insertBefore(ga, s)
Travis.initializer
name: 'inject-config'
initialize: (container, application) ->
application.register 'config:main', Travis.config, { instantiate: false }
application.inject('controller', 'config', 'config:main')
Travis.Router.reopen
didTransition: ->
@_super.apply @, arguments