changes for pro
This commit is contained in:
parent
81c0549d1d
commit
216724af64
|
@ -48,7 +48,7 @@
|
||||||
user = @storeUser(data.user) if data?.user
|
user = @storeUser(data.user) if data?.user
|
||||||
@set('state', if user then 'signed-in' else 'signed-out')
|
@set('state', if user then 'signed-in' else 'signed-out')
|
||||||
@set('user', if user then user else undefined)
|
@set('user', if user then user else undefined)
|
||||||
@afterSignIn()
|
@afterSignIn(user) if data
|
||||||
|
|
||||||
afterSignIn: ->
|
afterSignIn: ->
|
||||||
@get('app.router').send('afterSignIn', @readAfterSignInPath())
|
@get('app.router').send('afterSignIn', @readAfterSignInPath())
|
||||||
|
|
|
@ -6,7 +6,6 @@ Travis.ReposController = Ember.ArrayController.extend
|
||||||
isLoadedBinding: 'content.isLoaded'
|
isLoadedBinding: 'content.isLoaded'
|
||||||
|
|
||||||
init: ->
|
init: ->
|
||||||
@activate(@defaultTab)
|
|
||||||
Ember.run.later(@updateTimes.bind(this), Travis.INTERVALS.updateTimes)
|
Ember.run.later(@updateTimes.bind(this), Travis.INTERVALS.updateTimes)
|
||||||
|
|
||||||
updateTimes: ->
|
updateTimes: ->
|
||||||
|
@ -16,6 +15,7 @@ Travis.ReposController = Ember.ArrayController.extend
|
||||||
Ember.run.later(@updateTimes.bind(this), Travis.INTERVALS.updateTimes)
|
Ember.run.later(@updateTimes.bind(this), Travis.INTERVALS.updateTimes)
|
||||||
|
|
||||||
activate: (tab, params) ->
|
activate: (tab, params) ->
|
||||||
|
tab ||= @defaultTab
|
||||||
@set('tab', tab)
|
@set('tab', tab)
|
||||||
this["view#{$.camelize(tab)}"](params)
|
this["view#{$.camelize(tab)}"](params)
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,35 @@
|
||||||
Travis.Pusher = (key) ->
|
Travis.Pusher = (key) ->
|
||||||
@init(key) if key
|
@init(key) # if key
|
||||||
this
|
this
|
||||||
|
|
||||||
$.extend Travis.Pusher,
|
$.extend Travis.Pusher,
|
||||||
CHANNELS: ['common']
|
CHANNELS: ['common']
|
||||||
CHANNEL_PREFIX: ''
|
CHANNEL_PREFIX: ''
|
||||||
|
ENCRYPTED: false
|
||||||
|
|
||||||
$.extend Travis.Pusher.prototype,
|
$.extend Travis.Pusher.prototype,
|
||||||
active_channels: []
|
active_channels: []
|
||||||
|
|
||||||
init: (key) ->
|
init: (key) ->
|
||||||
Pusher.warn = @warn.bind(this)
|
Pusher.warn = @warn.bind(this)
|
||||||
@pusher = new Pusher(key)
|
@pusher = new Pusher(key, encrypted: Travis.Pusher.ENCRYPTED)
|
||||||
@subscribe(channel) for channel in Travis.Pusher.CHANNELS
|
@subscribeAll(Travis.Pusher.CHANNELS) if Travis.Pusher.CHANNELS
|
||||||
|
|
||||||
|
subscribeAll: (channels) ->
|
||||||
|
for channel in channels
|
||||||
|
name = @prefix(channel)
|
||||||
|
unless @pusher.channels.find(name)
|
||||||
|
channel = @pusher.channels.add(name, this)
|
||||||
|
channel.bind_all((event, data) => @receive(event, data))
|
||||||
|
@pusher.subscribeAll()
|
||||||
|
|
||||||
subscribe: (channel) ->
|
subscribe: (channel) ->
|
||||||
if @pusher && @active_channels.indexOf(channel) == -1
|
channel = @prefix(channel)
|
||||||
@active_channels.push(channel)
|
@pusher.subscribe(channel).bind_all((event, data) => @receive(event, data)) unless @pusher?.channel(channel)
|
||||||
@pusher.subscribe(@prefix(channel)).bind_all((event, data) => @receive(event, data))
|
|
||||||
|
|
||||||
unsubscribe: (channel) ->
|
unsubscribe: (channel) ->
|
||||||
ix = @active_channels.indexOf(channel)
|
channel = @prefix(channel)
|
||||||
if @pusher && ix == -1
|
@pusher.unsubscribe(channel) if @pusher?.channel(channel)
|
||||||
@active_channels.splice(ix, 1)
|
|
||||||
@pusher.unsubscribe(@prefix(channel))
|
|
||||||
|
|
||||||
prefix: (channel) ->
|
prefix: (channel) ->
|
||||||
"#{Travis.Pusher.CHANNEL_PREFIX}#{channel}"
|
"#{Travis.Pusher.CHANNEL_PREFIX}#{channel}"
|
||||||
|
|
|
@ -163,14 +163,15 @@ Travis.Router = Ember.Router.extend
|
||||||
home: Ember.Route.extend
|
home: Ember.Route.extend
|
||||||
route: '/'
|
route: '/'
|
||||||
connectOutlets: (router) ->
|
connectOutlets: (router) ->
|
||||||
router.get('applicationView').connectLayout 'home'
|
router.get('applicationView').connectLayout 'home'
|
||||||
$('body').attr('id', 'home')
|
$('body').attr('id', 'home')
|
||||||
router.get('applicationController').connectOutlet 'left', 'repos'
|
router.get('applicationController').connectOutlet 'left', 'repos'
|
||||||
router.get('applicationController').connectOutlet 'right', 'sidebar'
|
router.get('applicationController').connectOutlet 'right', 'sidebar'
|
||||||
router.get('applicationController').connectOutlet 'top', 'top'
|
router.get('applicationController').connectOutlet 'top', 'top'
|
||||||
router.get('applicationController').connectOutlet 'main', 'repo'
|
router.get('applicationController').connectOutlet 'main', 'repo'
|
||||||
router.get('applicationController').connectOutlet 'flash', 'flash'
|
router.get('applicationController').connectOutlet 'flash', 'flash'
|
||||||
router.get('repoController').set('repos', router.get('reposController'))
|
router.get('reposController').activate()
|
||||||
|
router.get('repoController').set('repos', router.get('reposController'))
|
||||||
|
|
||||||
show: Ember.Route.extend
|
show: Ember.Route.extend
|
||||||
route: '/'
|
route: '/'
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<li {{bindAttr class="view.classProfile"}}>
|
<li {{bindAttr class="view.classProfile"}}>
|
||||||
<p class="handle">
|
<p class="handle">
|
||||||
<a class="signed-out" href="#" {{action signIn target="Travis.app"}}>{{t layouts.top.github_login}}</a>
|
<a class="signed-out" href="#" {{action signIn target="Travis.app"}}>{{t layouts.top.github_login}}</a>
|
||||||
<a class="signed-in" {{action showProfile href=true}}><img {{bindAttr src="view.gravatarUrl"}}>{{user.name}}</a>
|
<a class="signed-in" {{action showProfile href=true}}><img {{bindAttr src="view.gravatarUrl"}}>{{view.userName}}</a>
|
||||||
<span class="signing-in">Signing in</span>
|
<span class="signing-in">Signing in</span>
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -10,22 +10,7 @@
|
||||||
|
|
||||||
<p class="description">{{description}}</p>
|
<p class="description">{{description}}</p>
|
||||||
|
|
||||||
<ul class="github-stats">
|
{{view Travis.RepoShowStatsView}}
|
||||||
<li class="language">
|
|
||||||
{{lastBuildLanguage}}
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a class="watchers" title="Watchers" {{bindAttr href="view.urlGithubWatchers"}}>
|
|
||||||
{{stats.watchers}}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a class="forks" title="Forks" {{bindAttr href="view.urlGithubNetwork"}}>
|
|
||||||
{{stats.forks}}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
{{view Travis.RepoShowTabsView}}
|
{{view Travis.RepoShowTabsView}}
|
||||||
{{view Travis.RepoShowToolsView}}
|
{{view Travis.RepoShowToolsView}}
|
||||||
{{/with}}
|
{{/with}}
|
||||||
|
|
17
assets/scripts/app/templates/repos/show/stats.hbs
Normal file
17
assets/scripts/app/templates/repos/show/stats.hbs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<ul class="github-stats">
|
||||||
|
<!-- <li class="language">
|
||||||
|
{{lastBuildLanguage}}
|
||||||
|
</li> -->
|
||||||
|
<li>
|
||||||
|
<a class="watchers" title="Watchers" {{bindAttr href="view.urlGithubWatchers"}}>
|
||||||
|
{{view.stats.watchers}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="forks" title="Forks" {{bindAttr href="view.urlGithubNetwork"}}>
|
||||||
|
{{view.stats.forks}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,17 @@
|
||||||
|
|
||||||
isEmpty: (->
|
isEmpty: (->
|
||||||
@get('repos.isLoaded') && @get('repos.length') == 0
|
@get('repos.isLoaded') && @get('repos.length') == 0
|
||||||
).property('repos.length')
|
).property('repos.isLoaded', 'repos.length')
|
||||||
|
|
||||||
urlGithub: (->
|
urlGithub: (->
|
||||||
Travis.Urls.githubRepo(@get('repo.slug'))
|
Travis.Urls.githubRepo(@get('repo.slug'))
|
||||||
).property('repo.slug'),
|
).property('repo.slug'),
|
||||||
|
|
||||||
|
RepoShowStatsView: Travis.View.extend
|
||||||
|
templateName: 'repos/show/stats'
|
||||||
|
repoBinding: 'parentView.repo'
|
||||||
|
statsBinding: 'repo.stats'
|
||||||
|
|
||||||
urlGithubWatchers: (->
|
urlGithubWatchers: (->
|
||||||
Travis.Urls.githubWatchers(@get('repo.slug'))
|
Travis.Urls.githubWatchers(@get('repo.slug'))
|
||||||
).property('repo.slug'),
|
).property('repo.slug'),
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
tabBinding: 'controller.tab'
|
tabBinding: 'controller.tab'
|
||||||
userBinding: 'controller.user'
|
userBinding: 'controller.user'
|
||||||
|
|
||||||
|
userName: (->
|
||||||
|
@get('user.name') || @get('user.login')
|
||||||
|
).property('user.login', 'user.name')
|
||||||
|
|
||||||
gravatarUrl: (->
|
gravatarUrl: (->
|
||||||
"#{location.protocol}//www.gravatar.com/avatar/#{@get('user.gravatarId')}?s=24&d=mm"
|
"#{location.protocol}//www.gravatar.com/avatar/#{@get('user.gravatarId')}?s=24&d=mm"
|
||||||
).property('user.gravatarId')
|
).property('user.gravatarId')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user