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'
|
||||
commitBinding: 'build.commit'
|
||||
lineNumberBinding: 'controllers.repo.lineNumber'
|
||||
currentUserBinding: 'controllers.repo.currentUser'
|
||||
tabBinding: 'controllers.repo.tab'
|
||||
|
||||
currentItemBinding: 'build'
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ Travis.JobController = Em.Controller.extend
|
|||
repoBinding: 'controllers.repo.repo'
|
||||
commitBinding: 'job.commit'
|
||||
lineNumberBinding: 'controllers.repo.lineNumber'
|
||||
currentUserBinding: 'controllers.repo.currentUser'
|
||||
tabBinding: 'controllers.repo.tab'
|
||||
|
||||
currentItemBinding: 'job'
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
</div>
|
||||
{{/with}}
|
||||
|
||||
|
||||
<dt>{{t builds.message}}</dt>
|
||||
<dd class="message">{{formatMessage build.commit.message repoBinding=build.repo}}</dd>
|
||||
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
<div id="repo-header">
|
||||
<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>
|
||||
{{view Travis.RepoShowToolsView}}
|
||||
</div>
|
||||
|
||||
<p class="description">{{description}}</p>
|
||||
|
||||
{{view Travis.RepoShowTabsView}}
|
||||
{{view Travis.RepoShowToolsView}}
|
||||
{{view Travis.RepoActionsView}}
|
||||
{{/with}}
|
||||
|
||||
<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">
|
||||
<a href="#" {{action "menu" target="view"}}></a>
|
||||
<a href="#" {{action "menu" target="view"}} class="menu-popup-button"></a>
|
||||
|
||||
<ul class="menu">
|
||||
<li>
|
||||
<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}}
|
||||
{{#if view.displayRegenerateKey}}
|
||||
<li>
|
||||
<a href="#" name="regenerate-key"
|
||||
{{action "regenerateKeyPopup" target="view"}}
|
||||
|
@ -37,14 +11,8 @@
|
|||
</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>
|
||||
<a class="download-log" {{bindAttr href="view.plainTextLogUrl"}}>Download log</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="regenerate-key" class="popup">
|
||||
|
@ -57,7 +25,7 @@
|
|||
</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>
|
||||
<a href="#" class="cancel" {{action "popupClose" target="view"}}>Cancel</a>
|
||||
</p>
|
||||
|
|
|
@ -88,13 +88,56 @@ Travis.reopen
|
|||
$('#tools .menu').toggleClass('display')
|
||||
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: ->
|
||||
@closeMenu()
|
||||
@get('build').requeue()
|
||||
|
||||
cancelBuild: ->
|
||||
if @get('canCancelBuild')
|
||||
@closeMenu()
|
||||
Travis.flash(notice: 'Build cancelation has been scheduled.')
|
||||
@get('build').cancel().then ->
|
||||
Travis.flash(success: 'Build has been successfuly canceled.')
|
||||
|
@ -108,7 +151,6 @@ Travis.reopen
|
|||
|
||||
cancelJob: ->
|
||||
if @get('canCancelJob')
|
||||
@closeMenu()
|
||||
Travis.flash(notice: 'Job cancelation has been scheduled.')
|
||||
@get('job').cancel().then ->
|
||||
Travis.flash(success: 'Job has been successfuly canceled.')
|
||||
|
@ -120,42 +162,10 @@ Travis.reopen
|
|||
else
|
||||
Travis.flash(error: 'An error occured when canceling the job')
|
||||
|
||||
statusImages: ->
|
||||
@set('active', true)
|
||||
@closeMenu()
|
||||
@popupCloseAll()
|
||||
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.'}])
|
||||
hasPermission: (->
|
||||
if permissions = @get('currentUser.permissions')
|
||||
permissions.contains parseInt(@get('repo.id'))
|
||||
).property('currentUser.permissions.length', 'repo.id')
|
||||
|
||||
displayRequeueBuild: (->
|
||||
@get('isBuildTab') && @get('build.isFinished')
|
||||
|
@ -203,22 +213,27 @@ Travis.reopen
|
|||
@get('isJobTab') && @get('job.canCancel')
|
||||
).property('isJobTab', 'job.canCancel')
|
||||
|
||||
displayRegenerateKey: true
|
||||
|
||||
canRegenerateKey: (->
|
||||
@get('displayRegenerateKey') && @get('hasPermission')
|
||||
).property('hasPermission')
|
||||
|
||||
|
||||
isJobTab: (->
|
||||
@get('tab') == 'job'
|
||||
).property('tab')
|
||||
).property('tab', 'repo.id')
|
||||
|
||||
isBuildTab: (->
|
||||
['current', 'build'].indexOf(@get('tab')) > -1
|
||||
).property('tab')
|
||||
|
||||
hasPermission: (->
|
||||
if permissions = @get('currentUser.permissions')
|
||||
permissions.contains parseInt(@get('repo.id'))
|
||||
).property('currentUser.permissions.length', 'repo.id')
|
||||
requeueBuild: ->
|
||||
if @get('canRequeueBuild')
|
||||
@get('build').requeue()
|
||||
|
||||
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
|
||||
-webkit-box-flex: 4
|
||||
position: relative
|
||||
min-width: 630px
|
||||
min-width: 760px
|
||||
padding: 20px 40px 80px 30px
|
||||
|
||||
#right
|
||||
|
|
|
@ -4,13 +4,16 @@
|
|||
position: relative
|
||||
float: right
|
||||
top: 2px
|
||||
& > a
|
||||
width: 200px
|
||||
|
||||
& > a.menu-popup-button
|
||||
display: block
|
||||
width: 39px
|
||||
height: 21px
|
||||
margin-top: -27px
|
||||
background: inline-image('ui/tools-button.png') no-repeat
|
||||
cursor: pointer
|
||||
float: right
|
||||
|
||||
.menu
|
||||
display: none
|
||||
|
@ -32,3 +35,55 @@
|
|||
&.disabled
|
||||
cursor: default
|
||||
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