Commit a69fc5dd23bd502fd36892a80eec21a4c53891f8

Authored by randx
1 parent 860fa116

Endless event loading for dsahboard

app/assets/stylesheets/header.scss
... ... @@ -125,9 +125,6 @@ header {
125 125 display: block;
126 126 cursor: pointer;
127 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 128 border-radius: 4px;
132 129 right: 5px;
133 130 position: absolute;
... ...
app/assets/stylesheets/themes/ui_mars.scss
... ... @@ -70,8 +70,7 @@
70 70 }
71 71 }
72 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 3  
4 4 def index
5 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 7 @last_push = current_user.recent_push
8 8  
9 9 respond_to do |format|
10 10 format.html
  11 + format.js
11 12 format.atom { render :layout => false }
12 13 end
13 14 end
... ...
app/views/dashboard/index.html.haml
... ... @@ -10,9 +10,10 @@
10 10 add new key
11 11 to your profile
12 12 - if @events.any?
13   - = render @events
  13 + .content_list= render @events
14 14 - else
15 15 %h4.nothing_here_message Projects activity will be displayed here
  16 + .loading.hide
16 17 .side
17 18 = render "events/event_last_push", :event => @last_push
18 19 .projects_box
... ... @@ -54,3 +55,7 @@
54 55 New Project »
55 56 - else
56 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 1 :plain
2   - $(".projects .activities").append("#{escape_javascript(render(@events))}");
  2 + Pager.append(#{@events.count}, "#{escape_javascript(render(@events))}");
... ...