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
Léo-Paul Géneau
gitlab-ce
Commits
ffdccaa0
Commit
ffdccaa0
authored
Sep 02, 2016
by
Luke Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated diff toggle targets and added icon
parent
2aaab34b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
9 deletions
+26
-9
app/assets/javascripts/single_file_diff.js
app/assets/javascripts/single_file_diff.js
+10
-3
app/assets/stylesheets/framework/blocks.scss
app/assets/stylesheets/framework/blocks.scss
+2
-4
app/assets/stylesheets/framework/files.scss
app/assets/stylesheets/framework/files.scss
+10
-1
app/views/projects/diffs/_content.html.haml
app/views/projects/diffs/_content.html.haml
+3
-1
app/views/projects/diffs/_file_header.html.haml
app/views/projects/diffs/_file_header.html.haml
+1
-0
No files found.
app/assets/javascripts/single_file_diff.js
View file @
ffdccaa0
...
...
@@ -10,12 +10,13 @@
ERROR_HTML
=
'
<div class="nothing-here-block"><i class="fa fa-warning"></i> Could not load diff</div>
'
;
COLLAPSED_HTML
=
'
<div class="nothing-here-block diff-collapsed">This diff is collapsed.
Click to expand it.
</div>
'
;
COLLAPSED_HTML
=
'
<div class="nothing-here-block diff-collapsed">This diff is collapsed.
<a class="click-to-expand">Click to expand it.</a>
</div>
'
;
function
SingleFileDiff
(
file
)
{
this
.
file
=
file
;
this
.
toggleDiff
=
bind
(
this
.
toggleDiff
,
this
);
this
.
content
=
$
(
'
.diff-content
'
,
this
.
file
);
this
.
$toggleIcon
=
$
(
'
.diff-toggle-caret
'
,
this
.
file
);
this
.
diffForPath
=
this
.
content
.
find
(
'
[data-diff-for-path]
'
).
data
(
'
diff-for-path
'
);
this
.
isOpen
=
!
this
.
diffForPath
;
if
(
this
.
diffForPath
)
{
...
...
@@ -23,18 +24,22 @@
this
.
loadingContent
=
$
(
WRAPPER
).
addClass
(
'
loading
'
).
html
(
LOADING_HTML
).
hide
();
this
.
content
=
null
;
this
.
collapsedContent
.
after
(
this
.
loadingContent
);
this
.
$toggleIcon
.
addClass
(
'
fa-caret-right
'
);
}
else
{
this
.
collapsedContent
=
$
(
WRAPPER
).
html
(
COLLAPSED_HTML
).
hide
();
this
.
content
.
after
(
this
.
collapsedContent
);
this
.
$toggleIcon
.
addClass
(
'
fa-caret-down
'
);
}
this
.
collapsedContent
.
on
(
'
click
'
,
this
.
toggleDiff
);
$
(
'
.file-title > a
'
,
this
.
file
).
on
(
'
click
'
,
this
.
toggleDiff
);
$
(
'
.file-title, .click-to-expand
'
,
this
.
file
).
on
(
'
click
'
,
this
.
toggleDiff
);
}
SingleFileDiff
.
prototype
.
toggleDiff
=
function
(
e
)
{
var
$target
=
$
(
e
.
target
);
if
(
!
$target
.
hasClass
(
'
file-title
'
)
&&
!
$target
.
hasClass
(
'
click-to-expand
'
)
&&
!
$target
.
hasClass
(
'
diff-toggle-caret
'
))
return
;
this
.
isOpen
=
!
this
.
isOpen
;
if
(
!
this
.
isOpen
&&
!
this
.
hasError
)
{
this
.
content
.
hide
();
this
.
$toggleIcon
.
addClass
(
'
fa-caret-right
'
).
removeClass
(
'
fa-caret-down
'
);
this
.
collapsedContent
.
show
();
if
(
typeof
DiffNotesApp
!==
'
undefined
'
)
{
DiffNotesApp
.
compileComponents
();
...
...
@@ -42,10 +47,12 @@
}
else
if
(
this
.
content
)
{
this
.
collapsedContent
.
hide
();
this
.
content
.
show
();
this
.
$toggleIcon
.
addClass
(
'
fa-caret-down
'
).
removeClass
(
'
fa-caret-right
'
);
if
(
typeof
DiffNotesApp
!==
'
undefined
'
)
{
DiffNotesApp
.
compileComponents
();
}
}
else
{
this
.
$toggleIcon
.
addClass
(
'
fa-caret-down
'
).
removeClass
(
'
fa-caret-right
'
);
return
this
.
getContentHTML
();
}
};
...
...
app/assets/stylesheets/framework/blocks.scss
View file @
ffdccaa0
...
...
@@ -19,10 +19,8 @@
&
.diff-collapsed
{
padding
:
5px
;
cursor
:
pointer
;
&
:hover
{
background-color
:
$row-hover
;
.click-to-expand
{
cursor
:
pointer
;
}
}
}
...
...
app/assets/stylesheets/framework/files.scss
View file @
ffdccaa0
...
...
@@ -26,6 +26,15 @@
padding
:
10px
$gl-padding
;
word-wrap
:
break-word
;
border-radius
:
3px
3px
0
0
;
cursor
:
pointer
;
&
:hover
{
background-color
:
$dark-background-color
;
}
.diff-toggle-caret
{
padding-right
:
6px
;
}
&
.file-title-clear
{
padding-left
:
0
;
...
...
@@ -63,7 +72,7 @@
&
.image_file
{
background
:
#eee
;
text-align
:
center
;
img
{
padding
:
20px
;
max-width
:
80%
;
...
...
app/views/projects/diffs/_content.html.haml
View file @
ffdccaa0
...
...
@@ -11,7 +11,9 @@
-
elsif
diff_file
.
collapsed?
-
url
=
url_for
(
params
.
merge
(
action: :diff_for_path
,
old_path:
diff_file
.
old_path
,
new_path:
diff_file
.
new_path
))
.nothing-here-block.diff-collapsed
{
data:
{
diff_for_path:
url
}
}
This diff is collapsed. Click to expand it.
This diff is collapsed.
%a
.click-to-expand
Click to expand it.
-
elsif
diff_file
.
diff_lines
.
length
>
0
-
if
diff_view
==
:parallel
=
render
"projects/diffs/parallel_view"
,
diff_file:
diff_file
,
project:
project
,
blob:
blob
...
...
app/views/projects/diffs/_file_header.html.haml
View file @
ffdccaa0
%i
.fa.diff-toggle-caret
-
if
defined?
(
blob
)
&&
blob
&&
diff_file
.
submodule?
%span
=
icon
(
'archive fw'
)
...
...
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