Merge branch 'mm-extract-actions-from-menu'
This commit is contained in:
commit
84130350bd
BIN
assets/images/icons/align-justify.png
Executable file
BIN
assets/images/icons/align-justify.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 351 B |
BIN
assets/images/icons/off.png
Executable file
BIN
assets/images/icons/off.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
assets/images/icons/repeat.png
Executable file
BIN
assets/images/icons/repeat.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 960 B |
|
@ -3,6 +3,8 @@ Travis.BuildController = Ember.Controller.extend
|
||||||
repoBinding: 'controllers.repo.repo'
|
repoBinding: 'controllers.repo.repo'
|
||||||
commitBinding: 'build.commit'
|
commitBinding: 'build.commit'
|
||||||
lineNumberBinding: 'controllers.repo.lineNumber'
|
lineNumberBinding: 'controllers.repo.lineNumber'
|
||||||
|
currentUserBinding: 'controllers.repo.currentUser'
|
||||||
|
tabBinding: 'controllers.repo.tab'
|
||||||
|
|
||||||
currentItemBinding: 'build'
|
currentItemBinding: 'build'
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ Travis.JobController = Em.Controller.extend
|
||||||
repoBinding: 'controllers.repo.repo'
|
repoBinding: 'controllers.repo.repo'
|
||||||
commitBinding: 'job.commit'
|
commitBinding: 'job.commit'
|
||||||
lineNumberBinding: 'controllers.repo.lineNumber'
|
lineNumberBinding: 'controllers.repo.lineNumber'
|
||||||
|
currentUserBinding: 'controllers.repo.currentUser'
|
||||||
|
tabBinding: 'controllers.repo.tab'
|
||||||
|
|
||||||
currentItemBinding: 'job'
|
currentItemBinding: 'job'
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/with}}
|
{{/with}}
|
||||||
|
|
||||||
|
|
||||||
<dt>{{t builds.message}}</dt>
|
<dt>{{t builds.message}}</dt>
|
||||||
<dd class="message">{{formatMessage build.commit.message repoBinding=build.repo}}</dd>
|
<dd class="message">{{formatMessage build.commit.message repoBinding=build.repo}}</dd>
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,13 @@
|
||||||
<div id="repo-header">
|
<div id="repo-header">
|
||||||
<h3>{{#linkTo "repo" this}}{{slug}}{{/linkTo}}</h3>
|
<h3>{{#linkTo "repo" this}}{{slug}}{{/linkTo}}</h3>
|
||||||
<div class="github-icon"><a {{bindAttr href="controller.urlGithub"}}><img src="/images/icons/github.png" width="21" height="21"/></a></div>
|
<div class="github-icon"><a {{bindAttr href="controller.urlGithub"}}><img src="/images/icons/github.png" width="21" height="21"/></a></div>
|
||||||
|
{{view Travis.RepoShowToolsView}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="description">{{description}}</p>
|
<p class="description">{{description}}</p>
|
||||||
|
|
||||||
{{view Travis.RepoShowTabsView}}
|
{{view Travis.RepoShowTabsView}}
|
||||||
{{view Travis.RepoShowToolsView}}
|
{{view Travis.RepoActionsView}}
|
||||||
{{/with}}
|
{{/with}}
|
||||||
|
|
||||||
<div class="tab">
|
<div class="tab">
|
||||||
|
|
43
assets/scripts/app/templates/repos/show/actions.hbs
Normal file
43
assets/scripts/app/templates/repos/show/actions.hbs
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
<div id="actions">
|
||||||
|
<ul>
|
||||||
|
{{#if view.displayStatusImages}}
|
||||||
|
<li id="status-image-popup">
|
||||||
|
<a href="#" name="status-images" class="open-popup" {{action "statusImages" target="view"}} style="margin-top: 0px;">
|
||||||
|
<img {{bindAttr src="view.statusImageUrl"}} title="Build Status Images"/>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
|
{{#if view.displayCancelBuild}}
|
||||||
|
<li class="icon">
|
||||||
|
<a href="#" {{action "cancelBuild" target="view"}}
|
||||||
|
{{bindAttr class="view.canCancelBuild::disabled"}}><img class="icon" src="/images/icons/off.png" width="20" title="Cancel Build"></a>
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
|
{{#if view.displayCancelJob}}
|
||||||
|
<li class="icon">
|
||||||
|
<a href="#" {{action "cancelJob" target="view"}}
|
||||||
|
{{bindAttr class="view.canCancelJob::disabled"}}><img class="icon" width="20" src="/images/icons/off.png" title="Cancel Job"/></a>
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
|
{{#if view.displayRequeueBuild}}
|
||||||
|
<li class="icon">
|
||||||
|
<a href="#" {{action "requeueBuild" target="view"}}
|
||||||
|
{{bindAttr class="view.canRequeueBuild::disabled"}}><img class="icon" src="/images/icons/repeat.png" width="20"
|
||||||
|
title="Restart Build"></a>
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
|
{{#if view.displayRequeueJob}}
|
||||||
|
<li class="icon">
|
||||||
|
<a href="#" {{action "requeueJob" target="view"}}
|
||||||
|
{{bindAttr class="view.canRequeueJob::disabled"}}><img src="/images/icons/repeat.png" width="20" title="Restart Job"></a>
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
|
{{!TODO: for some reason showDownloadLog, which just delegates to jobIdForLog
|
||||||
|
does not refresh 'if' properly, need further investigation}}
|
||||||
|
{{#if view.jobIdForLog}}
|
||||||
|
<li class="icon">
|
||||||
|
<a class="download-log" {{bindAttr href="view.plainTextLogUrl"}}><img class="icon" src="/images/icons/align-justify.png" width="20" title="Download Log"/></a>
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
|
</ul>
|
||||||
|
</div>
|
|
@ -1,34 +1,8 @@
|
||||||
<div id="tools">
|
<div id="tools">
|
||||||
<a href="#" {{action "menu" target="view"}}></a>
|
<a href="#" {{action "menu" target="view"}} class="menu-popup-button"></a>
|
||||||
|
|
||||||
<ul class="menu">
|
<ul class="menu">
|
||||||
<li>
|
{{#if view.displayRegenerateKey}}
|
||||||
<a href="#" name="status-images" class="open-popup" {{action "statusImages" target="view"}}>Status Images</a>
|
|
||||||
</li>
|
|
||||||
{{#if view.displayCancelBuild}}
|
|
||||||
<li>
|
|
||||||
<a href="#" {{action "cancelBuild" target="view"}}
|
|
||||||
{{bindAttr class="view.canCancelBuild::disabled"}}>Cancel Build</a>
|
|
||||||
</li>
|
|
||||||
{{/if}}
|
|
||||||
{{#if view.displayCancelJob}}
|
|
||||||
<li>
|
|
||||||
<a href="#" {{action "cancelJob" target="view"}}
|
|
||||||
{{bindAttr class="view.canCancelJob::disabled"}}>Cancel Job</a>
|
|
||||||
</li>
|
|
||||||
{{/if}}
|
|
||||||
{{#if view.displayRequeueBuild}}
|
|
||||||
<li>
|
|
||||||
<a href="#" {{action "requeueBuild" target="view"}}
|
|
||||||
{{bindAttr class="view.canRequeueBuild::disabled"}}>Restart Build</a>
|
|
||||||
</li>
|
|
||||||
{{/if}}
|
|
||||||
{{#if view.displayRequeueJob}}
|
|
||||||
<li>
|
|
||||||
<a href="#" {{action "requeueJob" target="view"}}
|
|
||||||
{{bindAttr class="view.canRequeueJob::disabled"}}> Restart Job </a>
|
|
||||||
</li>
|
|
||||||
{{/if}}
|
|
||||||
{{#if view.displayRegenerateKey}}
|
|
||||||
<li>
|
<li>
|
||||||
<a href="#" name="regenerate-key"
|
<a href="#" name="regenerate-key"
|
||||||
{{action "regenerateKeyPopup" target="view"}}
|
{{action "regenerateKeyPopup" target="view"}}
|
||||||
|
@ -37,14 +11,8 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{!TODO: for some reason showDownloadLog, which just delegates to jobIdForLog
|
|
||||||
does not refresh 'if' properly, need further investigation}}
|
|
||||||
{{#if view.jobIdForLog}}
|
|
||||||
<li>
|
|
||||||
<a class="download-log" {{bindAttr href="view.plainTextLogUrl"}}>Download log</a>
|
|
||||||
</li>
|
|
||||||
{{/if}}
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="regenerate-key" class="popup">
|
<div id="regenerate-key" class="popup">
|
||||||
|
@ -57,7 +25,7 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a class="sync_now button" {{action "regenerateKey" target="view"}}>Yes! Do it!</a>
|
<a class="sync_now button" {{action "regenerateKey" target="view"}}>Yes, do it!</a>
|
||||||
<span class="or">or</span>
|
<span class="or">or</span>
|
||||||
<a href="#" class="cancel" {{action "popupClose" target="view"}}>Cancel</a>
|
<a href="#" class="cancel" {{action "popupClose" target="view"}}>Cancel</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -88,13 +88,56 @@ Travis.reopen
|
||||||
$('#tools .menu').toggleClass('display')
|
$('#tools .menu').toggleClass('display')
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
|
|
||||||
|
regenerateKeyPopup: ->
|
||||||
|
if @get('canRegenerateKey')
|
||||||
|
@set('active', true)
|
||||||
|
@closeMenu()
|
||||||
|
@popup(event)
|
||||||
|
event.stopPropagation()
|
||||||
|
|
||||||
|
regenerateKey: ->
|
||||||
|
@popupCloseAll()
|
||||||
|
|
||||||
|
(@get('repo.content') || @get('repo')).regenerateKey
|
||||||
|
success: =>
|
||||||
|
@popup('regeneration-success')
|
||||||
|
error: ->
|
||||||
|
Travis.lookup('controller:flash').loadFlashes([{ error: 'Travis encountered an error while trying to regenerate the key, please try again.'}])
|
||||||
|
|
||||||
|
displayRegenerateKey: true
|
||||||
|
|
||||||
|
canRegenerateKey: (->
|
||||||
|
@get('displayRegenerateKey') && @get('hasPermission')
|
||||||
|
).property('hasPermission')
|
||||||
|
|
||||||
|
hasPermission: (->
|
||||||
|
if permissions = @get('currentUser.permissions')
|
||||||
|
permissions.contains parseInt(@get('repo.id'))
|
||||||
|
).property('currentUser.permissions.length', 'repo.id')
|
||||||
|
|
||||||
|
RepoActionsView: Travis.View.extend
|
||||||
|
templateName: 'repos/show/actions'
|
||||||
|
|
||||||
|
repoBinding: 'controller.repo'
|
||||||
|
buildBinding: 'controller.build'
|
||||||
|
jobBinding: 'controller.job'
|
||||||
|
tabBinding: 'controller.tab'
|
||||||
|
slugBinding: 'controller.repo.slug'
|
||||||
|
currentUserBinding: 'controller.currentUser'
|
||||||
|
|
||||||
|
statusImageUrl: (->
|
||||||
|
"/#{@get('slug')}.png"
|
||||||
|
).property('slug')
|
||||||
|
|
||||||
|
displayStatusImages: (->
|
||||||
|
@get('hasPermission')
|
||||||
|
).property('hasPermission')
|
||||||
|
|
||||||
requeue: ->
|
requeue: ->
|
||||||
@closeMenu()
|
|
||||||
@get('build').requeue()
|
@get('build').requeue()
|
||||||
|
|
||||||
cancelBuild: ->
|
cancelBuild: ->
|
||||||
if @get('canCancelBuild')
|
if @get('canCancelBuild')
|
||||||
@closeMenu()
|
|
||||||
Travis.flash(notice: 'Build cancelation has been scheduled.')
|
Travis.flash(notice: 'Build cancelation has been scheduled.')
|
||||||
@get('build').cancel().then ->
|
@get('build').cancel().then ->
|
||||||
Travis.flash(success: 'Build has been successfuly canceled.')
|
Travis.flash(success: 'Build has been successfuly canceled.')
|
||||||
|
@ -108,7 +151,6 @@ Travis.reopen
|
||||||
|
|
||||||
cancelJob: ->
|
cancelJob: ->
|
||||||
if @get('canCancelJob')
|
if @get('canCancelJob')
|
||||||
@closeMenu()
|
|
||||||
Travis.flash(notice: 'Job cancelation has been scheduled.')
|
Travis.flash(notice: 'Job cancelation has been scheduled.')
|
||||||
@get('job').cancel().then ->
|
@get('job').cancel().then ->
|
||||||
Travis.flash(success: 'Job has been successfuly canceled.')
|
Travis.flash(success: 'Job has been successfuly canceled.')
|
||||||
|
@ -120,42 +162,10 @@ Travis.reopen
|
||||||
else
|
else
|
||||||
Travis.flash(error: 'An error occured when canceling the job')
|
Travis.flash(error: 'An error occured when canceling the job')
|
||||||
|
|
||||||
statusImages: ->
|
hasPermission: (->
|
||||||
@set('active', true)
|
if permissions = @get('currentUser.permissions')
|
||||||
@closeMenu()
|
permissions.contains parseInt(@get('repo.id'))
|
||||||
@popupCloseAll()
|
).property('currentUser.permissions.length', 'repo.id')
|
||||||
view = Travis.StatusImagesView.create(toolsView: this)
|
|
||||||
# TODO: create a general mechanism for managing current popup
|
|
||||||
# and move all popups to use it
|
|
||||||
Travis.View.currentPopupView = view
|
|
||||||
view.appendTo($('body'))
|
|
||||||
event.stopPropagation()
|
|
||||||
|
|
||||||
regenerateKeyPopup: ->
|
|
||||||
if @get('canRegenerateKey')
|
|
||||||
@set('active', true)
|
|
||||||
@closeMenu()
|
|
||||||
@popup(event)
|
|
||||||
event.stopPropagation()
|
|
||||||
|
|
||||||
requeueBuild: ->
|
|
||||||
if @get('canRequeueBuild')
|
|
||||||
@closeMenu()
|
|
||||||
@get('build').requeue()
|
|
||||||
|
|
||||||
requeueJob: ->
|
|
||||||
if @get('canRequeueJob')
|
|
||||||
@closeMenu()
|
|
||||||
@get('job').requeue()
|
|
||||||
|
|
||||||
regenerateKey: ->
|
|
||||||
@popupCloseAll()
|
|
||||||
|
|
||||||
(@get('repo.content') || @get('repo')).regenerateKey
|
|
||||||
success: =>
|
|
||||||
@popup('regeneration-success')
|
|
||||||
error: ->
|
|
||||||
Travis.lookup('controller:flash').loadFlashes([{ error: 'Travis encountered an error while trying to regenerate the key, please try again.'}])
|
|
||||||
|
|
||||||
displayRequeueBuild: (->
|
displayRequeueBuild: (->
|
||||||
@get('isBuildTab') && @get('build.isFinished')
|
@get('isBuildTab') && @get('build.isFinished')
|
||||||
|
@ -203,22 +213,27 @@ Travis.reopen
|
||||||
@get('isJobTab') && @get('job.canCancel')
|
@get('isJobTab') && @get('job.canCancel')
|
||||||
).property('isJobTab', 'job.canCancel')
|
).property('isJobTab', 'job.canCancel')
|
||||||
|
|
||||||
displayRegenerateKey: true
|
|
||||||
|
|
||||||
canRegenerateKey: (->
|
|
||||||
@get('displayRegenerateKey') && @get('hasPermission')
|
|
||||||
).property('hasPermission')
|
|
||||||
|
|
||||||
|
|
||||||
isJobTab: (->
|
isJobTab: (->
|
||||||
@get('tab') == 'job'
|
@get('tab') == 'job'
|
||||||
).property('tab')
|
).property('tab', 'repo.id')
|
||||||
|
|
||||||
isBuildTab: (->
|
isBuildTab: (->
|
||||||
['current', 'build'].indexOf(@get('tab')) > -1
|
['current', 'build'].indexOf(@get('tab')) > -1
|
||||||
).property('tab')
|
).property('tab')
|
||||||
|
|
||||||
hasPermission: (->
|
requeueBuild: ->
|
||||||
if permissions = @get('currentUser.permissions')
|
if @get('canRequeueBuild')
|
||||||
permissions.contains parseInt(@get('repo.id'))
|
@get('build').requeue()
|
||||||
).property('currentUser.permissions.length', 'repo.id')
|
|
||||||
|
requeueJob: ->
|
||||||
|
if @get('canRequeueJob')
|
||||||
|
@get('job').requeue()
|
||||||
|
|
||||||
|
statusImages: ->
|
||||||
|
@popupCloseAll()
|
||||||
|
view = Travis.StatusImagesView.create(toolsView: this)
|
||||||
|
Travis.View.currentPopupView = view
|
||||||
|
view.appendTo($('body'))
|
||||||
|
event.stopPropagation()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ html, body
|
||||||
-moz-box-flex: 4
|
-moz-box-flex: 4
|
||||||
-webkit-box-flex: 4
|
-webkit-box-flex: 4
|
||||||
position: relative
|
position: relative
|
||||||
min-width: 630px
|
min-width: 760px
|
||||||
padding: 20px 40px 80px 30px
|
padding: 20px 40px 80px 30px
|
||||||
|
|
||||||
#right
|
#right
|
||||||
|
|
|
@ -4,13 +4,16 @@
|
||||||
position: relative
|
position: relative
|
||||||
float: right
|
float: right
|
||||||
top: 2px
|
top: 2px
|
||||||
& > a
|
width: 200px
|
||||||
|
|
||||||
|
& > a.menu-popup-button
|
||||||
display: block
|
display: block
|
||||||
width: 39px
|
width: 39px
|
||||||
height: 21px
|
height: 21px
|
||||||
margin-top: -27px
|
margin-top: -27px
|
||||||
background: inline-image('ui/tools-button.png') no-repeat
|
background: inline-image('ui/tools-button.png') no-repeat
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
|
float: right
|
||||||
|
|
||||||
.menu
|
.menu
|
||||||
display: none
|
display: none
|
||||||
|
@ -32,3 +35,55 @@
|
||||||
&.disabled
|
&.disabled
|
||||||
cursor: default
|
cursor: default
|
||||||
color: $color-link-disabled
|
color: $color-link-disabled
|
||||||
|
|
||||||
|
#actions
|
||||||
|
float: right
|
||||||
|
text-align: right
|
||||||
|
|
||||||
|
li#status-image-popup
|
||||||
|
opacity: 0.5
|
||||||
|
&:hover
|
||||||
|
opacity: 1.0
|
||||||
|
|
||||||
|
li.icon
|
||||||
|
a
|
||||||
|
-webkit-border-radius: .5em
|
||||||
|
-moz-border-radius: .5em
|
||||||
|
border-radius: .5em
|
||||||
|
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.2)
|
||||||
|
-moz-box-shadow: 0 1px 2px rgba(0,0,0,0.2)
|
||||||
|
box-shadow: 0 1px 2px rgba(0,0,0,0.2)
|
||||||
|
display: inline-block
|
||||||
|
width: 22px
|
||||||
|
height: 20px
|
||||||
|
position: relative
|
||||||
|
top: -2px
|
||||||
|
cursor: pointer
|
||||||
|
color: #fef4e9
|
||||||
|
border: solid 1px #afafaf
|
||||||
|
background: #eee
|
||||||
|
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#eee))
|
||||||
|
background: -moz-linear-gradient(top, #fff, #eee)
|
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#faa51a', endColorstr='#f47a20')
|
||||||
|
text-align: center
|
||||||
|
margin-left: 5px
|
||||||
|
|
||||||
|
img
|
||||||
|
width: 15px
|
||||||
|
height: 15px
|
||||||
|
margin-top: 3px
|
||||||
|
margin-left: 0px
|
||||||
|
|
||||||
|
&:hover
|
||||||
|
opacity: 1.0
|
||||||
|
|
||||||
|
&.disabled
|
||||||
|
opacity: 0.6
|
||||||
|
display: none
|
||||||
|
visibility: hidden
|
||||||
|
|
||||||
|
ul
|
||||||
|
margin-top: -27px
|
||||||
|
|
||||||
|
li
|
||||||
|
display: inline
|
||||||
|
|
Loading…
Reference in New Issue
Block a user