Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit 2bf7bd6fd7f8a0933cdde639b9bf8790cdf77131 1 parent 190ab5b
Carlos León authored
8 app/assets/javascripts/bootstrap.js
@@ -46,14 +46,6 @@ $(document).ready(function() {
46 46 }
47 47 })
48 48
49   -
50   - // Disable certain links in docs
51   - // =============================
52   - // 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
53   - $('ul.tabs a, ul.pills a, .pagination a, a.close').click(function (e) {
54   - e.preventDefault();
55   - })
56   -
57 49 // Copy code blocks in docs
58 50 $(".copy-code").focus(function () {
59 51 var el = this;
2  app/controllers/admins/master_scenarios_controller.rb
@@ -20,7 +20,7 @@ class Admins::MasterScenariosController < Admins::ApplicationController
20 20
21 21
22 22 def index
23   - @master_scenarios = MasterScenario.all(:include => [:user, :client_version])
  23 + @master_scenarios = MasterScenario.paginate(:page => params[:page], :per_page => 25, :include => [:user, :client_version])
24 24 end
25 25
26 26 def tag
2  app/controllers/admins/scenarios_controller.rb
@@ -11,7 +11,7 @@ class Admins::ScenariosController < Admins::ApplicationController
11 11
12 12
13 13 def index
14   - @scenarios = Scenario.all(:include => [:master_scenario])
  14 + @scenarios = Scenario.paginate(:page => params[:page], :per_page => 25, :include => [:user, :master_scenario])
15 15 end
16 16
17 17 def list
2  app/controllers/instructors/shared_scenarios_controller.rb
@@ -26,7 +26,7 @@ def load_scenario
26 26 end
27 27
28 28 def load_scenarios
29   - @scenarios = Scenario.shared
  29 + @scenarios = Scenario.shared.paginate :per_page => 25, :page => params[:page]
30 30 end
31 31
32 32 end
2  app/views/admins/master_scenarios/index.html.haml
@@ -15,3 +15,5 @@
15 15 %td= link_to scenario.name, admins_master_scenario_path(scenario)
16 16 %td= scenario.user.name
17 17 %td= link_to scenario.client_version.version, admins_settings_client_version_path(scenario.client_version) if scenario.client_version
  18 +
  19 += will_paginate @master_scenarios
2  app/views/instructors/groups/index.html.haml
@@ -16,7 +16,7 @@
16 16 %td= group.members.count
17 17 %td= group.group_scenarios.count
18 18 %td= group.created_at.to_formatted_s(:long)
19   - %br/
  19 +
20 20 = will_paginate @groups
21 21 - else
22 22 %p
1  app/views/instructors/shared_scenarios/index.html.haml
@@ -29,3 +29,4 @@
29 29 %em This scenario has not been cloned.
30 30 %td= scenario.created_at.to_formatted_s(:long)
31 31 %td= link_to 'Clone', instructors_shared_scenario_clone_path(scenario), :confirm => 'Are you sure?', :class => 'btn success'
  32 += will_paginate @scenarios
2  app/views/managers/groups/index.html.haml
@@ -16,5 +16,5 @@
16 16 %td= group.members.count
17 17 %td= group.scenarios.count
18 18 %td= group.created_at.to_formatted_s(:long)
19   -%br/
  19 +
20 20 = will_paginate @groups
2  app/views/managers/instructors/index.html.haml
@@ -14,5 +14,5 @@
14 14 %td= instructor.email
15 15 %td= instructor.managed_groups.count
16 16 %td= instructor.created_scenarios.count
17   -%br/
  17 +
18 18 = will_paginate @instructors
1  app/views/managers/scenarios/index.html.haml
@@ -16,5 +16,4 @@
16 16 %td= scenario.master_scenario.try(:name)
17 17 %td= scenario.created_at.to_formatted_s(:long)
18 18
19   -%br/
20 19 = will_paginate @scenarios

0 comments on commit 2bf7bd6

Please sign in to comment.
Something went wrong with that request. Please try again.