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
0dd95ca9
Commit
0dd95ca9
authored
Nov 21, 2016
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix some code style issues according to feedback
parent
ddab50b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
12 deletions
+16
-12
app/assets/javascripts/activities.js.es6
app/assets/javascripts/activities.js.es6
+6
-5
app/assets/javascripts/pager.js.es6
app/assets/javascripts/pager.js.es6
+10
-7
No files found.
app/assets/javascripts/activities.js.es6
View file @
0dd95ca9
...
@@ -5,9 +5,9 @@
...
@@ -5,9 +5,9 @@
class Activities {
class Activities {
constructor() {
constructor() {
Pager.init(20, true, false, this.updateTooltips);
Pager.init(20, true, false, this.updateTooltips);
$('.event-filter-link').on('click', (e
vent
) => {
$('.event-filter-link').on('click', (e) => {
e
vent
.preventDefault();
e.preventDefault();
this.toggleFilter(
$(event.currentTarget)
);
this.toggleFilter(
e.currentTarget
);
this.reloadActivities();
this.reloadActivities();
});
});
}
}
...
@@ -22,12 +22,13 @@
...
@@ -22,12 +22,13 @@
}
}
toggleFilter(sender) {
toggleFilter(sender) {
const filter = sender.attr('id').split('_')[0];
const $sender = $(sender);
const filter = $sender.attr('id').split('_')[0];
$('.event-filter .active').removeClass('active');
$('.event-filter .active').removeClass('active');
Cookies.set('event_filter', filter);
Cookies.set('event_filter', filter);
sender.closest('li').toggleClass('active');
$
sender.closest('li').toggleClass('active');
}
}
}
}
...
...
app/assets/javascripts/pager.js.es6
View file @
0dd95ca9
(() => {
(() => {
const ENDLESS_SCROLL_BOTTOM_PX = 400;
const ENDLESS_SCROLL_FIRE_DELAY_MS = 1000;
const Pager = {
const Pager = {
init(limit = 0, preload = false, disable = false, callback = $.noop) {
init(limit = 0, preload = false, disable = false, callback = $.noop) {
this.limit = limit;
this.limit = limit;
this.offset = this.limit;
this.disable = disable;
this.disable = disable;
this.callback = callback;
this.callback = callback;
this.loading = $('.loading').first();
this.loading = $('.loading').first();
if (preload) {
if (preload) {
this.offset = 0;
this.offset = 0;
this.getOld();
this.getOld();
} else {
this.offset = this.limit;
}
}
this.initLoadMore();
this.initLoadMore();
},
},
...
@@ -20,19 +22,19 @@
...
@@ -20,19 +22,19 @@
type: 'GET',
type: 'GET',
url: $('.content_list').data('href') || window.location.href,
url: $('.content_list').data('href') || window.location.href,
data: `limit=${this.limit}&offset=${this.offset}`,
data: `limit=${this.limit}&offset=${this.offset}`,
dataType: 'json',
error: () => this.loading.hide(),
error: () => this.loading.hide(),
success: (data) => {
success: (data) => {
this.append(data.count, data.html);
this.append(data.count, data.html);
this.callback();
this.callback();
// keep loading until we've filled the viewport height
// keep loading until we've filled the viewport height
if (
data.count > 0
&& !this.isScrollable()) {
if (
!this.disable
&& !this.isScrollable()) {
this.getOld();
this.getOld();
} else {
} else {
this.loading.hide();
this.loading.hide();
}
}
},
},
dataType: 'json',
});
});
},
},
...
@@ -46,14 +48,15 @@
...
@@ -46,14 +48,15 @@
},
},
isScrollable() {
isScrollable() {
return $(document).height() > $(window).height() + $(window).scrollTop() + 400;
const $w = $(window);
return $(document).height() > $w.height() + $w.scrollTop() + ENDLESS_SCROLL_BOTTOM_PX;
},
},
initLoadMore() {
initLoadMore() {
$(document).unbind('scroll');
$(document).unbind('scroll');
$(document).endlessScroll({
$(document).endlessScroll({
bottomPixels:
400
,
bottomPixels:
ENDLESS_SCROLL_BOTTOM_PX
,
fireDelay:
1000
,
fireDelay:
ENDLESS_SCROLL_FIRE_DELAY_MS
,
fireOnce: true,
fireOnce: true,
ceaseFire: () => this.disable === true,
ceaseFire: () => this.disable === true,
callback: () => {
callback: () => {
...
...
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