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
Boxiang Sun
gitlab-ce
Commits
b8d3016a
Commit
b8d3016a
authored
Jun 29, 2016
by
Luke "Jared" Bennett
Committed by
Sean McGivern
Jul 08, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added frontend collapsible behavior
parent
78496e8c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
0 deletions
+55
-0
app/assets/javascripts/diff.js.coffee
app/assets/javascripts/diff.js.coffee
+2
-0
app/assets/javascripts/merge_request_tabs.js.coffee
app/assets/javascripts/merge_request_tabs.js.coffee
+1
-0
app/assets/javascripts/single_diff.js.coffee
app/assets/javascripts/single_diff.js.coffee
+52
-0
No files found.
app/assets/javascripts/diff.js.coffee
View file @
b8d3016a
class
@
Diff
UNFOLD_COUNT
=
20
constructor
:
->
$
(
'.files .diff-file'
).
singleDiff
()
$
(
document
).
off
(
'click'
,
'.js-unfold'
)
$
(
document
).
on
(
'click'
,
'.js-unfold'
,
(
event
)
=>
target
=
$
(
event
.
target
)
...
...
app/assets/javascripts/merge_request_tabs.js.coffee
View file @
b8d3016a
...
...
@@ -160,6 +160,7 @@ class @MergeRequestTabs
$
(
'#diffs'
).
html
data
.
html
gl
.
utils
.
localTimeAgo
(
$
(
'.js-timeago'
,
'div#diffs'
))
$
(
'#diffs .js-syntax-highlight'
).
syntaxHighlight
()
$
(
'#diffs .diff-file'
).
singleDiff
()
@
expandViewContainer
()
if
@
diffViewType
()
is
'parallel'
@
diffsLoaded
=
true
@
scrollToElement
(
"#diffs"
)
...
...
app/assets/javascripts/single_diff.js.coffee
0 → 100644
View file @
b8d3016a
class
@
SingleDiff
LOADING_HTML
=
'<i class="fa fa-spinner fa-spin"></i>'
ERROR_HTML
=
'<div class="nothing-here-block"><i class="fa fa-warning"></i> Could not load diff</div>'
constructor
:
(
@
file
)
->
@
content
=
$
(
'.diff-content'
,
@
file
)
@
diffForPath
=
@
content
.
data
'diff-for-path'
@
setOpenState
()
$
(
'.file-title > a'
,
@
file
).
on
'click'
,
@
toggleDiff
setOpenState
:
->
if
@
diffForPath
@
isOpen
=
false
else
@
isOpen
=
true
@
contentHTML
=
@
content
.
html
()
return
toggleDiff
:
(
e
)
=>
e
.
preventDefault
()
@
isOpen
=
!
@
isOpen
if
not
@
isOpen
and
not
@
hasError
@
content
.
empty
()
return
if
@
contentHTML
@
setContentHTML
()
else
@
getContentHTML
()
return
getContentHTML
:
->
@
content
.
html
(
LOADING_HTML
).
addClass
'loading'
$
.
get
@
diffForPath
,
(
data
)
=>
if
data
.
html
@
setContentHTML
data
.
html
else
@
hasError
=
true
@
content
.
html
ERROR_HTML
@
content
.
removeClass
'loading'
return
setContentHTML
:
(
contentHTML
)
->
@
contentHTML
=
contentHTML
if
contentHTML
@
content
.
html
@
contentHTML
@
content
.
syntaxHighlight
()
$
.
fn
.
singleDiff
=
->
return
@
each
->
if
not
$
.
data
this
,
'singleDiff'
$
.
data
this
,
'singleDiff'
,
new
SingleDiff
this
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