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
9ae7e99a
Commit
9ae7e99a
authored
Dec 29, 2016
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use gl.utils.isInViewport and improve gl.utils.animateToElement.
parent
0f345935
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
22 deletions
+33
-22
app/assets/javascripts/lib/utils/common_utils.js
app/assets/javascripts/lib/utils/common_utils.js
+11
-12
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+7
-9
app/assets/stylesheets/pages/notes.scss
app/assets/stylesheets/pages/notes.scss
+14
-0
spec/javascripts/zen_mode_spec.js
spec/javascripts/zen_mode_spec.js
+1
-1
No files found.
app/assets/javascripts/lib/utils/common_utils.js
View file @
9ae7e99a
...
@@ -128,18 +128,17 @@
...
@@ -128,18 +128,17 @@
return
e
.
metaKey
||
e
.
ctrlKey
||
e
.
altKey
||
e
.
shiftKey
;
return
e
.
metaKey
||
e
.
ctrlKey
||
e
.
altKey
||
e
.
shiftKey
;
};
};
})(
window
);
gl
.
utils
.
isElementVisibleInViewport
=
function
(
el
)
{
var
rect
=
el
.
getBoundingClientRect
();
var
height
=
Math
.
max
(
document
.
documentElement
.
clientHeight
,
window
.
innerHeight
);
return
!
(
rect
.
bottom
-
110
<
0
||
rect
.
top
-
height
>=
0
);
// -110 for sticky GitLab navigation header
};
gl
.
utils
.
animateToElement
=
function
(
$el
)
{
gl
.
utils
.
animateToElement
=
function
(
$el
)
{
var
top
=
$el
.
offset
().
top
;
gl
.
navBarHeight
=
gl
.
navBarHeight
||
$
(
'
.navbar-gitlab
'
).
height
();
gl
.
navLinksHieght
=
gl
.
navLinksHieght
||
$
(
'
.nav-links
'
).
height
();
gl
.
mrTabsHeight
=
gl
.
mrTabsHeight
||
$
(
'
.merge-request-tabs
'
).
height
();
return
$
(
'
body, html
'
).
animate
({
return
$
(
'
body, html
'
).
animate
({
scrollTop
:
$el
.
offset
().
top
-
110
scrollTop
:
top
-
(
gl
.
navBarHeight
+
gl
.
navLinksHieght
+
gl
.
mrTabsHeight
)
},
200
);
},
200
);
};
};
})(
window
);
}).
call
(
this
);
}).
call
(
this
);
app/assets/javascripts/notes.js
View file @
9ae7e99a
...
@@ -498,10 +498,9 @@
...
@@ -498,10 +498,9 @@
}
}
else
{
else
{
var
$buttons
=
$el
.
find
(
'
.note-form-actions
'
);
var
$buttons
=
$el
.
find
(
'
.note-form-actions
'
);
var
isButtonsVisible
=
gl
.
utils
.
isElementVisibleInViewport
(
$buttons
[
0
]);
var
isWidgetVisible
=
gl
.
utils
.
isInViewport
(
$el
[
0
]);
var
isWidgetVisible
=
gl
.
utils
.
isElementVisibleInViewport
(
$el
[
0
]);
if
(
!
is
ButtonsVisible
||
!
is
WidgetVisible
)
{
if
(
!
isWidgetVisible
)
{
gl
.
utils
.
animateToElement
(
$el
);
gl
.
utils
.
animateToElement
(
$el
);
}
}
...
@@ -536,7 +535,7 @@
...
@@ -536,7 +535,7 @@
}
}
}
}
$note
.
find
(
'
.js-note-attachment-delete
'
).
show
();
// Show the attachment delete link
$note
.
find
(
'
.js-note-attachment-delete
'
).
show
();
$editForm
.
addClass
(
'
current-note-edit-form
'
);
$editForm
.
addClass
(
'
current-note-edit-form
'
);
$note
.
addClass
(
'
is-editting
'
);
$note
.
addClass
(
'
is-editting
'
);
this
.
putEditFormInPlace
(
$target
);
this
.
putEditFormInPlace
(
$target
);
...
@@ -580,11 +579,11 @@
...
@@ -580,11 +579,11 @@
};
};
Notes
.
prototype
.
removeNoteEditForm
=
function
(
note
)
{
Notes
.
prototype
.
removeNoteEditForm
=
function
(
note
)
{
var
form
=
note
.
find
(
"
.current-note-edit-form
"
);
var
form
=
note
.
find
(
'
.current-note-edit-form
'
);
note
.
removeClass
(
"
is-editting
"
);
note
.
removeClass
(
'
is-editting
'
);
form
.
removeClass
(
"
current-note-edit-form
"
);
form
.
removeClass
(
'
current-note-edit-form
'
);
// Replace markdown textarea text with original note text.
// Replace markdown textarea text with original note text.
return
form
.
find
(
"
.js-note-text
"
).
val
(
form
.
find
(
'
form.edit-note
'
).
data
(
'
original-note
'
));
return
form
.
find
(
'
.js-note-text
'
).
val
(
form
.
find
(
'
form.edit-note
'
).
data
(
'
original-note
'
));
};
};
...
@@ -885,7 +884,6 @@
...
@@ -885,7 +884,6 @@
};
};
Notes
.
prototype
.
putEditFormInPlace
=
function
(
$el
)
{
Notes
.
prototype
.
putEditFormInPlace
=
function
(
$el
)
{
var
$editForm
=
$
(
this
.
getEditFormSelector
(
$el
));
var
$editForm
=
$
(
this
.
getEditFormSelector
(
$el
));
var
$note
=
$el
.
closest
(
'
.note
'
);
var
$note
=
$el
.
closest
(
'
.note
'
);
...
...
app/assets/stylesheets/pages/notes.scss
View file @
9ae7e99a
...
@@ -585,3 +585,17 @@ ul.notes {
...
@@ -585,3 +585,17 @@ ul.notes {
}
}
}
}
}
}
// Merge request notes in diffs
.diff-file
{
// Diff is side by side
.notes_content.parallel
.note-header
.note-headline-light
{
display
:
block
;
position
:
relative
;
}
// Diff is inline
.notes_content
.note-header
.note-headline-light
{
display
:
inline-block
;
position
:
relative
;
}
}
spec/javascripts/zen_mode_spec.js
View file @
9ae7e99a
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
return
$
(
'
.notes-form .js-zen-enter
'
).
click
();
return
$
(
'
.notes-form .js-zen-enter
'
).
click
();
};
};
exitZen
=
function
()
{
// Ohmmmmmmm
exitZen
=
function
()
{
return
$
(
'
.notes-form .js-zen-leave
'
).
click
();
return
$
(
'
.notes-form .js-zen-leave
'
).
click
();
};
};
...
...
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