From 2e9aab137f3956143853f65204de15279663541f Mon Sep 17 00:00:00 2001 From: Nick van der Burgt Date: Mon, 27 Dec 2010 20:06:35 +0100 Subject: [PATCH 1/9] Added some more HTML5 elements so no suprises in the future --- public/javascripts/ie.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/javascripts/ie.js b/public/javascripts/ie.js index 86009f067..04df4fc06 100644 --- a/public/javascripts/ie.js +++ b/public/javascripts/ie.js @@ -1,2 +1,6 @@ -document.createElement('header'); -document.createElement('footer'); \ No newline at end of file +var elements = new Array('header','footer','article','nav','section'); + +for(var element in elements) +{ + document.createElement(elements[element]); +} \ No newline at end of file From 507a2737162dbc15c9b3963dac11841dcc659da9 Mon Sep 17 00:00:00 2001 From: Nick van der Burgt Date: Tue, 28 Dec 2010 20:41:26 +0100 Subject: [PATCH 2/9] Modified IE to be compatible in the future --- public/javascripts/ie.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/public/javascripts/ie.js b/public/javascripts/ie.js index 04df4fc06..330c8be04 100644 --- a/public/javascripts/ie.js +++ b/public/javascripts/ie.js @@ -1,6 +1,3 @@ var elements = new Array('header','footer','article','nav','section'); -for(var element in elements) -{ - document.createElement(elements[element]); -} \ No newline at end of file +for(var element in elements) { document.createElement(elements[element]); } \ No newline at end of file From c7f3a9abfd579c2028b3c74bfb72f0fa52302542 Mon Sep 17 00:00:00 2001 From: Nick van der Burgt Date: Tue, 28 Dec 2010 21:53:31 +0100 Subject: [PATCH 3/9] Pagination for the notifications --- app/controllers/notifications_controller.rb | 7 +++++-- app/views/notifications/index.html.haml | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index 3fc8f5a90..d7877f54e 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -18,9 +18,12 @@ class NotificationsController < ApplicationController end def index - @notifications = Notification.for(current_user).limit(25) + @notifications = Notification.for(current_user).paginate :page => params[:page], :per_page => 25 @group_days = @notifications.group_by{|note| note.created_at.strftime("%B %d") } respond_with @notifications end - + + def delete + + end end diff --git a/app/views/notifications/index.html.haml b/app/views/notifications/index.html.haml index 45d504841..a2b8b6267 100644 --- a/app/views/notifications/index.html.haml +++ b/app/views/notifications/index.html.haml @@ -40,3 +40,4 @@ = object_link(note) %span.time= "#{t('ago', :time => time_ago_in_words(note.created_at))}" + = will_paginate @people From b33056f72bacc6953c80b8d38f1de3e8798bc53a Mon Sep 17 00:00:00 2001 From: Nick van der Burgt Date: Tue, 28 Dec 2010 22:03:13 +0100 Subject: [PATCH 4/9] Fixed a small mistake --- app/controllers/notifications_controller.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index d7877f54e..5d81b2807 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -22,8 +22,4 @@ class NotificationsController < ApplicationController @group_days = @notifications.group_by{|note| note.created_at.strftime("%B %d") } respond_with @notifications end - - def delete - - end end From e0f583d7d3ce94b8f3a72c5de13cacc52b3864d9 Mon Sep 17 00:00:00 2001 From: Nick van der Burgt Date: Wed, 29 Dec 2010 10:51:42 +0100 Subject: [PATCH 5/9] Fixed mistake of running will_paginate on @people instead of @notifications --- app/views/notifications/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/notifications/index.html.haml b/app/views/notifications/index.html.haml index a2b8b6267..5c6fe96f3 100644 --- a/app/views/notifications/index.html.haml +++ b/app/views/notifications/index.html.haml @@ -40,4 +40,4 @@ = object_link(note) %span.time= "#{t('ago', :time => time_ago_in_words(note.created_at))}" - = will_paginate @people + = will_paginate @notifications From 46e9be88d1661793846b20e74030c1cfccc40de2 Mon Sep 17 00:00:00 2001 From: Nick van der Burgt Date: Wed, 29 Dec 2010 12:27:39 +0100 Subject: [PATCH 6/9] Wrote spec test for notifications pagination --- spec/controllers/notifications_controller_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/controllers/notifications_controller_spec.rb b/spec/controllers/notifications_controller_spec.rb index 7a41f887f..78e6955e4 100644 --- a/spec/controllers/notifications_controller_spec.rb +++ b/spec/controllers/notifications_controller_spec.rb @@ -32,4 +32,18 @@ describe NotificationsController do Notification.find(note.id).unread.should == true end end + + describe '#index' do + it 'paginates the notifications' do + 35.times do + Notification.create(:user_id => user.id) + end + + get :index + assigns[:notifications].should == Notification.all(:user_id => user.id, :limit => 25) + + get :index, :page => 2 + assigns[:notifications].should == Notification.all(:user_id => user.id, :offset => 25) + end + end end From 8bbb142c85afdcab03f19a8ecdf3e3ff34ed5cac Mon Sep 17 00:00:00 2001 From: Nick van der Burgt Date: Wed, 29 Dec 2010 12:32:24 +0100 Subject: [PATCH 7/9] Set a limit on the second page --- spec/controllers/notifications_controller_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/controllers/notifications_controller_spec.rb b/spec/controllers/notifications_controller_spec.rb index 78e6955e4..152c98a8b 100644 --- a/spec/controllers/notifications_controller_spec.rb +++ b/spec/controllers/notifications_controller_spec.rb @@ -43,7 +43,7 @@ describe NotificationsController do assigns[:notifications].should == Notification.all(:user_id => user.id, :limit => 25) get :index, :page => 2 - assigns[:notifications].should == Notification.all(:user_id => user.id, :offset => 25) + assigns[:notifications].should == Notification.all(:user_id => user.id, :offset => 25, :limit => 25) end end end From c45fa2d402abc1b7fb36756fab06f9bfd3df623b Mon Sep 17 00:00:00 2001 From: Nick van der Burgt Date: Wed, 29 Dec 2010 16:06:06 +0100 Subject: [PATCH 8/9] Revert changes --- public/javascripts/ie.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/javascripts/ie.js b/public/javascripts/ie.js index 330c8be04..8f2976a79 100644 --- a/public/javascripts/ie.js +++ b/public/javascripts/ie.js @@ -1,3 +1,8 @@ +<<<<<<< HEAD var elements = new Array('header','footer','article','nav','section'); -for(var element in elements) { document.createElement(elements[element]); } \ No newline at end of file +for(var element in elements) { document.createElement(elements[element]); } +======= +document.createElement('header'); +document.createElement('footer'); +>>>>>>> parent of 2e9aab1... Added some more HTML5 elements so no suprises in the future From 3faff76b0c425fad5ac1d16d4337cc3136ac2f61 Mon Sep 17 00:00:00 2001 From: Nick van der Burgt Date: Wed, 29 Dec 2010 16:11:34 +0100 Subject: [PATCH 9/9] Reverted the changes in ie.js --- public/javascripts/ie.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/public/javascripts/ie.js b/public/javascripts/ie.js index 8f2976a79..86009f067 100644 --- a/public/javascripts/ie.js +++ b/public/javascripts/ie.js @@ -1,8 +1,2 @@ -<<<<<<< HEAD -var elements = new Array('header','footer','article','nav','section'); - -for(var element in elements) { document.createElement(elements[element]); } -======= document.createElement('header'); -document.createElement('footer'); ->>>>>>> parent of 2e9aab1... Added some more HTML5 elements so no suprises in the future +document.createElement('footer'); \ No newline at end of file