Commit 8d8c161a7f1daa92a58194765816b75449769fb1
1 parent
6c777ff8
Exists in
master
and in
4 other branches
Speedup dashboard via loading events with ajax
Showing
4 changed files
with
14 additions
and
4 deletions
Show diff stats
app/assets/javascripts/pager.js
@@ -4,9 +4,16 @@ var Pager = { | @@ -4,9 +4,16 @@ var Pager = { | ||
4 | disable:false, | 4 | disable:false, |
5 | 5 | ||
6 | init: | 6 | init: |
7 | - function(limit) { | 7 | + function(limit, preload) { |
8 | this.limit=limit; | 8 | 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 | + | ||
10 | this.initLoadMore(); | 17 | this.initLoadMore(); |
11 | }, | 18 | }, |
12 | 19 |
app/views/dashboard/_activities.html.haml
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | = event_filter_link EventFilter.team, 'Team' | 7 | = event_filter_link EventFilter.team, 'Team' |
8 | 8 | ||
9 | - if @events.any? | 9 | - if @events.any? |
10 | - .content_list= render @events | 10 | + .content_list |
11 | - else | 11 | - else |
12 | %p.nothing_here_message Projects activity will be displayed here | 12 | %p.nothing_here_message Projects activity will be displayed here |
13 | .loading.hide | 13 | .loading.hide |
app/views/dashboard/index.html.haml
features/dashboard/dashboard.feature
@@ -5,6 +5,7 @@ Feature: Dashboard | @@ -5,6 +5,7 @@ Feature: Dashboard | ||
5 | And project "Shop" has push event | 5 | And project "Shop" has push event |
6 | And I visit dashboard page | 6 | And I visit dashboard page |
7 | 7 | ||
8 | + @javascript | ||
8 | Scenario: I should see projects list | 9 | Scenario: I should see projects list |
9 | Then I should see "New Project" link | 10 | Then I should see "New Project" link |
10 | Then I should see "Shop" project link | 11 | Then I should see "Shop" project link |
@@ -26,11 +27,13 @@ Feature: Dashboard | @@ -26,11 +27,13 @@ Feature: Dashboard | ||
26 | And I click "Create Merge Request" link | 27 | And I click "Create Merge Request" link |
27 | Then I see prefilled new Merge Request page | 28 | Then I see prefilled new Merge Request page |
28 | 29 | ||
30 | + @javascript | ||
29 | Scenario: I should see User joined Project event | 31 | Scenario: I should see User joined Project event |
30 | Given user with name "John Doe" joined project "Shop" | 32 | Given user with name "John Doe" joined project "Shop" |
31 | When I visit dashboard page | 33 | When I visit dashboard page |
32 | Then I should see "John Doe joined project at Shop" event | 34 | Then I should see "John Doe joined project at Shop" event |
33 | 35 | ||
36 | + @javascript | ||
34 | Scenario: I should see User left Project event | 37 | Scenario: I should see User left Project event |
35 | Given user with name "John Doe" joined project "Shop" | 38 | Given user with name "John Doe" joined project "Shop" |
36 | And user with name "John Doe" left project "Shop" | 39 | And user with name "John Doe" left project "Shop" |