style trigger build button for branches without builds

This commit is contained in:
Lisa P 2015-09-15 12:17:37 +02:00
parent df59484afb
commit b5648b864b
4 changed files with 89 additions and 48 deletions

View File

@ -52,16 +52,14 @@ BranchRowComponent = Ember.Component.extend
triggerBuild: (->
apiEndpoint = config.apiEndpoint
repoId = @get('build.repository.id')
options = {
type: 'POST'
}
if @get('auth.signedIn')
options.headers = { Authorization: "token #{@auth.token()}" }
$.ajax("#{apiEndpoint}/v3/repo/#{repoId}/requests", options).then (response) ->
console.log(response);
console.log('Build triggered');
)
actions:

View File

@ -14,6 +14,7 @@ BranchesController = Ember.Controller.extend
activeBranches: (->
repos = @get('model')
repos = repos.filter (item, index) ->
console.log(item)
item if item.exists_on_github == true && item.repository.default_branch.name != undefined
.sort (a, b) ->
# if a.last_build && b.last_build

View File

@ -123,7 +123,7 @@
&:before
bottom: -6px
&:after
bottom: -4px;
bottom: -4px
background-color: $white
.dropup-trigger:hover ~ &,
.dropup-trigger:hover &,
@ -222,3 +222,29 @@
100%
transform: rotateZ(360deg)
.is-relative
position: relative
.nobuilds-tigger
position: absolute
top: 0
left: 0
right: 0
bottom: 0
height: 2em
width: 11em
margin: auto
padding: 0.2em .5em
line-height: 1.5
text-align: center
border: 1px solid #E4E6E6
border-radius: 2px
background-color: #fff
&:hover
background: #A6ADAD
color: white
.icon-trigger svg path
fill: #fff
.icon-trigger
height: 1.4em !important

View File

@ -118,54 +118,56 @@
</div>
</div>
<div class="one-line">
<div class="branch-nav dropup-trigger">
<div class="row-item">
<a href="#"><span class="icon-tofu">
<svg x="0px" y="0px" viewBox="0 0 20 20" xml:space="preserve">
<g id="Tofuburger">
<path fill="#A7AEAE" d="M17.9,6.2H2.1C1.8,6.2,1.5,6,1.5,5.6C1.5,5.3,1.8,5,2.1,5h15.7c0.4,0,0.6,0.3,0.6,0.6
C18.5,6,18.2,6.2,17.9,6.2z"/>
<path fill="#A7AEAE" d="M17.9,10.6H2.1c-0.4,0-0.6-0.3-0.6-0.6s0.3-0.6,0.6-0.6h15.7c0.4,0,0.6,0.3,0.6,0.6S18.2,10.6,17.9,10.6z
"/>
<path fill="#A7AEAE" d="M17.9,15H2.1c-0.4,0-0.6-0.3-0.6-0.6c0-0.3,0.3-0.6,0.6-0.6h15.7c0.4,0,0.6,0.3,0.6,0.6
C18.5,14.7,18.2,15,17.9,15z"/>
</g>
</svg>
</span></a></div>
</div>
<div class="dropup--blue">
<ul>
<li><a {{action 'tiggerBuild'}}>
<span class="icon-trigger">
{{#if build.last_build}}
<div class="branch-nav dropup-trigger">
<div class="row-item">
<a href="#"><span class="icon-tofu">
<svg x="0px" y="0px" viewBox="0 0 20 20" xml:space="preserve">
<g id="Trigger">
<path fill="#A7AEAE" d="M17.2,7.9C17,7.6,16.6,7.7,16.3,8l-1,1.2C14.9,6,12.2,3.6,9,3.6c-3.6,0-6.4,2.9-6.4,6.4s2.9,6.4,6.4,6.4
c1.8,0,3.6-0.8,4.8-2.2c0.2-0.3,0.2-0.7-0.1-0.9c-0.3-0.2-0.7-0.2-0.9,0.1c-1,1.1-2.4,1.7-3.9,1.7c-2.8,0-5.1-2.3-5.1-5.1
S6.1,4.9,9,4.9c2.7,0,4.9,2.1,5.1,4.7l-1.7-1.1c-0.3-0.2-0.7-0.1-0.9,0.2s-0.1,0.7,0.2,0.9l2.8,1.8c0,0,0,0,0,0
c0.1,0.1,0.2,0.1,0.3,0.1c0.1,0,0.2,0,0.3-0.1c0,0,0.1,0,0.1-0.1c0,0,0.1-0.1,0.1-0.1l2-2.4C17.6,8.5,17.5,8.1,17.2,7.9z"/>
<g id="Tofuburger">
<path fill="#A7AEAE" d="M17.9,6.2H2.1C1.8,6.2,1.5,6,1.5,5.6C1.5,5.3,1.8,5,2.1,5h15.7c0.4,0,0.6,0.3,0.6,0.6
C18.5,6,18.2,6.2,17.9,6.2z"/>
<path fill="#A7AEAE" d="M17.9,10.6H2.1c-0.4,0-0.6-0.3-0.6-0.6s0.3-0.6,0.6-0.6h15.7c0.4,0,0.6,0.3,0.6,0.6S18.2,10.6,17.9,10.6z
"/>
<path fill="#A7AEAE" d="M17.9,15H2.1c-0.4,0-0.6-0.3-0.6-0.6c0-0.3,0.3-0.6,0.6-0.6h15.7c0.4,0,0.6,0.3,0.6,0.6
C18.5,14.7,18.2,15,17.9,15z"/>
</g>
</svg>
</span>
Trigger a build</a>
</li>
<li><a {{action 'viewAllBuilds'}}>
<span class="icon-eye">
<svg x="0px" y="0px" viewBox="0 0 20 20" xml:space="preserve">
<g id="View">
<path fill="#A7AEAE" d="M17.4,9.6c-0.1-0.2-3.3-4.1-7.4-4.1s-7.3,4-7.4,4.1c-0.2,0.2-0.2,0.6,0,0.8c0.1,0.2,3.3,4.1,7.4,4.1
s7.3-4,7.4-4.1C17.6,10.2,17.6,9.8,17.4,9.6z M10,13.2c-2.8,0-5.2-2.3-6.1-3.2C4.8,9.1,7.2,6.8,10,6.8c2.8,0,5.2,2.3,6.1,3.2
C15.2,10.9,12.8,13.2,10,13.2z"/>
<path fill="#A7AEAE" d="M10,7c-1.5,0-2.6,1.3-2.6,3s1.2,3,2.6,3s2.6-1.3,2.6-3S11.5,7,10,7z M10,11.7c-0.7,0-1.3-0.7-1.3-1.7
S9.3,8.3,10,8.3s1.3,0.7,1.3,1.7S10.7,11.7,10,11.7z"/>
</g>
</svg>
</span>
View all builds</a>
</li>
</ul>
</div>
</span></a></div>
</div>
<div class="dropup--blue">
<ul>
<li><a {{action 'tiggerBuild'}}>
<span class="icon-trigger">
<svg x="0px" y="0px" viewBox="0 0 20 20" xml:space="preserve">
<g id="Trigger">
<path fill="#A7AEAE" d="M17.2,7.9C17,7.6,16.6,7.7,16.3,8l-1,1.2C14.9,6,12.2,3.6,9,3.6c-3.6,0-6.4,2.9-6.4,6.4s2.9,6.4,6.4,6.4
c1.8,0,3.6-0.8,4.8-2.2c0.2-0.3,0.2-0.7-0.1-0.9c-0.3-0.2-0.7-0.2-0.9,0.1c-1,1.1-2.4,1.7-3.9,1.7c-2.8,0-5.1-2.3-5.1-5.1
S6.1,4.9,9,4.9c2.7,0,4.9,2.1,5.1,4.7l-1.7-1.1c-0.3-0.2-0.7-0.1-0.9,0.2s-0.1,0.7,0.2,0.9l2.8,1.8c0,0,0,0,0,0
c0.1,0.1,0.2,0.1,0.3,0.1c0.1,0,0.2,0,0.3-0.1c0,0,0.1,0,0.1-0.1c0,0,0.1-0.1,0.1-0.1l2-2.4C17.6,8.5,17.5,8.1,17.2,7.9z"/>
</g>
</svg>
</span>
Trigger a build</a>
</li>
<li><a {{action 'viewAllBuilds'}}>
<span class="icon-eye">
<svg x="0px" y="0px" viewBox="0 0 20 20" xml:space="preserve">
<g id="View">
<path fill="#A7AEAE" d="M17.4,9.6c-0.1-0.2-3.3-4.1-7.4-4.1s-7.3,4-7.4,4.1c-0.2,0.2-0.2,0.6,0,0.8c0.1,0.2,3.3,4.1,7.4,4.1
s7.3-4,7.4-4.1C17.6,10.2,17.6,9.8,17.4,9.6z M10,13.2c-2.8,0-5.2-2.3-6.1-3.2C4.8,9.1,7.2,6.8,10,6.8c2.8,0,5.2,2.3,6.1,3.2
C15.2,10.9,12.8,13.2,10,13.2z"/>
<path fill="#A7AEAE" d="M10,7c-1.5,0-2.6,1.3-2.6,3s1.2,3,2.6,3s2.6-1.3,2.6-3S11.5,7,10,7z M10,11.7c-0.7,0-1.3-0.7-1.3-1.7
S9.3,8.3,10,8.3s1.3,0.7,1.3,1.7S10.7,11.7,10,11.7z"/>
</g>
</svg>
</span>
View all builds</a>
</li>
</ul>
</div>
{{/if}}
</div>
<div class="one-line">
<div class="one-line is-relative">
<ul class="build-tiles">
{{#if getLast5Builds.isLoading}}
{{loading-indicator center=true}}
@ -175,4 +177,18 @@
{{/each}}
{{/if}}
</ul>
{{#unless build.last_build}}
<a {{action 'tiggerBuild'}} class="nobuilds-tigger">
<span class="icon-trigger">
<svg x="0px" y="0px" viewBox="0 0 20 20" xml:space="preserve">
<g id="Trigger">
<path fill="#A7AEAE" d="M17.2,7.9C17,7.6,16.6,7.7,16.3,8l-1,1.2C14.9,6,12.2,3.6,9,3.6c-3.6,0-6.4,2.9-6.4,6.4s2.9,6.4,6.4,6.4
c1.8,0,3.6-0.8,4.8-2.2c0.2-0.3,0.2-0.7-0.1-0.9c-0.3-0.2-0.7-0.2-0.9,0.1c-1,1.1-2.4,1.7-3.9,1.7c-2.8,0-5.1-2.3-5.1-5.1
S6.1,4.9,9,4.9c2.7,0,4.9,2.1,5.1,4.7l-1.7-1.1c-0.3-0.2-0.7-0.1-0.9,0.2s-0.1,0.7,0.2,0.9l2.8,1.8c0,0,0,0,0,0
c0.1,0.1,0.2,0.1,0.3,0.1c0.1,0,0.2,0,0.3-0.1c0,0,0.1,0,0.1-0.1c0,0,0.1-0.1,0.1-0.1l2-2.4C17.6,8.5,17.5,8.1,17.2,7.9z"/>
</g>
</svg>
</span>
Trigger a build</a>
{{/unless}}
</div>