Commit 8d8c161a7f1daa92a58194765816b75449769fb1

Authored by Dmitriy Zaporozhets
1 parent 6c777ff8

Speedup dashboard via loading events with ajax

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