Commit a69fc5dd23bd502fd36892a80eec21a4c53891f8
1 parent
860fa116
Exists in
master
and in
4 other branches
Endless event loading for dsahboard
Showing
5 changed files
with
10 additions
and
8 deletions
Show diff stats
app/assets/stylesheets/header.scss
app/assets/stylesheets/themes/ui_mars.scss
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