Merge pull request #134 from lukesarnacki/show-disabled-links-in-cog-menu
Disable links in cog menu when not signed in
This commit is contained in:
commit
e05b2cbe80
|
@ -4,29 +4,37 @@
|
|||
<li>
|
||||
<a href="#" name="status-images" class="open-popup" {{action statusImages target="view"}}>Status Images</a>
|
||||
</li>
|
||||
{{#if view.canCancelBuild}}
|
||||
{{#if view.displayCancelBuild}}
|
||||
<li>
|
||||
<a href="#" {{action cancelBuild target="view"}}>Cancel Build</a>
|
||||
<a href="#" {{action cancelBuild target="view"}}
|
||||
{{bindAttr class="view.canCancelBuild::disabled"}}>Cancel Build</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if view.canCancelJob}}
|
||||
{{#if view.displayCancelJob}}
|
||||
<li>
|
||||
<a href="#" {{action cancelJob target="view"}}>Cancel Job</a>
|
||||
<a href="#" {{action cancelJob target="view"}}
|
||||
{{bindAttr class="view.canCancelJob::disabled"}}>Cancel Job</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if view.canRequeueBuild}}
|
||||
{{#if view.displayRequeueBuild}}
|
||||
<li>
|
||||
<a href="#" {{action requeueBuild target="view"}}>Restart Build</a>
|
||||
<a href="#" {{action requeueBuild target="view"}}
|
||||
{{bindAttr class="view.canRequeueBuild::disabled"}}>Restart Build</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if view.canRequeueJob}}
|
||||
{{#if view.displayRequeueJob}}
|
||||
<li>
|
||||
<a href="#" {{action requeueJob target="view"}}>Restart Job</a>
|
||||
<a href="#" {{action requeueJob target="view"}}
|
||||
{{bindAttr class="view.canRequeueJob::disabled"}}> Restart Job </a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if view.canRegenerateKey}}
|
||||
{{#if view.displayRegenerateKey}}
|
||||
<li>
|
||||
<a href="#" name="regenerate-key" class="open-popup" {{action regenerateKeyPopup target="view"}}>Regenerate Key</a>
|
||||
<a href="#" name="regenerate-key"
|
||||
{{action regenerateKeyPopup target="view"}}
|
||||
{{bindAttr class=":open-popup view.canRegenerateKey::disabled"}}>
|
||||
Regenerate Key
|
||||
</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if view.showDownloadLog}}
|
||||
|
|
|
@ -95,12 +95,14 @@
|
|||
@get('build').requeue()
|
||||
|
||||
cancelBuild: ->
|
||||
@closeMenu()
|
||||
@get('build').cancel()
|
||||
if @get('canCancelBuild')
|
||||
@closeMenu()
|
||||
@get('build').cancel()
|
||||
|
||||
cancelJob: ->
|
||||
@closeMenu()
|
||||
@get('job').cancel()
|
||||
if @get('canCancelJob')
|
||||
@closeMenu()
|
||||
@get('job').cancel()
|
||||
|
||||
statusImages: (event) ->
|
||||
@set('active', true)
|
||||
|
@ -114,18 +116,21 @@
|
|||
event.stopPropagation()
|
||||
|
||||
regenerateKeyPopup: (event) ->
|
||||
@set('active', true)
|
||||
@closeMenu()
|
||||
@popup(event)
|
||||
event.stopPropagation()
|
||||
if @get('canRegenerateKey')
|
||||
@set('active', true)
|
||||
@closeMenu()
|
||||
@popup(event)
|
||||
event.stopPropagation()
|
||||
|
||||
requeueBuild: ->
|
||||
@closeMenu()
|
||||
@get('build').requeue()
|
||||
if @get('canRequeueJobBuild')
|
||||
@closeMenu()
|
||||
@get('build').requeue()
|
||||
|
||||
requeueJob: ->
|
||||
@closeMenu()
|
||||
@get('job').requeue()
|
||||
if @get('canRequeueJob')
|
||||
@closeMenu()
|
||||
@get('job').requeue()
|
||||
|
||||
regenerateKey: ->
|
||||
@popupCloseAll()
|
||||
|
@ -137,13 +142,21 @@
|
|||
error: ->
|
||||
Travis.app.router.flashController.loadFlashes([{ error: 'Travis encountered an error while trying to regenerate the key, please try again.'}])
|
||||
|
||||
displayRequeueBuild: (->
|
||||
@get('isBuildTab') && @get('build.isFinished')
|
||||
).property('isBuildTab', 'build.isFinished')
|
||||
|
||||
canRequeueBuild: (->
|
||||
@get('isBuildTab') && @get('build.isFinished') && @get('hasPermission')
|
||||
).property('isBuildTab', 'build.isFinished', 'hasPermissions')
|
||||
@get('displayRequeueBuild') && @get('hasPermission')
|
||||
).property('displayRequireBuild', 'hasPermissions')
|
||||
|
||||
displayRequeueJob: (->
|
||||
@get('isJobTab') && @get('job.isFinished')
|
||||
).property('isJobTab', 'job.isFinished')
|
||||
|
||||
canRequeueJob: (->
|
||||
@get('isJobTab') && @get('job.isFinished') && @get('hasPermission')
|
||||
).property('isJobTab', 'job.isFinished', 'hasPermissions')
|
||||
@get('displayRequeueJob') && @get('hasPermission')
|
||||
).property('displayRequeueJob', 'hasPermissions')
|
||||
|
||||
showDownloadLog: (->
|
||||
@get('jobIdForLog')
|
||||
|
@ -159,18 +172,30 @@
|
|||
Travis.Urls.plainTextLog(id)
|
||||
).property('jobIdForLog')
|
||||
|
||||
canCancelBuild: (->
|
||||
# @get('isBuildTab') && @get('build.canCancel') && @get('hasPermission')
|
||||
displayCancelBuild: (->
|
||||
# @get('isBuildTab') && @get('build.canCancel')
|
||||
false
|
||||
).property('build.state', 'hasPermission', 'tab')
|
||||
).property('build.state', 'tab')
|
||||
|
||||
canCancelBuild: (->
|
||||
# @get('displayCancelBuild') && @get('hasPermission')
|
||||
false
|
||||
).property('displayCancelBuild', 'hasPermission')
|
||||
|
||||
displayCancelJob: (->
|
||||
# @get('isJobTab') && @get('job.canCancel')
|
||||
false
|
||||
).property('job.state', 'tab')
|
||||
|
||||
canCancelJob: (->
|
||||
# @get('isJobTab') && @get('job.canCancel') && @get('hasPermission')
|
||||
# @get('displayCancelJob') && @get('hasPermission')
|
||||
false
|
||||
).property('job.state', 'hasPermission', 'tab')
|
||||
).property('displayCancelJob', 'hasPermission')
|
||||
|
||||
displayRegenerateKey: true
|
||||
|
||||
canRegenerateKey: (->
|
||||
@get('hasPermission')
|
||||
@get('displayRegenerateKey') && @get('hasPermission')
|
||||
).property('hasPermission')
|
||||
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ $color-link-highlight: $red-medium-1
|
|||
$color-link-sponsor: #575c7c
|
||||
$color-link-top: $gray-medium-3
|
||||
$color-link-top-highlight: $white
|
||||
$color-link-disabled: $gray-medium-1
|
||||
|
||||
$color-bg-dark: $slate-blue-2
|
||||
$color-bg-light: $gray-light-1
|
||||
|
|
|
@ -25,7 +25,10 @@
|
|||
a
|
||||
display: block
|
||||
padding: 5px 25px 5px 25px
|
||||
&:hover
|
||||
&:hover:not(.disabled)
|
||||
background-color: $color-bg-menu-hover
|
||||
&:last-child
|
||||
@include border-bottom-radius(4px)
|
||||
&.disabled
|
||||
cursor: default
|
||||
color: $color-link-disabled
|
||||
|
|
Loading…
Reference in New Issue
Block a user