paginated_table 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (20) hide show
  1. data/lib/paginated_table/version.rb +1 -1
  2. data/lib/paginated_table/view_helpers.rb +4 -1
  3. data/test/dummy/app/controllers/data_controller.rb +31 -18
  4. data/test/dummy/log/test.log +8610 -0
  5. data/test/dummy/tmp/cache/assets/CB7/360/sprockets%2F8334f01490cb91467dfd76ad25b67780 +0 -0
  6. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  7. data/test/dummy/tmp/cache/assets/D25/810/sprockets%2F4ff88255fbab9775241c5d8c8c6e2088 +0 -0
  8. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  9. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  10. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  11. data/test/dummy/tmp/cache/assets/D62/6D0/sprockets%2F9b8014b0c5371c3bf5dd4f018a5ec71e +0 -0
  12. data/test/dummy/tmp/cache/assets/D71/1A0/sprockets%2F32c631252aee35736d93e06f3edffd6d +0 -0
  13. data/test/dummy/tmp/cache/assets/DD3/F90/sprockets%2Fc24290dff33aff9c3d2f971f6d8ae04b +0 -0
  14. data/test/dummy/tmp/cache/assets/DD4/950/sprockets%2F09e7f24ef1ff59b4fc390bdf415c60af +0 -0
  15. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +4 -4
  16. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  17. data/test/dummy/tmp/capybara/capybara-201205040001414070882330.html +89 -0
  18. data/test/dummy/tmp/capybara/capybara-201205040002105576336978.html +89 -0
  19. data/test/integration/paginated_table_integration_test.rb +28 -0
  20. metadata +8 -4
@@ -1,6 +1,4 @@
1
- o: ActiveSupport::Cache::Entry :@expires_in0:@compressedF: @value" {" lengthi�"content_type"application/javascript"
2
- class"BundledAsset"
3
- mtime"2012-04-10T01:09:12-04:00"logical_path"application.js" source"�/*!
1
+ o: ActiveSupport::Cache::Entry :@expires_in0:@compressedF: @value" {" source"�/*!
4
2
  * jQuery JavaScript Library v1.7.2
5
3
  * http://jquery.com/
6
4
  *
@@ -9806,4 +9804,6 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
9806
9804
 
9807
9805
 
9808
9806
  ;
9809
- :@created_atf1334034560.98760294�
9807
+ "
9808
+ class"BundledAsset"
9809
+ mtime"2012-04-20T22:18:11-04:00"required_assets_digest"%00fb7908858e320343ba486bfd9e7092" lengthi�"content_type"application/javascript" digest"%0084fd172d70e6b40ffe78256f50f99b"logical_path"application.js:@created_atf1336142067.934361̒
@@ -0,0 +1,89 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <link href="/assets/application.css" media="all" rel="stylesheet" type="text/css">
6
+ <script src="/assets/application.js" type="text/javascript"></script>
7
+ </head>
8
+ <body>
9
+
10
+ <h1>Data</h1>
11
+
12
+ <div class="paginated_table">
13
+ <div class="header">
14
+ <div class="info">Displaying data controller/data <b>1&nbsp;-&nbsp;10</b> of <b>50</b> in total</div>
15
+ <div class="links"><div class="pagination">
16
+ <span class="previous_page disabled">&larr; Previous</span> <em class="current">1</em> <a href="/data?page=2&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" data-remote="true" rel="next">2</a> <a href="/data?page=3&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" data-remote="true">3</a> <a href="/data?page=4&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" data-remote="true">4</a> <a href="/data?page=5&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" data-remote="true">5</a> <a href="/data?page=2&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" class="next_page" data-remote="true" rel="next">Next &rarr;</a>
17
+ </div></div>
18
+ </div>
19
+ <table class="paginated">
20
+ <thead><tr>
21
+ <th class="sortable"><a href="/data?page=1&amp;per_page=10&amp;sort_column=name&amp;sort_direction=asc" data-remote="true">Name</a></th>
22
+ <th>Link</th>
23
+ <th class="sortable"><a href="/data?page=1&amp;per_page=10&amp;sort_column=inspect&amp;sort_direction=asc" data-remote="true">Raw</a></th>
24
+ </tr></thead>
25
+ <tbody>
26
+ <tr>
27
+ <td>Name 51</td>
28
+ <td><a href="/data/51">51</a></td>
29
+ <td>#&lt;struct DataController::Datum id=51, name="Name 51"&gt;</td>
30
+ </tr>
31
+ <tr>
32
+ <td>Name 52</td>
33
+ <td><a href="/data/52">52</a></td>
34
+ <td>#&lt;struct DataController::Datum id=52, name="Name 52"&gt;</td>
35
+ </tr>
36
+ <tr>
37
+ <td>Name 53</td>
38
+ <td><a href="/data/53">53</a></td>
39
+ <td>#&lt;struct DataController::Datum id=53, name="Name 53"&gt;</td>
40
+ </tr>
41
+ <tr>
42
+ <td>Name 54</td>
43
+ <td><a href="/data/54">54</a></td>
44
+ <td>#&lt;struct DataController::Datum id=54, name="Name 54"&gt;</td>
45
+ </tr>
46
+ <tr>
47
+ <td>Name 55</td>
48
+ <td><a href="/data/55">55</a></td>
49
+ <td>#&lt;struct DataController::Datum id=55, name="Name 55"&gt;</td>
50
+ </tr>
51
+ <tr>
52
+ <td>Name 56</td>
53
+ <td><a href="/data/56">56</a></td>
54
+ <td>#&lt;struct DataController::Datum id=56, name="Name 56"&gt;</td>
55
+ </tr>
56
+ <tr>
57
+ <td>Name 57</td>
58
+ <td><a href="/data/57">57</a></td>
59
+ <td>#&lt;struct DataController::Datum id=57, name="Name 57"&gt;</td>
60
+ </tr>
61
+ <tr>
62
+ <td>Name 58</td>
63
+ <td><a href="/data/58">58</a></td>
64
+ <td>#&lt;struct DataController::Datum id=58, name="Name 58"&gt;</td>
65
+ </tr>
66
+ <tr>
67
+ <td>Name 59</td>
68
+ <td><a href="/data/59">59</a></td>
69
+ <td>#&lt;struct DataController::Datum id=59, name="Name 59"&gt;</td>
70
+ </tr>
71
+ <tr>
72
+ <td>Name 60</td>
73
+ <td><a href="/data/60">60</a></td>
74
+ <td>#&lt;struct DataController::Datum id=60, name="Name 60"&gt;</td>
75
+ </tr>
76
+ </tbody>
77
+ </table>
78
+ <div class="header">
79
+ <div class="info">Displaying data controller/data <b>1&nbsp;-&nbsp;10</b> of <b>50</b> in total</div>
80
+ <div class="links"><div class="pagination">
81
+ <span class="previous_page disabled">&larr; Previous</span> <em class="current">1</em> <a href="/data?page=2&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" data-remote="true" rel="next">2</a> <a href="/data?page=3&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" data-remote="true">3</a> <a href="/data?page=4&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" data-remote="true">4</a> <a href="/data?page=5&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" data-remote="true">5</a> <a href="/data?page=2&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" class="next_page" data-remote="true" rel="next">Next &rarr;</a>
82
+ </div></div>
83
+ </div>
84
+ </div>
85
+
86
+
87
+
88
+ </body>
89
+ </html>
@@ -0,0 +1,89 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <link href="/assets/application.css" media="all" rel="stylesheet" type="text/css">
6
+ <script src="/assets/application.js" type="text/javascript"></script>
7
+ </head>
8
+ <body>
9
+
10
+ <h1>Data</h1>
11
+
12
+ <div class="paginated_table">
13
+ <div class="header">
14
+ <div class="info">Displaying data controller/data <b>1&nbsp;-&nbsp;10</b> of <b>50</b> in total</div>
15
+ <div class="links"><div class="pagination">
16
+ <span class="previous_page disabled">&larr; Previous</span> <em class="current">1</em> <a href="/data?page=2&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" data-remote="true" rel="next">2</a> <a href="/data?page=3&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" data-remote="true">3</a> <a href="/data?page=4&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" data-remote="true">4</a> <a href="/data?page=5&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" data-remote="true">5</a> <a href="/data?page=2&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" class="next_page" data-remote="true" rel="next">Next &rarr;</a>
17
+ </div></div>
18
+ </div>
19
+ <table class="paginated">
20
+ <thead><tr>
21
+ <th class="sortable"><a href="/data?page=1&amp;per_page=10&amp;sort_column=name&amp;sort_direction=asc" data-remote="true">Name</a></th>
22
+ <th>Link</th>
23
+ <th class="sortable"><a href="/data?page=1&amp;per_page=10&amp;sort_column=inspect&amp;sort_direction=asc" data-remote="true">Raw</a></th>
24
+ </tr></thead>
25
+ <tbody>
26
+ <tr>
27
+ <td>Name 51</td>
28
+ <td><a href="/data/51">51</a></td>
29
+ <td>#&lt;struct DataController::Datum id=51, name="Name 51"&gt;</td>
30
+ </tr>
31
+ <tr>
32
+ <td>Name 52</td>
33
+ <td><a href="/data/52">52</a></td>
34
+ <td>#&lt;struct DataController::Datum id=52, name="Name 52"&gt;</td>
35
+ </tr>
36
+ <tr>
37
+ <td>Name 53</td>
38
+ <td><a href="/data/53">53</a></td>
39
+ <td>#&lt;struct DataController::Datum id=53, name="Name 53"&gt;</td>
40
+ </tr>
41
+ <tr>
42
+ <td>Name 54</td>
43
+ <td><a href="/data/54">54</a></td>
44
+ <td>#&lt;struct DataController::Datum id=54, name="Name 54"&gt;</td>
45
+ </tr>
46
+ <tr>
47
+ <td>Name 55</td>
48
+ <td><a href="/data/55">55</a></td>
49
+ <td>#&lt;struct DataController::Datum id=55, name="Name 55"&gt;</td>
50
+ </tr>
51
+ <tr>
52
+ <td>Name 56</td>
53
+ <td><a href="/data/56">56</a></td>
54
+ <td>#&lt;struct DataController::Datum id=56, name="Name 56"&gt;</td>
55
+ </tr>
56
+ <tr>
57
+ <td>Name 57</td>
58
+ <td><a href="/data/57">57</a></td>
59
+ <td>#&lt;struct DataController::Datum id=57, name="Name 57"&gt;</td>
60
+ </tr>
61
+ <tr>
62
+ <td>Name 58</td>
63
+ <td><a href="/data/58">58</a></td>
64
+ <td>#&lt;struct DataController::Datum id=58, name="Name 58"&gt;</td>
65
+ </tr>
66
+ <tr>
67
+ <td>Name 59</td>
68
+ <td><a href="/data/59">59</a></td>
69
+ <td>#&lt;struct DataController::Datum id=59, name="Name 59"&gt;</td>
70
+ </tr>
71
+ <tr>
72
+ <td>Name 60</td>
73
+ <td><a href="/data/60">60</a></td>
74
+ <td>#&lt;struct DataController::Datum id=60, name="Name 60"&gt;</td>
75
+ </tr>
76
+ </tbody>
77
+ </table>
78
+ <div class="header">
79
+ <div class="info">Displaying data controller/data <b>1&nbsp;-&nbsp;10</b> of <b>50</b> in total</div>
80
+ <div class="links"><div class="pagination">
81
+ <span class="previous_page disabled">&larr; Previous</span> <em class="current">1</em> <a href="/data?page=2&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" data-remote="true" rel="next">2</a> <a href="/data?page=3&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" data-remote="true">3</a> <a href="/data?page=4&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" data-remote="true">4</a> <a href="/data?page=5&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" data-remote="true">5</a> <a href="/data?page=2&amp;per_page=10&amp;search=secondhalf&amp;sort_column=id&amp;sort_direction=asc" class="next_page" data-remote="true" rel="next">Next &rarr;</a>
82
+ </div></div>
83
+ </div>
84
+ </div>
85
+
86
+
87
+
88
+ </body>
89
+ </html>
@@ -186,6 +186,34 @@ describe "paginated_table integration" do
186
186
  end
187
187
  end
188
188
 
189
+ describe "searching" do
190
+ it "limits the results" do
191
+ visit "/data?search=secondhalf"
192
+ pagination_info_text.must_equal "Displaying data controller/data 1 - 10 of 50 in total"
193
+ (51..60).each_with_index do |id, index|
194
+ page.has_xpath?("#{tr_xpath(index + 1)}/td[1][.='Name #{id}']").must_equal true
195
+ end
196
+ end
197
+
198
+ it "following the page links preserves the search criteria" do
199
+ visit "/data?search=secondhalf"
200
+ click_link "2"
201
+ pagination_info_text.must_equal "Displaying data controller/data 11 - 20 of 50 in total"
202
+ (61..70).each_with_index do |id, index|
203
+ page.has_xpath?("#{tr_xpath(index + 1)}/td[1][.='Name #{id}']").must_equal true
204
+ end
205
+ end
206
+
207
+ it "following the sort links preserves the search criteria" do
208
+ visit "/data?search=secondhalf"
209
+ click_link "Name"
210
+ pagination_info_text.must_equal "Displaying data controller/data 1 - 10 of 50 in total"
211
+ [100, 51, 52, 53, 54, 55, 56, 57, 58, 59].each_with_index do |id, index|
212
+ page.has_xpath?("#{tr_xpath(index + 1)}/td[1][.='Name #{id}']").must_equal true
213
+ end
214
+ end
215
+ end
216
+
189
217
  def pagination_xpath
190
218
  "//div[@class='paginated_table']"
191
219
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paginated_table
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Donald Ball
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-05-03 00:00:00 Z
18
+ date: 2012-05-04 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -187,6 +187,8 @@ files:
187
187
  - test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
188
188
  - test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
189
189
  - test/dummy/tmp/capybara/capybara-201204041545476374284085.html
190
+ - test/dummy/tmp/capybara/capybara-201205040001414070882330.html
191
+ - test/dummy/tmp/capybara/capybara-201205040002105576336978.html
190
192
  - test/integration/paginated_table_integration_test.rb
191
193
  - test/test_helper.rb
192
194
  - test/units/config_test.rb
@@ -277,6 +279,8 @@ test_files:
277
279
  - test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
278
280
  - test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
279
281
  - test/dummy/tmp/capybara/capybara-201204041545476374284085.html
282
+ - test/dummy/tmp/capybara/capybara-201205040001414070882330.html
283
+ - test/dummy/tmp/capybara/capybara-201205040002105576336978.html
280
284
  - test/integration/paginated_table_integration_test.rb
281
285
  - test/test_helper.rb
282
286
  - test/units/config_test.rb