Merge branch 'master' into dashboard

Conflicts:
	assets/scripts/app/controllers.coffee
	assets/scripts/app/routes.coffee
This commit is contained in:
Piotr Sarnacki 2015-01-19 13:09:30 +01:00
commit a5978dd36f
9 changed files with 39 additions and 12 deletions

View File

@ -8,6 +8,7 @@ cache:
bundler: true
matrix:
fast_finish: true
allow_failures:
- rvm: 2.1.2
env: 'TEST_SUITE=phantomjs'

View File

@ -48,7 +48,8 @@ Ember.Handlebars.registerHelper('label', (options) ->
options.hash.for = id
options.hashTypes.for = 'STRING'
options.hashContexts.for = this
options.fn = Ember.Handlebars.compile("{{view.content}}")
if options.hash.content
options.fn = Ember.Handlebars.compile("{{view.content}}")
Ember.Handlebars.helpers.view.call(this, view, options)
)

View File

@ -61,6 +61,7 @@ require 'routes/getting_started'
require 'routes/insufficient_oauth_permissions'
require 'routes/job'
require 'routes/main/index'
require 'routes/main/error'
require 'routes/main/my_repositories'
require 'routes/main/recent'
require 'routes/main/repositories'

View File

@ -15,11 +15,11 @@ Route = TravisRoute.extend
actions:
afterSignIn: ->
@transitionTo('index')
@transitionTo('main')
return true
redirect: ->
if @signedIn()
@transitionTo('index')
@transitionTo('main')
Travis.AuthRoute = Route

View File

@ -8,12 +8,14 @@
<li class="home">
{{#link-to "main"}}Home{{/link-to}}
</li>
<li>
<a href="http://blog.travis-ci.com">Blog</a>
</li>
<li>
<a href="http://traviscistatus.com">Status</a>
</li>
{{#unless config.enterprise}}
<li>
<a href="http://blog.travis-ci.com">Blog</a>
</li>
<li>
<a href="http://traviscistatus.com">Status</a>
</li>
{{/unless}}
{{#unless config.pro}}
<li class="menu community">
<p class="handle">

View File

@ -82,7 +82,10 @@ $.extend Travis,
show_repos_hint: 'private'
avatar_default_url: 'https://travis-ci.org/images/ui/default-avatar.png'
pusher_log_fallback: $('meta[name="travis.pusher_log_fallback"]').attr('value') == 'true'
pro: $('meta[name="travis.pro"]').attr('value') == 'true'
# for now I set pro to true also for enterprise, but it should be changed
# to allow more granular config later
pro: $('meta[name="travis.pro"]').attr('value') == 'true' || $('meta[name="travis.enterprise"]').attr('value') == 'true'
enterprise: $('meta[name="travis.enterprise"]').attr('value') == 'true'
pages_endpoint: pages_endpoint || billing_endpoint
billing_endpoint: billing_endpoint

View File

@ -44,6 +44,11 @@ if ENV['TRAVIS_PRO']
ENV['CODE_CLIMATE'] = 'true' unless ENV.has_key?('CODE_CLIMATE')
end
if ENV['TRAVIS_ENTERPRISE']
ENV['SSH_KEY_ENABLED'] = 'true' unless ENV.has_key?('SSH_KEY_ENABLED')
ENV['CACHES_ENABLED'] = 'true' unless ENV.has_key?('CACHES_ENABLED')
end
run Travis::Web::App.build(
environment: ENV['RACK_ENV'] || 'development',
api_endpoint: ENV['API_ENDPOINT'],
@ -62,6 +67,8 @@ run Travis::Web::App.build(
charm_key: ENV['CHARM_KEY'],
customer_io_site_id: ENV['CUSTOMER_IO_SITE_ID'],
pro: ENV['TRAVIS_PRO'],
enterprise: ENV['TRAVIS_ENTERPRISE'],
code_climate: ENV['CODE_CLIMATE'],
code_climate_url: ENV['CODE_CLIMATE_URL']
code_climate_url: ENV['CODE_CLIMATE_URL'],
assets_host: ENV['ASSETS_HOST']
)

View File

@ -158,13 +158,24 @@ class Travis::Web::App
content.gsub!(/\{\{title\}\}/, ENV['SITE_TITLE'] || default_title)
end
def set_assets_host(content)
content.gsub!(/\{\{assets_host\}\}/, ENV['ASSETS_HOST'] || '')
end
def set_config(string, opts = {})
string.gsub! %r(<meta (rel|name)="travis\.([^"]*)" (href|value)="([^"]*)"[^>]*>) do
%(<meta #{$1}="travis.#{$2}" #{$3}="#{options[$2.to_sym] || $4}">)
end
string.gsub! %r{(src|href)="(?:\/?)((styles|scripts)\/[^"]*)"} do
%(#{$1}=#{opts[:alt] ? "#{S3_URL}/#{opts[:alt]}/#{$2}":"/#{$2}"})
src = if options[:assets_host]
"#{options[:assets_host].chomp('/')}/#{$2}"
elsif opts[:alt]
"#{S3_URL}/#{opts[:alt]}/#{$2}"
else
"/#{$2}"
end
%(#{$1}="#{src}")
end
end
end

View File

@ -16,6 +16,7 @@
<meta name="travis.pusher_log_fallback" value="false">
<meta name="travis.charm_key" value="gy5gx7dy6dh86hxzkz1wmtvupwvievu">
<meta name="travis.pro" value="false">
<meta name="travis.enterprise" value="false">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{title}}</title>
<link rel="dns-prefetch" href="//api.travis-ci.org">