Commit a69fc5dd23bd502fd36892a80eec21a4c53891f8

Authored by randx
1 parent 860fa116

Endless event loading for dsahboard

app/assets/stylesheets/header.scss
@@ -125,9 +125,6 @@ header { @@ -125,9 +125,6 @@ header {
125 display: block; 125 display: block;
126 cursor: pointer; 126 cursor: pointer;
127 img { 127 img {
128 - -moz-box-shadow: 0 0 5px #ccc;  
129 - -webkit-box-shadow: 0 0 5px #ccc;  
130 - box-shadow: 0 0 5px #ccc;  
131 border-radius: 4px; 128 border-radius: 4px;
132 right: 5px; 129 right: 5px;
133 position: absolute; 130 position: absolute;
app/assets/stylesheets/themes/ui_mars.scss
@@ -70,8 +70,7 @@ @@ -70,8 +70,7 @@
70 } 70 }
71 } 71 }
72 .separator { 72 .separator {
73 - border-color:#444;  
74 - background:#31363E; 73 + display:none;
75 } 74 }
76 75
77 } 76 }
app/controllers/dashboard_controller.rb
@@ -3,11 +3,12 @@ class DashboardController < ApplicationController @@ -3,11 +3,12 @@ class DashboardController < ApplicationController
3 3
4 def index 4 def index
5 @projects = current_user.projects_with_events.page(params[:page]).per(40) 5 @projects = current_user.projects_with_events.page(params[:page]).per(40)
6 - @events = Event.recent_for_user(current_user).limit(20) 6 + @events = Event.recent_for_user(current_user).limit(20).offset(params[:offset] || 0)
7 @last_push = current_user.recent_push 7 @last_push = current_user.recent_push
8 8
9 respond_to do |format| 9 respond_to do |format|
10 format.html 10 format.html
  11 + format.js
11 format.atom { render :layout => false } 12 format.atom { render :layout => false }
12 end 13 end
13 end 14 end
app/views/dashboard/index.html.haml
@@ -10,9 +10,10 @@ @@ -10,9 +10,10 @@
10 add new key 10 add new key
11 to your profile 11 to your profile
12 - if @events.any? 12 - if @events.any?
13 - = render @events 13 + .content_list= render @events
14 - else 14 - else
15 %h4.nothing_here_message Projects activity will be displayed here 15 %h4.nothing_here_message Projects activity will be displayed here
  16 + .loading.hide
16 .side 17 .side
17 = render "events/event_last_push", :event => @last_push 18 = render "events/event_last_push", :event => @last_push
18 .projects_box 19 .projects_box
@@ -54,3 +55,7 @@ @@ -54,3 +55,7 @@
54 New Project » 55 New Project »
55 - else 56 - else
56 If you will be added to project - it will be displayed here 57 If you will be added to project - it will be displayed here
  58 +
  59 +
  60 +:javascript
  61 + $(function(){ Pager.init(20); });
app/views/dashboard/index.js.haml
1 :plain 1 :plain
2 - $(".projects .activities").append("#{escape_javascript(render(@events))}"); 2 + Pager.append(#{@events.count}, "#{escape_javascript(render(@events))}");