Skip to content

Commit 8d8c161

Browse files
committed
Speedup dashboard via loading events with ajax
1 parent 6c777ff commit 8d8c161

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

app/assets/javascripts/pager.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@ var Pager = {
44
disable:false,
55

66
init:
7-
function(limit) {
7+
function(limit, preload) {
88
this.limit=limit;
9-
this.offset=limit;
9+
10+
if(preload) {
11+
this.offset = 0;
12+
this.getOld();
13+
} else {
14+
this.offset = limit;
15+
}
16+
1017
this.initLoadMore();
1118
},
1219

app/views/dashboard/_activities.html.haml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
= event_filter_link EventFilter.team, 'Team'
88

99
- if @events.any?
10-
.content_list= render @events
10+
.content_list
1111
- else
1212
%p.nothing_here_message Projects activity will be displayed here
1313
.loading.hide

app/views/dashboard/index.html.haml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
- else
99
= render "zero_authorized_projects"
1010
:javascript
11-
$(function(){ Pager.init(20); });
11+
$(function(){ Pager.init(20, true); });

features/dashboard/dashboard.feature

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Feature: Dashboard
55
And project "Shop" has push event
66
And I visit dashboard page
77

8+
@javascript
89
Scenario: I should see projects list
910
Then I should see "New Project" link
1011
Then I should see "Shop" project link
@@ -26,11 +27,13 @@ Feature: Dashboard
2627
And I click "Create Merge Request" link
2728
Then I see prefilled new Merge Request page
2829

30+
@javascript
2931
Scenario: I should see User joined Project event
3032
Given user with name "John Doe" joined project "Shop"
3133
When I visit dashboard page
3234
Then I should see "John Doe joined project at Shop" event
3335

36+
@javascript
3437
Scenario: I should see User left Project event
3538
Given user with name "John Doe" joined project "Shop"
3639
And user with name "John Doe" left project "Shop"

0 commit comments

Comments
 (0)