Permalink
Browse files

Adding pagination to the instructor scenarios views. Closes #0000379.

  • Loading branch information...
1 parent 190ab5b commit 2bf7bd6fd7f8a0933cdde639b9bf8790cdf77131 Carlos León committed Dec 7, 2011
@@ -46,14 +46,6 @@ $(document).ready(function() {
}
})
-
- // Disable certain links in docs
- // =============================
- // Please do not carry these styles over to your projects, it's merely here to prevent button clicks form taking you away from your spot on page
- $('ul.tabs a, ul.pills a, .pagination a, a.close').click(function (e) {
- e.preventDefault();
- })
-
// Copy code blocks in docs
$(".copy-code").focus(function () {
var el = this;
@@ -20,7 +20,7 @@ class Admins::MasterScenariosController < Admins::ApplicationController
def index
- @master_scenarios = MasterScenario.all(:include => [:user, :client_version])
+ @master_scenarios = MasterScenario.paginate(:page => params[:page], :per_page => 25, :include => [:user, :client_version])
end
def tag
@@ -11,7 +11,7 @@ class Admins::ScenariosController < Admins::ApplicationController
def index
- @scenarios = Scenario.all(:include => [:master_scenario])
+ @scenarios = Scenario.paginate(:page => params[:page], :per_page => 25, :include => [:user, :master_scenario])
end
def list
@@ -26,7 +26,7 @@ def load_scenario
end
def load_scenarios
- @scenarios = Scenario.shared
+ @scenarios = Scenario.shared.paginate :per_page => 25, :page => params[:page]
end
end
@@ -15,3 +15,5 @@
%td= link_to scenario.name, admins_master_scenario_path(scenario)
%td= scenario.user.name
%td= link_to scenario.client_version.version, admins_settings_client_version_path(scenario.client_version) if scenario.client_version
+
+= will_paginate @master_scenarios
@@ -16,7 +16,7 @@
%td= group.members.count
%td= group.group_scenarios.count
%td= group.created_at.to_formatted_s(:long)
- %br/
+
= will_paginate @groups
- else
%p
@@ -29,3 +29,4 @@
%em This scenario has not been cloned.
%td= scenario.created_at.to_formatted_s(:long)
%td= link_to 'Clone', instructors_shared_scenario_clone_path(scenario), :confirm => 'Are you sure?', :class => 'btn success'
+= will_paginate @scenarios
@@ -16,5 +16,5 @@
%td= group.members.count
%td= group.scenarios.count
%td= group.created_at.to_formatted_s(:long)
-%br/
+
= will_paginate @groups
@@ -14,5 +14,5 @@
%td= instructor.email
%td= instructor.managed_groups.count
%td= instructor.created_scenarios.count
-%br/
+
= will_paginate @instructors
@@ -16,5 +16,4 @@
%td= scenario.master_scenario.try(:name)
%td= scenario.created_at.to_formatted_s(:long)
-%br/
= will_paginate @scenarios

0 comments on commit 2bf7bd6

Please sign in to comment.