Merge branch 'master' into insufficient-oauth-permissions
Conflicts: assets/scripts/app/routes.coffee
This commit is contained in:
commit
06d90dbc9b
2
Gemfile
2
Gemfile
|
@ -17,12 +17,12 @@ group :assets do
|
|||
gem 'tilt'
|
||||
gem 'uglifier'
|
||||
gem 'yui-compressor'
|
||||
gem 'libv8', '~> 3.16.0'
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
gem 'rake'
|
||||
gem 'localeapp'
|
||||
gem 'handlebars'
|
||||
gem 'localeapp-handlebars_i18n'
|
||||
end
|
||||
|
||||
|
|
12
Gemfile.lock
12
Gemfile.lock
|
@ -29,7 +29,6 @@ GEM
|
|||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.5.0)
|
||||
commonjs (0.2.6)
|
||||
compass (0.12.2)
|
||||
chunky_png (~> 1.2)
|
||||
fssm (>= 0.2.7)
|
||||
|
@ -48,12 +47,9 @@ GEM
|
|||
pry (>= 0.9.10)
|
||||
terminal-table (>= 1.4.3)
|
||||
thor (>= 0.14.6)
|
||||
handlebars (0.4.0)
|
||||
commonjs (~> 0.2.3)
|
||||
therubyracer (~> 0.11.1)
|
||||
i18n (0.6.3)
|
||||
json (1.7.7)
|
||||
libv8 (3.11.8.13)
|
||||
libv8 (3.16.14.3)
|
||||
listen (0.7.3)
|
||||
localeapp (0.6.9)
|
||||
gli
|
||||
|
@ -89,7 +85,6 @@ GEM
|
|||
rake-pipeline-i18n-filters (0.0.5)
|
||||
rake-pipeline (~> 0.6)
|
||||
rb-fsevent (0.9.3)
|
||||
ref (1.0.2)
|
||||
rerun (0.8.0)
|
||||
listen
|
||||
rest-client (1.6.7)
|
||||
|
@ -116,9 +111,6 @@ GEM
|
|||
tilt (~> 1.3)
|
||||
slop (3.4.3)
|
||||
terminal-table (1.4.5)
|
||||
therubyracer (0.11.4)
|
||||
libv8 (~> 3.11.8.12)
|
||||
ref
|
||||
thor (0.17.0)
|
||||
tilt (1.3.3)
|
||||
uglifier (1.3.0)
|
||||
|
@ -136,7 +128,7 @@ DEPENDENCIES
|
|||
compass
|
||||
foreman
|
||||
guard
|
||||
handlebars
|
||||
libv8 (~> 3.16.0)
|
||||
localeapp
|
||||
localeapp-handlebars_i18n
|
||||
puma
|
||||
|
|
|
@ -48,6 +48,14 @@ Travis.FirstSyncController = Em.Controller.extend
|
|||
|
||||
isSyncing: Ember.computed.alias('user.isSyncing')
|
||||
|
||||
Travis.BuildNotFoundController = Em.Controller.extend
|
||||
needs: ['repo', 'currentUser']
|
||||
ownedAndActive: (->
|
||||
if permissions = @get('controllers.currentUser.permissions')
|
||||
if repo = @get('controllers.repo.repo')
|
||||
repo.get('active') && permissions.contains(parseInt(repo.get('id')))
|
||||
).property('controllers.repo.repo', 'controllers.currentUser.permissions')
|
||||
|
||||
require 'controllers/accounts'
|
||||
require 'controllers/build'
|
||||
require 'controllers/builds'
|
||||
|
|
|
@ -6,7 +6,7 @@ Travis.ReposController = Ember.ArrayController.extend
|
|||
'owned'
|
||||
else
|
||||
'recent'
|
||||
).property('currentUser')
|
||||
).property('currentUser.id')
|
||||
|
||||
currentUserIdDidChange: (->
|
||||
if @get('currentUser.id')
|
||||
|
@ -16,10 +16,10 @@ Travis.ReposController = Ember.ArrayController.extend
|
|||
).observes('currentUser.id')
|
||||
|
||||
tabOrIsLoadedDidChange: (->
|
||||
if @get('tab') == 'owned' && @get('isLoaded') && @get('length') == 0
|
||||
|
||||
@container.lookup('router:main').send('renderNoOwnedRepos')
|
||||
).observes('isLoaded', 'tab')
|
||||
Ember.run.scheduleOnce 'routerTransitions', this, ->
|
||||
if @get('tab') == 'owned' && @get('isLoaded') && @get('length') == 0
|
||||
@container.lookup('router:main').send('renderNoOwnedRepos')
|
||||
).observes('isLoaded', 'tab', 'length')
|
||||
|
||||
isLoadedBinding: 'content.isLoaded'
|
||||
needs: ['currentUser', 'repo']
|
||||
|
|
|
@ -12,6 +12,7 @@ require 'travis/model'
|
|||
lastBuildFinishedAt: Ember.attr('string')
|
||||
githubLanguage: Ember.attr('string')
|
||||
_lastBuildDuration: Ember.attr(Number, key: 'last_build_duration')
|
||||
active: Ember.attr('boolean')
|
||||
|
||||
lastBuild: Ember.belongsTo('Travis.Build', key: 'last_build_id')
|
||||
|
||||
|
@ -113,7 +114,7 @@ require 'travis/model'
|
|||
@find(owner_name: login, orderBy: 'name')
|
||||
|
||||
accessibleBy: (login) ->
|
||||
@find(member: login, orderBy: 'name')
|
||||
@find(member: login, active: true)
|
||||
|
||||
search: (query) ->
|
||||
@find(search: query, orderBy: 'name')
|
||||
|
|
|
@ -125,7 +125,8 @@ Travis.SetupLastBuild = Ember.Mixin.create
|
|||
# TODO: it would be nicer to do it with promises
|
||||
repo = @controllerFor('repo').get('repo')
|
||||
if repo && repo.get('isLoaded') && !repo.get('lastBuild')
|
||||
@render('builds/not_found', outlet: 'pane', into: 'repo')
|
||||
Ember.run.next =>
|
||||
@render('builds/not_found', outlet: 'pane', into: 'repo', controller: 'buildNotFound')
|
||||
|
||||
Travis.GettingStartedRoute = Ember.Route.extend
|
||||
setupController: ->
|
||||
|
@ -150,7 +151,12 @@ Travis.SimpleLayoutRoute = Ember.Route.extend
|
|||
@render 'top', outlet: 'top'
|
||||
@_super.apply(this, arguments)
|
||||
|
||||
Travis.FirstSyncRoute = Travis.SimpleLayoutRoute.extend()
|
||||
Travis.FirstSyncRoute = Travis.SimpleLayoutRoute.extend
|
||||
events:
|
||||
# do nothing, we are showing first sync, so it's normal that there is
|
||||
# no owned repos
|
||||
renderNoOwnedRepos: (->)
|
||||
|
||||
Travis.InsufficientOauthPermissionsRoute = Travis.SimpleLayoutRoute.extend
|
||||
setupController: (controller) ->
|
||||
@_super.apply this, arguments
|
||||
|
@ -289,7 +295,8 @@ Travis.RepoRoute = Ember.Route.extend
|
|||
proxy.set 'isLoading', false
|
||||
|
||||
if repos.get('length') == 0
|
||||
self.render('repos/not_found', outlet: 'main')
|
||||
Ember.run.next ->
|
||||
self.render('repos/not_found', outlet: 'main')
|
||||
else
|
||||
proxy.set 'content', repos.objectAt(0)
|
||||
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
There are no builds for this repository.
|
||||
{{#if ownedAndActive}}
|
||||
This repository is active, but there are no builds yet. Builds will appear here after you push new commits to the repository.
|
||||
{{else}}
|
||||
There are no builds for this repository.
|
||||
{{/if}}
|
||||
|
|
|
@ -14,11 +14,14 @@
|
|||
{{#linkTo "repo" this class="slug"}}{{slug}}{{/linkTo}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{#with lastBuildHash}}
|
||||
{{#if repo.slug}}
|
||||
{{#linkTo "build" repo id class="last_build"}}{{number}}{{/linkTo}}
|
||||
{{/if}}
|
||||
{{/with}}
|
||||
|
||||
{{#if lastBuildHash.number}}
|
||||
{{#with lastBuildHash}}
|
||||
{{#if repo.slug}}
|
||||
{{#linkTo "build" repo id class="last_build"}}{{number}}{{/linkTo}}
|
||||
{{/if}}
|
||||
{{/with}}
|
||||
{{/if}}
|
||||
|
||||
<p class="summary">
|
||||
<span class="duration-icon"></span><span class="duration_label">{{t repositories.duration}}:</span>
|
||||
|
|
|
@ -43,7 +43,7 @@ Travis.FirstSyncView = Travis.View.extend
|
|||
).then(null, (e) ->
|
||||
console.log('There was a problem while redirecting from first sync', e)
|
||||
)
|
||||
, 5000
|
||||
, Travis.config.syncingPageRedirectionTime
|
||||
|
||||
require 'views/accounts'
|
||||
require 'views/application'
|
||||
|
|
|
@ -5,7 +5,6 @@ module "My repos",
|
|||
Ember.run -> Travis.reset()
|
||||
|
||||
test "my repos is active by default when user is signed in", ->
|
||||
|
||||
Ember.run -> signInUser()
|
||||
visit('/').then ->
|
||||
wait().then ->
|
||||
|
|
26
assets/scripts/spec/integration/sync.coffee
Normal file
26
assets/scripts/spec/integration/sync.coffee
Normal file
|
@ -0,0 +1,26 @@
|
|||
module "Sync",
|
||||
setup: ->
|
||||
Ember.run -> Travis.advanceReadiness()
|
||||
teardown: ->
|
||||
Ember.run -> Travis.reset()
|
||||
|
||||
test "first sync page is show when user just signed up and is syncing", ->
|
||||
Ember.run ->
|
||||
signInUser(
|
||||
is_syncing: true
|
||||
synced_at: null
|
||||
login: 'new-user'
|
||||
)
|
||||
|
||||
Travis.config.syncingPageRedirectionTime = 100
|
||||
|
||||
wait().then ->
|
||||
ok $('#first_sync').text().match(/Just a few more seconds as we talk to GitHub to find out which repositories belong to you./)
|
||||
|
||||
stop()
|
||||
Travis.__container__.lookup('controller:currentUser').get('content').set('isSyncing', false)
|
||||
setTimeout ->
|
||||
start()
|
||||
visit('/').then ->
|
||||
ok $('#getting-started').text().match(/Welcome to Travis CI!/)
|
||||
, 120
|
|
@ -16,15 +16,19 @@ Ember.Container.prototype.stub = (fullName, instance) ->
|
|||
instance.destroy = instance.destroy || (->)
|
||||
this.cache.dict[fullName] = instance
|
||||
|
||||
window.signInUser = ->
|
||||
window.signInUser = (data) ->
|
||||
data ||= {}
|
||||
userData = {
|
||||
id: 1
|
||||
email: 'tyrion@example.org'
|
||||
login: 'tyrion'
|
||||
token: 'abcdef'
|
||||
}
|
||||
userData = Ember.merge(userData, data)
|
||||
# for now let's just use harcoded data to log in the user,
|
||||
# we may extend it in the future to pass specific user data
|
||||
Travis.auth.signIn
|
||||
user:
|
||||
id: 1
|
||||
email: 'tyrion@example.org'
|
||||
login: 'tyrion'
|
||||
token: 'abcdef'
|
||||
user: userData
|
||||
token: 'abcdef'
|
||||
|
||||
#@app = (url, options = {}) ->
|
||||
|
|
|
@ -71,6 +71,7 @@ $.extend Travis,
|
|||
Travis.advanceReadiness() # bc, remove once merged to master
|
||||
|
||||
config:
|
||||
syncingPageRedirectionTime: 5000
|
||||
api_endpoint: $('meta[rel="travis.api_endpoint"]').attr('href')
|
||||
pusher_key: $('meta[name="travis.pusher_key"]').attr('value')
|
||||
ga_code: $('meta[name="travis.ga_code"]').attr('value')
|
||||
|
|
Loading…
Reference in New Issue
Block a user