From 2cc35556ab6481c1a23df9753c55480da8d0b913 Mon Sep 17 00:00:00 2001
From: Mathias Meyer
Date: Sun, 8 Sep 2013 09:21:37 +0200
Subject: [PATCH 1/4] Pull job/repository actions out of cog menu.
It's very hard to notice where something is, when it's hidden in
that menu.
---
assets/scripts/app/templates/builds/show.hbs | 2 +
assets/scripts/app/templates/jobs/show.hbs | 1 +
.../app/templates/repos/show/actions.hbs | 38 ++++++++
.../app/templates/repos/show/tools.hbs | 38 +-------
assets/scripts/app/views/repo/show.coffee | 92 ++++++++++---------
assets/styles/main/tools.sass | 4 +
6 files changed, 95 insertions(+), 80 deletions(-)
create mode 100644 assets/scripts/app/templates/repos/show/actions.hbs
diff --git a/assets/scripts/app/templates/builds/show.hbs b/assets/scripts/app/templates/builds/show.hbs
index 282c44d1..c72369d2 100644
--- a/assets/scripts/app/templates/builds/show.hbs
+++ b/assets/scripts/app/templates/builds/show.hbs
@@ -42,8 +42,10 @@
{{commit.committerName}}
{{/if}}
+ {{view Travis.RepoActionsView}}
{{/with}}
+
{{t builds.message}}
{{formatMessage build.commit.message repoBinding=build.repo}}
diff --git a/assets/scripts/app/templates/jobs/show.hbs b/assets/scripts/app/templates/jobs/show.hbs
index fd233cc2..56e4a8ac 100644
--- a/assets/scripts/app/templates/jobs/show.hbs
+++ b/assets/scripts/app/templates/jobs/show.hbs
@@ -41,6 +41,7 @@
{{commit.committerName}}
{{/if}}
+ {{view Travis.RepoActionsView}}
{{/with}}
{{t jobs.message}}
{{formatMessage job.commit.message repoBinding=job.repo}}
diff --git a/assets/scripts/app/templates/repos/show/actions.hbs b/assets/scripts/app/templates/repos/show/actions.hbs
new file mode 100644
index 00000000..23de48d5
--- /dev/null
+++ b/assets/scripts/app/templates/repos/show/actions.hbs
@@ -0,0 +1,38 @@
+
+
+ -
+
+
+ {{#if view.displayCancelBuild}}
+ -
+ Cancel Build
+
+ {{/if}}
+ {{#if view.displayCancelJob}}
+ -
+ Cancel Job
+
+ {{/if}}
+ {{#if view.displayRequeueBuild}}
+ -
+ Restart Build
+
+ {{/if}}
+ {{#if view.displayRequeueJob}}
+ -
+ Restart Job
+
+ {{/if}}
+ {{!TODO: for some reason showDownloadLog, which just delegates to jobIdForLog
+ does not refresh 'if' properly, need further investigation}}
+ {{#if view.jobIdForLog}}
+ -
+ Download Log
+
+ {{/if}}
+
+
diff --git a/assets/scripts/app/templates/repos/show/tools.hbs b/assets/scripts/app/templates/repos/show/tools.hbs
index a394597d..df2e666a 100644
--- a/assets/scripts/app/templates/repos/show/tools.hbs
+++ b/assets/scripts/app/templates/repos/show/tools.hbs
@@ -1,34 +1,7 @@
@@ -57,7 +23,7 @@
- Yes! Do it!
+ Yes, do it!
or
Cancel
diff --git a/assets/scripts/app/views/repo/show.coffee b/assets/scripts/app/views/repo/show.coffee
index d49b9330..cf10ed16 100644
--- a/assets/scripts/app/views/repo/show.coffee
+++ b/assets/scripts/app/views/repo/show.coffee
@@ -85,13 +85,47 @@ 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.controllers.repo.tab'
+ currentUserBinding: 'controller.controllers.repo.currentUser'
+
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.')
@@ -105,7 +139,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.')
@@ -118,41 +151,16 @@ Travis.reopen
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')
@@ -200,22 +208,18 @@ 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()
diff --git a/assets/styles/main/tools.sass b/assets/styles/main/tools.sass
index 7f85a225..ecf17756 100644
--- a/assets/styles/main/tools.sass
+++ b/assets/styles/main/tools.sass
@@ -32,3 +32,7 @@
&.disabled
cursor: default
color: $color-link-disabled
+
+#actions
+ float: right
+ text-align: right
From 451894bcecfb395d77616ff82428fe7830181818 Mon Sep 17 00:00:00 2001
From: Mathias Meyer
Date: Sun, 8 Sep 2013 10:11:20 +0200
Subject: [PATCH 2/4] Pull some bindings into build and job controllers.
---
assets/scripts/app/controllers/build.coffee | 2 ++
assets/scripts/app/controllers/job.coffee | 2 ++
assets/scripts/app/views/repo/show.coffee | 2 +-
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/assets/scripts/app/controllers/build.coffee b/assets/scripts/app/controllers/build.coffee
index 493b710a..2446117b 100644
--- a/assets/scripts/app/controllers/build.coffee
+++ b/assets/scripts/app/controllers/build.coffee
@@ -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'
diff --git a/assets/scripts/app/controllers/job.coffee b/assets/scripts/app/controllers/job.coffee
index 3f94343c..417e3eb3 100644
--- a/assets/scripts/app/controllers/job.coffee
+++ b/assets/scripts/app/controllers/job.coffee
@@ -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'
diff --git a/assets/scripts/app/views/repo/show.coffee b/assets/scripts/app/views/repo/show.coffee
index cf10ed16..8fc3b8fa 100644
--- a/assets/scripts/app/views/repo/show.coffee
+++ b/assets/scripts/app/views/repo/show.coffee
@@ -119,7 +119,7 @@ Travis.reopen
buildBinding: 'controller.build'
jobBinding: 'controller.job'
tabBinding: 'controller.controllers.repo.tab'
- currentUserBinding: 'controller.controllers.repo.currentUser'
+ currentUserBinding: 'controller.currentUser'
requeue: ->
@get('build').requeue()
From 24fb869d53ce284736c671d4af1c559e3cb5147a Mon Sep 17 00:00:00 2001
From: Mathias Meyer
Date: Sun, 8 Sep 2013 11:45:40 +0200
Subject: [PATCH 3/4] Disable links when permissions isn't granted.
---
assets/styles/main/tools.sass | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/assets/styles/main/tools.sass b/assets/styles/main/tools.sass
index ecf17756..ed7670b8 100644
--- a/assets/styles/main/tools.sass
+++ b/assets/styles/main/tools.sass
@@ -36,3 +36,9 @@
#actions
float: right
text-align: right
+
+ a
+ &.disabled
+ cursor: default
+ color: $color-link-disabled
+ text-decoration: none
From e7d4b284cdc44c9cf92d8dcce0d92dd04a1d782e Mon Sep 17 00:00:00 2001
From: Mathias Meyer
Date: Mon, 9 Sep 2013 16:40:23 +0200
Subject: [PATCH 4/4] Make action links actual icons.
This change pushes the cog menu to the top, where it belongs, as it
now only includes repository-relevant actions. The icons now reflect
things relating to the build/job itself, and have replace the cog
meny.
---
assets/images/icons/align-justify.png | Bin 0 -> 351 bytes
assets/images/icons/off.png | Bin 0 -> 1066 bytes
assets/images/icons/repeat.png | Bin 0 -> 960 bytes
assets/scripts/app/templates/builds/show.hbs | 1 -
assets/scripts/app/templates/jobs/show.hbs | 1 -
assets/scripts/app/templates/repos/show.hbs | 3 +-
.../app/templates/repos/show/actions.hbs | 29 +++++----
.../app/templates/repos/show/tools.hbs | 4 +-
assets/scripts/app/views/repo/show.coffee | 27 ++++++---
assets/styles/layout.sass | 2 +-
assets/styles/main/tools.sass | 57 ++++++++++++++++--
11 files changed, 93 insertions(+), 31 deletions(-)
create mode 100755 assets/images/icons/align-justify.png
create mode 100755 assets/images/icons/off.png
create mode 100755 assets/images/icons/repeat.png
diff --git a/assets/images/icons/align-justify.png b/assets/images/icons/align-justify.png
new file mode 100755
index 0000000000000000000000000000000000000000..96bfc24ba040159eb311c4296b44807ac0e99600
GIT binary patch
literal 351
zcmV-l0igbgP)m3UBFEn!ff
zt&U=GywAup^8&q1t$sc3N%On~BrbxVQ#Ro4TGb@Uvx+QJ-^|LbFC{gwre
xKX4B=zzC=XbplO$4{EG}sdz}F%LQ8P`2wGJgL7)0Vq^dS002ovPDHLkV1kD=mQ(-$
literal 0
HcmV?d00001
diff --git a/assets/images/icons/off.png b/assets/images/icons/off.png
new file mode 100755
index 0000000000000000000000000000000000000000..1282e2f30c9304b4ad23d49d6b9d21944fc3f6d9
GIT binary patch
literal 1066
zcmV+_1l9YAP)ABe)QCb*Jh-7=
zLR=siZ%XtcaX}=msBuAX{Jn8rsHu6?-P5gL!N;q5%U9pjRCQP93WY*0EpoZsI&c#V
zgKkilmMc`3MO-I>3Ld&c6Q%XnFhSb3#VFik_%gY&2&^||ZZmwDTv-HWnmB23q`-VW
z-vru$wOaWklTbSaECh-2D>y@&m&6TV49G!v0XDn2jIWnsWe3H}=^*EQDen#T1gLd$
z;`-((hGYr&0^G@eiC+onClPqV;}E{vph0=!Y=uCIXM*Rz6{r23N=Q6XAn{tD|A5x3
zy-TcKxuR^DK#J?9R@|^et;_|n;9B#i)bEB*;@O%W}5toR($Q6`a
z+EyT2!xiTCyIfAIKQ0iG!x2Qsh~-@Z#*r(ix#S&;;FSY3RdX#{6iCua5c;LZ&B6pL
zsC97n0(a%yevjr^Rs~)O5cK1(F$)u}pw!YPfqTFeru_knUwu+6r`B4%pZFJOqHl@C
z?m@SP{2AaGP+@B2@CBcZ@+Mgetf%}S6ATjzHJKoBgKL!JLq>r-IhGmzqDus}2ZDD3
zesx%g;d0v~(%GPEWiPh%CoGmtll-+}@q(R!H5o{T>J
zx!inm{Jne9-FH@>nxjDXpW1i$${u4{i$C|nD0rv|QI#pqe%
z|7t5;T9*b$M=XD61?9=#VHITb&7;22;234Q$YHH$A%T*(yCOTgV|9R{Kj7y${W)19
zB)BI^`<>RwO5=mS1$+$5vn|A_0?!5t<@Gc@R9uZ89`oIe|1AhUo>br*l0E@lIoDpO
zMu?RQ?~VYs%(LC9QD0G@3~0L|NKO%J)S{%88hKyu1z&;tqqTo2j%!?CN#v~nkr2KF
zYvKqsPOhBT0ia@hD}QaX=7+2=a5hDuzgj0aL(V49;*;WQ0INU`7z0{k+2Fx&dCLS!
zfYud5>`o@H#LM6ucmn*(gPZI2FS;V4`V|68BKI*_Xy3RKrRkrBJN<{d{u)SHfqY=6
z5nS-kg@omf*~NcBe4$>fu;N*L
knFVGQ5LYjU;J2hyVZp07*qoM6N<$f-W=kRsaA1
literal 0
HcmV?d00001
diff --git a/assets/images/icons/repeat.png b/assets/images/icons/repeat.png
new file mode 100755
index 0000000000000000000000000000000000000000..f89bf28b018e827d0fb5032abba6e58a53ce78f3
GIT binary patch
literal 960
zcmV;x13&zUP)P~-2!H(_$~&1CL-FM0XkFmu1<%z1NX?w$Jz{r&wl~fUxxRE!EFk3i<|ua#zttT
zcide^+Bd`=fw#q+*|dv+Hc`yB#)89QL#DH)W)TTrL2R~86L0hD{5~<=zP&&{AjXr8
znKL-#7DK3=nk{tKy~IosU!d!gtLNiUpvR2kh_xp7pg>4EB1E0UX1KxgwA5+I#Duw6
zSRe#V;9G#`Vje+$E_`~CoxxP
zdS^eh^6PNwRAQM~U?paK{PL^Z<~jIhW@E;+X7Uv^=BXzn@Ha(|4YFhx1AZb|D9dz<
ztr_fL0G(i}Zf+M>T}ViP1X^pYg*7xOR5X_UkU*`?m18L+G?oND2n4OQ8Au&HcW4GR
z;-=9XHl0}?Dj!LIZIoJN;_M6DU3U`8ePE?Vr|NUS@u<~%dP<78fgk55Qdr3&{{r~*
zgz&|={!RRo{jo#+!5JJ-oA%Lk2J&rSp+$;c2UUISzXMK?)pl6*S>Le#W?0DW5T67o
zrjK#WQZJ|nEnqn)fS9RfJ!1M|NdvL0VqIhVz-WEA--mmaHLm3wa*O>0NS1)xz`8x9
z`YyniwDz2qpg<*HdQKhy<<6#-!Y(&xo;E7b5kaoM-?~7anbULi1~>$AJ^S3aYKLtS
z$b!ZOY9_cHtOISJ0mvj=|5n`v_loTk1~8BD#FH(Tz$`0*r{S9p`VjLa8?VH5Spq8|
iU?dKASQsg{{commit.committerName}}
{{/if}}
- {{view Travis.RepoActionsView}}
{{/with}}
diff --git a/assets/scripts/app/templates/jobs/show.hbs b/assets/scripts/app/templates/jobs/show.hbs
index 56e4a8ac..fd233cc2 100644
--- a/assets/scripts/app/templates/jobs/show.hbs
+++ b/assets/scripts/app/templates/jobs/show.hbs
@@ -41,7 +41,6 @@
{{commit.committerName}}
{{/if}}
- {{view Travis.RepoActionsView}}
{{/with}}
{{t jobs.message}}
{{formatMessage job.commit.message repoBinding=job.repo}}
diff --git a/assets/scripts/app/templates/repos/show.hbs b/assets/scripts/app/templates/repos/show.hbs
index 4e030667..7d7d3cf7 100644
--- a/assets/scripts/app/templates/repos/show.hbs
+++ b/assets/scripts/app/templates/repos/show.hbs
@@ -7,12 +7,13 @@
{{description}}
{{view Travis.RepoShowTabsView}}
- {{view Travis.RepoShowToolsView}}
+ {{view Travis.RepoActionsView}}
{{/with}}
diff --git a/assets/scripts/app/templates/repos/show/actions.hbs b/assets/scripts/app/templates/repos/show/actions.hbs
index 23de48d5..8d185f19 100644
--- a/assets/scripts/app/templates/repos/show/actions.hbs
+++ b/assets/scripts/app/templates/repos/show/actions.hbs
@@ -1,37 +1,42 @@