Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
737e5226
Commit
737e5226
authored
Jul 15, 2016
by
Connor Shea
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use switch statements instead of if/else chains.
parent
b2a79554
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
app/assets/javascripts/merge_request_widget.js.coffee
app/assets/javascripts/merge_request_widget.js.coffee
+7
-6
app/helpers/ci_status_helper.rb
app/helpers/ci_status_helper.rb
+3
-2
No files found.
app/assets/javascripts/merge_request_widget.js.coffee
View file @
737e5226
...
@@ -55,12 +55,13 @@ class @MergeRequestWidget
...
@@ -55,12 +55,13 @@ class @MergeRequestWidget
$
(
'.mr-state-widget'
).
replaceWith
(
data
)
$
(
'.mr-state-widget'
).
replaceWith
(
data
)
ciLabelForStatus
:
(
status
)
->
ciLabelForStatus
:
(
status
)
->
if
status
is
'success'
switch
status
'passed'
when
'success'
else
if
status
is
'success_with_warnings'
'passed'
'passed with warnings'
when
'success_with_warnings'
else
'passed with warnings'
status
else
status
pollCIStatus
:
->
pollCIStatus
:
->
@
fetchBuildStatusInterval
=
setInterval
(
=>
@
fetchBuildStatusInterval
=
setInterval
(
=>
...
...
app/helpers/ci_status_helper.rb
View file @
737e5226
...
@@ -15,9 +15,10 @@ module CiStatusHelper
...
@@ -15,9 +15,10 @@ module CiStatusHelper
end
end
def
ci_label_for_status
(
status
)
def
ci_label_for_status
(
status
)
if
status
==
'success'
case
status
when
'success'
'passed'
'passed'
elsif
status
==
'success_with_warnings'
when
'success_with_warnings'
'passed with warnings'
'passed with warnings'
else
else
status
status
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment