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