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
2e217bc8
Commit
2e217bc8
authored
Oct 25, 2016
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor awkward bind workarounds into arrow functions
parent
f14c5ae8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
69 deletions
+44
-69
app/assets/javascripts/merge_request_tabs.js.es6
app/assets/javascripts/merge_request_tabs.js.es6
+44
-69
No files found.
app/assets/javascripts/merge_request_tabs.js.es6
View file @
2e217bc8
...
...
@@ -201,14 +201,12 @@
}
this.ajaxGet({
url: source + ".json",
success: (function(_this) {
return function(data) {
success: (data) => {
document.querySelector("div#commits").innerHTML = data.html;
gl.utils.localTimeAgo($('.js-timeago', 'div#commits'));
_this.commitsLoaded = true;
_this.scrollToElement("#commits");
};
})(this)
this.commitsLoaded = true;
this.scrollToElement("#commits");
}
});
}
...
...
@@ -224,8 +222,7 @@
this.ajaxGet({
url: (url.pathname + ".json") + this._location.search,
success: (function(_this) {
return function(data) {
success: (data) => {
$('#diffs').html(data.html);
if (typeof gl.diffNotesCompileComponents !== 'undefined') {
...
...
@@ -235,15 +232,14 @@
gl.utils.localTimeAgo($('.js-timeago', 'div#diffs'));
$('#diffs .js-syntax-highlight').syntaxHighlight();
if (_this.diffViewType() === 'parallel' && (_this.isDiffAction(_this.currentAction)
) ) {
_
this.expandViewContainer();
if (this.diffViewType() === 'parallel' && this.isDiffAction(this.currentAction
) ) {
this.expandViewContainer();
}
_
this.diffsLoaded = true;
_
this.scrollToElement("#diffs");
this.diffsLoaded = true;
this.scrollToElement("#diffs");
new Diff();
};
})(this)
}
});
}
...
...
@@ -253,15 +249,13 @@
}
this.ajaxGet({
url: source + ".json",
success: (function(_this) {
return function(data) {
success: (data) => {
document.querySelector("div#builds").innerHTML = data.html;
gl.utils.localTimeAgo($('.js-timeago', 'div#builds'));
_this.buildsLoaded = true;
if (!this.pipelines) this.pipelines = new gl.Pipelines();
_this.scrollToElement("#builds");
};
})(this)
this.buildsLoaded = true;
new gl.Pipelines();
this.scrollToElement("#builds");
}
});
}
...
...
@@ -271,12 +265,12 @@
}
this.ajaxGet({
url: source + ".json",
success:
function(data)
{
success:
(data) =>
{
$('#pipelines').html(data.html);
gl.utils.localTimeAgo($('.js-timeago', '#pipelines'));
this.pipelinesLoaded = true;
this.scrollToElement("#pipelines");
}
.bind(this)
}
});
}
...
...
@@ -289,16 +283,8 @@
ajaxGet(options) {
var defaults = {
beforeSend: (function(_this) {
return function() {
_this.toggleLoading(true);
};
})(this),
complete: (function(_this) {
return function() {
_this.toggleLoading(false);
};
})(this),
beforeSend: () => this.toggleLoading(true),
complete: () => this.toggleLoading(false),
dataType: 'json',
type: 'GET'
};
...
...
@@ -334,7 +320,7 @@
$gutterIcon = $('.js-sidebar-toggle i:visible');
// Wait until listeners are set
setTimeout(
function()
{
setTimeout(
() =>
{
// Only when sidebar is expanded
if ($gutterIcon.is('.fa-angle-double-right')) {
$gutterIcon.closest('a').trigger('click', [true]);
...
...
@@ -351,7 +337,7 @@
$gutterIcon = $('.js-sidebar-toggle i:visible');
// Wait until listeners are set
setTimeout(
function()
{
setTimeout(
() =>
{
// Only when sidebar is collapsed
if ($gutterIcon.is('.fa-angle-double-left')) {
$gutterIcon.closest('a').trigger('click', [true]);
...
...
@@ -371,24 +357,13 @@
$layoutNav = $('.layout-nav');
$tabs.off('affix.bs.affix affix-top.bs.affix')
.affix({
offset: {
top: function () {
var tabsTop = $diffTabs.offset().top - $tabs.height();
tabsTop = tabsTop - ($fixedNav.height() + $layoutNav.height());
return tabsTop;
}
}
}).on('affix.bs.affix', function () {
$diffTabs.css({
marginTop: $tabs.height()
});
}).on('affix-top.bs.affix', function () {
$diffTabs.css({
marginTop: ''
});
});
.affix({ offset: {
top: () => (
$diffTabs.offset().top - $tabs.height() - $fixedNav.height() - $layoutNav.height()
)
}})
.on('affix.bs.affix', () => $diffTabs.css({ marginTop: $tabs.height() }))
.on('affix-top.bs.affix', () => $diffTabs.css({ marginTop: '' }));
// Fix bug when reloading the page already scrolling
if ($tabs.hasClass('affix')) {
...
...
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