table_setter 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ begin
11
11
  gem.homepage = "http://propublica.github.com/table-setter/"
12
12
  gem.authors = ["Jeff Larson"]
13
13
  gem.rubyforge_project = "table-setter"
14
- gem.add_development_dependency "rspec", "~> 1.2.9"
14
+ gem.add_development_dependency "rspec"
15
15
  gem.add_dependency "rack", ">= 1.1.0"
16
16
  gem.add_dependency "thin", ">= 1.2.5"
17
17
  gem.add_dependency "table_fu", ">= 0.3.2"
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- :minor: 2
2
+ :patch: 5
3
3
  :build:
4
- :patch: 4
5
4
  :major: 0
5
+ :minor: 2
@@ -1,3 +1,6 @@
1
+ <%
2
+ require 'yaml'
3
+ %>
1
4
  <!DOCTYPE html>
2
5
  <html>
3
6
  <head>
@@ -226,8 +229,18 @@ script/generate table-setter</pre>
226
229
  </li>
227
230
  </ul>
228
231
  <h2><a id="credits" href="#toc">Credits</a></h2>
229
- <p><a href="http://github.com/thejefflarson">Jeff Larson</a> (Maintainer), <a href="http://github.com/brianboyer/">Brian Boyer</a>, <a href="http://github.com/kleinmatic">Scott Klein</a>, <a href="http://github.com/markpercival">Mark Percival</a>, <a href="http://github.com/seebq">Charles Brian Quinn</a>, <a href="http://github.com/bouvard">Christopher Groskopf</a>, and <a href="http://github.com/ryanmark">Ryan Mark</a>.</p>
232
+ <p><a href="http://github.com/thejefflarson">Jeff Larson</a> (Maintainer),
233
+ <a href="http://github.com/brianboyer/">Brian Boyer</a>,
234
+ <a href="http://github.com/kleinmatic">Scott Klein</a>,
235
+ <a href="http://github.com/markpercival">Mark Percival</a>,
236
+ <a href="http://github.com/seebq">Charles Brian Quinn</a>,
237
+ <a href="http://github.com/bouvard">Christopher Groskopf</a>,
238
+ <a href="http://github.com/ryanmark">Ryan Mark</a>,
239
+ <a href="http://github.com/palewire">Ben Welsh</a>, and
240
+ <a href="http://github.com/jpmckinney">James McKinney</a>.</p>
230
241
  <h2><a id="changes" href="#toc">Change Log</a></h2>
242
+ <strong>0.2.5</strong>
243
+ <p>Loads of bullet-proofing from <a href="http://github.com/jpmckinney">James McKinney</a> and js fixes from <a href="http://github.com/palewire">Ben Welsh</a>, you'll want to re-run <strong>table-setter install</strong> to grab the changes, as with previous releases.</p>
231
244
  <strong>0.2.4</strong>
232
245
  <p>Fixes encodings issues and the FasterCSV name change for ruby 1.9.</p>
233
246
  <strong>0.2.3</strong>
data/index.html CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  <!DOCTYPE html>
2
3
  <html>
3
4
  <head>
@@ -8,7 +9,7 @@
8
9
  </head>
9
10
  <body>
10
11
  <a href="http://www.propublica.org" class="propublica">&nbsp;</a>
11
- <h1>TableSetter <small>&ndash; Version: 0.2.4</small></h1>
12
+ <h1>TableSetter <small>&ndash; Version: 0.2.5</small></h1>
12
13
  <p><a href="https://github.com/propublica/table-setter">TableSetter</a> is a Ruby app that provides an easy way to present CSVs hosted locally or remotely (e.g. on google, etc) in custom HTML. TableSetter in the wild: <a href="http://projects.propublica.org/tables/failed-banks">a list of all stimulus projects from last year</a>, <a href="http://projects.propublica.org/tables/stimulus-spending-progress">the stimulus spending progress</a>, or <a href="http://projects.propublica.org/tables/failed-banks">a list of failed banks due to the last recession</a>.</p>
13
14
  <p>Each table is filterable and sortable on multiple columns. Also each column can be formatted in one of many different styles. In production mode, <strong>TableSetter</strong> provides valid expires headers and can be coupled with an upstream cache like <a href="http://rtomayko.github.com/rack-cache/">Rack::Cache</a> or varnish for speedy presentation.</p>
14
15
  <h2><a id="toc">Table of Contents</a></h2>
@@ -218,13 +219,23 @@ script/generate table-setter</pre>
218
219
  A table showing leniency rates of Chicago area judges in speeding cases.
219
220
  </li>
220
221
  <li>
221
- <a href="http://blog.apps.chicagotribune.com/2010/11/19/tostones-easy-tablesetter-testing-and-deployment/">In the Wild: Tostones, easy TableSetter testing and deployment</a><br>
222
+ <a href="https://github.com/newsapps/tostones">In the Wild: Tostones, easy TableSetter testing and deployment</a><br>
222
223
  A set of fabric deploy scripts for deploying TableSetter to s3.
223
224
  </li>
224
225
  </ul>
225
226
  <h2><a id="credits" href="#toc">Credits</a></h2>
226
- <p><a href="http://github.com/thejefflarson">Jeff Larson</a> (Maintainer), <a href="http://github.com/brianboyer/">Brian Boyer</a>, <a href="http://github.com/kleinmatic">Scott Klein</a>, <a href="http://github.com/markpercival">Mark Percival</a>, <a href="http://github.com/seebq">Charles Brian Quinn</a>, <a href="http://github.com/bouvard">Christopher Groskopf</a>, and <a href="http://github.com/ryanmark">Ryan Mark</a>.</p>
227
+ <p><a href="http://github.com/thejefflarson">Jeff Larson</a> (Maintainer),
228
+ <a href="http://github.com/brianboyer/">Brian Boyer</a>,
229
+ <a href="http://github.com/kleinmatic">Scott Klein</a>,
230
+ <a href="http://github.com/markpercival">Mark Percival</a>,
231
+ <a href="http://github.com/seebq">Charles Brian Quinn</a>,
232
+ <a href="http://github.com/bouvard">Christopher Groskopf</a>,
233
+ <a href="http://github.com/ryanmark">Ryan Mark</a>,
234
+ <a href="http://github.com/palewire">Ben Welsh</a>, and
235
+ <a href="http://github.com/jpmckinney">James McKinney</a>.</p>
227
236
  <h2><a id="changes" href="#toc">Change Log</a></h2>
237
+ <strong>0.2.5</strong>
238
+ <p>Loads of bullet-proofing from <a href="http://github.com/jpmckinney">James McKinney</a> and js fixes from <a href="http://github.com/palewire">Ben Welsh</a>, you'll want to re-run <strong>table-setter install</strong> to grab the changes, as with previous releases.</p>
228
239
  <strong>0.2.4</strong>
229
240
  <p>Fixes encodings issues and the FasterCSV name change for ruby 1.9.</p>
230
241
  <strong>0.2.3</strong>
@@ -99,8 +99,10 @@ module TableSetter
99
99
 
100
100
  # A convienence method to return the sort array for table setter.
101
101
  def sort_array
102
- @data.sorted_by.inject([]) do |memo, (key, value)|
103
- memo << [@data.columns.index(key), value == 'descending' ? 1 : 0]
102
+ if @data.sorted_by
103
+ @data.sorted_by.inject([]) do |memo, (key, value)|
104
+ memo << [@data.columns.index(key), value == 'descending' ? 1 : 0]
105
+ end
104
106
  end
105
107
  end
106
108
 
@@ -96,8 +96,8 @@ describe TableSetter::Table, "with hard pagination" do
96
96
  end
97
97
 
98
98
  it 'should not paginate when given a bad value' do
99
- lambda {@data.paginate!(-1)}.should raise_exception(ArgumentError)
100
- lambda {@data.paginate!(10000000)}.should raise_exception(ArgumentError)
99
+ lambda {@data.paginate!(-1)}.should raise_error(ArgumentError)
100
+ lambda {@data.paginate!(10000000)}.should raise_error(ArgumentError)
101
101
  end
102
102
 
103
103
  it 'should handle first page' do
data/table_setter.gemspec CHANGED
@@ -1,139 +1,137 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{table_setter}
8
- s.version = "0.2.4"
8
+ s.version = "0.2.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeff Larson"]
12
- s.date = %q{2010-11-19}
12
+ s.date = %q{2011-02-19}
13
13
  s.description = %q{A sinatra based app for rendering CSVs hosted on google docs or locally in custom HTML}
14
14
  s.email = %q{thejefflarson@gmail.com}
15
15
  s.executables = ["table-setter", "table-setter"]
16
16
  s.extra_rdoc_files = [
17
17
  "LICENSE",
18
- "README",
19
- "TODO"
18
+ "README",
19
+ "TODO"
20
20
  ]
21
21
  s.files = [
22
22
  ".document",
23
- ".gitignore",
24
- "LICENSE",
25
- "README",
26
- "Rakefile",
27
- "TODO",
28
- "VERSION.yml",
29
- "bin/table-setter",
30
- "doc/TableFu/Formatting.html",
31
- "doc/TableSetter.html",
32
- "doc/TableSetter/App.html",
33
- "doc/TableSetter/Command.html",
34
- "doc/TableSetter/Table.html",
35
- "doc/_index.html",
36
- "doc/class_list.html",
37
- "doc/css/common.css",
38
- "doc/css/full_list.css",
39
- "doc/css/style.css",
40
- "doc/file.README.html",
41
- "doc/file_list.html",
42
- "doc/frames.html",
43
- "doc/index.html",
44
- "doc/js/app.js",
45
- "doc/js/full_list.js",
46
- "doc/js/jquery.js",
47
- "doc/method_list.html",
48
- "doc/top-level-namespace.html",
49
- "documentation/css/dawn.css",
50
- "documentation/css/styles.css",
51
- "documentation/images/folder.png",
52
- "documentation/images/key.png",
53
- "documentation/images/proplogo.png",
54
- "documentation/images/publish.png",
55
- "documentation/images/text-x-generic.png",
56
- "documentation/index.html.erb",
57
- "documentation/tables/example/index.html",
58
- "documentation/tables/example_faceted/index.html",
59
- "documentation/tables/example_formatted/index.html",
60
- "documentation/tables/example_local/1/index.html",
61
- "documentation/tables/example_local/10/index.html",
62
- "documentation/tables/example_local/11/index.html",
63
- "documentation/tables/example_local/12/index.html",
64
- "documentation/tables/example_local/13/index.html",
65
- "documentation/tables/example_local/14/index.html",
66
- "documentation/tables/example_local/15/index.html",
67
- "documentation/tables/example_local/16/index.html",
68
- "documentation/tables/example_local/17/index.html",
69
- "documentation/tables/example_local/18/index.html",
70
- "documentation/tables/example_local/19/index.html",
71
- "documentation/tables/example_local/2/index.html",
72
- "documentation/tables/example_local/20/index.html",
73
- "documentation/tables/example_local/21/index.html",
74
- "documentation/tables/example_local/22/index.html",
75
- "documentation/tables/example_local/23/index.html",
76
- "documentation/tables/example_local/24/index.html",
77
- "documentation/tables/example_local/3/index.html",
78
- "documentation/tables/example_local/4/index.html",
79
- "documentation/tables/example_local/5/index.html",
80
- "documentation/tables/example_local/6/index.html",
81
- "documentation/tables/example_local/7/index.html",
82
- "documentation/tables/example_local/8/index.html",
83
- "documentation/tables/example_local/9/index.html",
84
- "documentation/tables/example_local/index.html",
85
- "documentation/tables/favicon.ico",
86
- "documentation/tables/images/th_arrow_asc.gif",
87
- "documentation/tables/images/th_arrow_desc.gif",
88
- "documentation/tables/index.html",
89
- "documentation/tables/javascripts/application.js",
90
- "documentation/tables/javascripts/jquery.tablesorter.js",
91
- "documentation/tables/javascripts/jquery.tablesorter.multipagefilter.js",
92
- "documentation/tables/javascripts/jquery.tablesorter.pager.js",
93
- "documentation/tables/stylesheets/stylesheet.css",
94
- "index.html",
95
- "lib/table_setter.rb",
96
- "lib/table_setter/app.rb",
97
- "lib/table_setter/command.rb",
98
- "lib/table_setter/table.rb",
99
- "spec/spec.opts",
100
- "spec/spec_helper.rb",
101
- "spec/table-setter-app_spec.rb",
102
- "spec/table-setter-command_spec.rb",
103
- "spec/table-setter_spec.rb",
104
- "table_setter.gemspec",
105
- "template/config.ru",
106
- "template/public/favicon.ico",
107
- "template/public/images/th_arrow_asc.gif",
108
- "template/public/images/th_arrow_desc.gif",
109
- "template/public/javascripts/application.js",
110
- "template/public/javascripts/jquery.tablesorter.js",
111
- "template/public/javascripts/jquery.tablesorter.multipagefilter.js",
112
- "template/public/javascripts/jquery.tablesorter.pager.js",
113
- "template/public/stylesheets/stylesheet.css",
114
- "template/tables/example.yml",
115
- "template/tables/example_faceted.yml",
116
- "template/tables/example_formatted.csv",
117
- "template/tables/example_formatted.yml",
118
- "template/tables/example_local.csv",
119
- "template/tables/example_local.yml",
120
- "template/views/404.erb",
121
- "template/views/500.erb",
122
- "template/views/index.erb",
123
- "template/views/layout.erb",
124
- "template/views/table.erb"
23
+ "LICENSE",
24
+ "README",
25
+ "Rakefile",
26
+ "TODO",
27
+ "VERSION.yml",
28
+ "bin/table-setter",
29
+ "doc/TableFu/Formatting.html",
30
+ "doc/TableSetter.html",
31
+ "doc/TableSetter/App.html",
32
+ "doc/TableSetter/Command.html",
33
+ "doc/TableSetter/Table.html",
34
+ "doc/_index.html",
35
+ "doc/class_list.html",
36
+ "doc/css/common.css",
37
+ "doc/css/full_list.css",
38
+ "doc/css/style.css",
39
+ "doc/file.README.html",
40
+ "doc/file_list.html",
41
+ "doc/frames.html",
42
+ "doc/index.html",
43
+ "doc/js/app.js",
44
+ "doc/js/full_list.js",
45
+ "doc/js/jquery.js",
46
+ "doc/method_list.html",
47
+ "doc/top-level-namespace.html",
48
+ "documentation/css/dawn.css",
49
+ "documentation/css/styles.css",
50
+ "documentation/images/folder.png",
51
+ "documentation/images/key.png",
52
+ "documentation/images/proplogo.png",
53
+ "documentation/images/publish.png",
54
+ "documentation/images/text-x-generic.png",
55
+ "documentation/index.html.erb",
56
+ "documentation/tables/example/index.html",
57
+ "documentation/tables/example_faceted/index.html",
58
+ "documentation/tables/example_formatted/index.html",
59
+ "documentation/tables/example_local/1/index.html",
60
+ "documentation/tables/example_local/10/index.html",
61
+ "documentation/tables/example_local/11/index.html",
62
+ "documentation/tables/example_local/12/index.html",
63
+ "documentation/tables/example_local/13/index.html",
64
+ "documentation/tables/example_local/14/index.html",
65
+ "documentation/tables/example_local/15/index.html",
66
+ "documentation/tables/example_local/16/index.html",
67
+ "documentation/tables/example_local/17/index.html",
68
+ "documentation/tables/example_local/18/index.html",
69
+ "documentation/tables/example_local/19/index.html",
70
+ "documentation/tables/example_local/2/index.html",
71
+ "documentation/tables/example_local/20/index.html",
72
+ "documentation/tables/example_local/21/index.html",
73
+ "documentation/tables/example_local/22/index.html",
74
+ "documentation/tables/example_local/23/index.html",
75
+ "documentation/tables/example_local/24/index.html",
76
+ "documentation/tables/example_local/3/index.html",
77
+ "documentation/tables/example_local/4/index.html",
78
+ "documentation/tables/example_local/5/index.html",
79
+ "documentation/tables/example_local/6/index.html",
80
+ "documentation/tables/example_local/7/index.html",
81
+ "documentation/tables/example_local/8/index.html",
82
+ "documentation/tables/example_local/9/index.html",
83
+ "documentation/tables/example_local/index.html",
84
+ "documentation/tables/favicon.ico",
85
+ "documentation/tables/images/th_arrow_asc.gif",
86
+ "documentation/tables/images/th_arrow_desc.gif",
87
+ "documentation/tables/index.html",
88
+ "documentation/tables/javascripts/application.js",
89
+ "documentation/tables/javascripts/jquery.tablesorter.js",
90
+ "documentation/tables/javascripts/jquery.tablesorter.multipagefilter.js",
91
+ "documentation/tables/javascripts/jquery.tablesorter.pager.js",
92
+ "documentation/tables/stylesheets/stylesheet.css",
93
+ "index.html",
94
+ "lib/table_setter.rb",
95
+ "lib/table_setter/app.rb",
96
+ "lib/table_setter/command.rb",
97
+ "lib/table_setter/table.rb",
98
+ "spec/spec.opts",
99
+ "spec/spec_helper.rb",
100
+ "spec/table-setter-app_spec.rb",
101
+ "spec/table-setter-command_spec.rb",
102
+ "spec/table-setter_spec.rb",
103
+ "table_setter.gemspec",
104
+ "template/config.ru",
105
+ "template/public/favicon.ico",
106
+ "template/public/images/th_arrow_asc.gif",
107
+ "template/public/images/th_arrow_desc.gif",
108
+ "template/public/javascripts/application.js",
109
+ "template/public/javascripts/jquery.tablesorter.js",
110
+ "template/public/javascripts/jquery.tablesorter.multipagefilter.js",
111
+ "template/public/javascripts/jquery.tablesorter.pager.js",
112
+ "template/public/stylesheets/stylesheet.css",
113
+ "template/tables/example.yml",
114
+ "template/tables/example_faceted.yml",
115
+ "template/tables/example_formatted.csv",
116
+ "template/tables/example_formatted.yml",
117
+ "template/tables/example_local.csv",
118
+ "template/tables/example_local.yml",
119
+ "template/views/404.erb",
120
+ "template/views/500.erb",
121
+ "template/views/index.erb",
122
+ "template/views/layout.erb",
123
+ "template/views/table.erb"
125
124
  ]
126
125
  s.homepage = %q{http://propublica.github.com/table-setter/}
127
- s.rdoc_options = ["--charset=UTF-8"]
128
126
  s.require_paths = ["lib"]
129
127
  s.rubyforge_project = %q{table-setter}
130
128
  s.rubygems_version = %q{1.3.7}
131
129
  s.summary = %q{A sinatra based app for rendering CSVs in custom HTML}
132
130
  s.test_files = [
133
131
  "spec/spec_helper.rb",
134
- "spec/table-setter-app_spec.rb",
135
- "spec/table-setter-command_spec.rb",
136
- "spec/table-setter_spec.rb"
132
+ "spec/table-setter-app_spec.rb",
133
+ "spec/table-setter-command_spec.rb",
134
+ "spec/table-setter_spec.rb"
137
135
  ]
138
136
 
139
137
  if s.respond_to? :specification_version then
@@ -141,7 +139,7 @@ Gem::Specification.new do |s|
141
139
  s.specification_version = 3
142
140
 
143
141
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
144
- s.add_development_dependency(%q<rspec>, ["~> 1.2.9"])
142
+ s.add_development_dependency(%q<rspec>, [">= 0"])
145
143
  s.add_runtime_dependency(%q<rack>, [">= 1.1.0"])
146
144
  s.add_runtime_dependency(%q<thin>, [">= 1.2.5"])
147
145
  s.add_runtime_dependency(%q<table_fu>, [">= 0.3.2"])
@@ -151,7 +149,7 @@ Gem::Specification.new do |s|
151
149
  s.add_runtime_dependency(%q<curb>, [">= 0.6.6.0"])
152
150
  s.add_runtime_dependency(%q<rdiscount>, [">= 1.6.3.1"])
153
151
  else
154
- s.add_dependency(%q<rspec>, ["~> 1.2.9"])
152
+ s.add_dependency(%q<rspec>, [">= 0"])
155
153
  s.add_dependency(%q<rack>, [">= 1.1.0"])
156
154
  s.add_dependency(%q<thin>, [">= 1.2.5"])
157
155
  s.add_dependency(%q<table_fu>, [">= 0.3.2"])
@@ -162,7 +160,7 @@ Gem::Specification.new do |s|
162
160
  s.add_dependency(%q<rdiscount>, [">= 1.6.3.1"])
163
161
  end
164
162
  else
165
- s.add_dependency(%q<rspec>, ["~> 1.2.9"])
163
+ s.add_dependency(%q<rspec>, [">= 0"])
166
164
  s.add_dependency(%q<rack>, [">= 1.1.0"])
167
165
  s.add_dependency(%q<thin>, [">= 1.2.5"])
168
166
  s.add_dependency(%q<table_fu>, [">= 0.3.2"])
@@ -48,8 +48,9 @@ $(document).ready(function(){
48
48
  widgets: ['columnHighlight'],
49
49
  sortList: sortOrder//,
50
50
  //debug: true
51
- })
52
- .tablesorterPager({container: $("#pager"), positionFixed: false, size: perPage})
53
- .tablesorterMultiPageFilter({filterSelector: $("#filter input")});
51
+ }).tablesorterMultiPageFilter({filterSelector: $("#filter input")});
52
+ if (perPage > 0) {
53
+ table.tablesorterPager({container: $("#pager"), positionFixed: false, size: perPage});
54
+ }
54
55
 
55
56
  });
@@ -6,19 +6,27 @@
6
6
  // clear the table body
7
7
  $.tablesorter.clearTableBody(table);
8
8
  var tableBody = $(table.tBodies[0]);
9
-
10
- for(var i = 0; i < table.config.collection.length; i++) {
9
+ var collection_length = table.config.collection.length
10
+ if (table.config.reset) {
11
+ collection_length = table.config.size
12
+ }
13
+ for(var i = 0; i < collection_length; i++) {
11
14
  var o = table.config.collection[i];
12
15
  var l = o.length;
13
16
  for(var j=0; j < l; j++) {
14
17
  tableBody[0].appendChild(o[j]);
15
18
  }
16
19
  }
20
+ if (table.config.reset && table.config.page > 0) {
21
+ var c = table.config;
22
+ $(c.cssPageDisplay).text(1 + c.seperator + c.totalPages)
23
+ table.config.page = 0;
24
+ }
17
25
  $(table).trigger("applyWidgets");
18
26
  }
19
-
20
-
27
+
21
28
  function renderTable(table){
29
+ table.config.reset = false;
22
30
  var newString = table.config.filterSelector[0].value;
23
31
  if(newString.length > 1){
24
32
  if(table.config.container){
@@ -27,12 +35,15 @@
27
35
 
28
36
  var toShow = [];
29
37
  newString = $.trim(newString);
30
- var words = newString.toLowerCase().split(" ");
31
-
38
+ var words = newString.toLowerCase().split(" ");
32
39
  // no change, don't do anything
33
- if (newString === table.config.string) return false;
40
+ if (newString === table.config.string) {
41
+ return false;
42
+ }
34
43
  // press was just a string
35
- if (newString[-1] === " ") { table.config.string = newString; return false; }
44
+ if (newString[-1] === " ") {
45
+ table.config.string = newString; return false;
46
+ }
36
47
  // most of the string is old
37
48
  if (newString.indexOf(table.config.string) > -1){
38
49
  // don't change the search array but we only need the last word
@@ -56,16 +67,22 @@
56
67
  };
57
68
  table.config.collection = toShow.slice(0);
58
69
  replaceRows(table);
59
- table.config.string = newString;
70
+ table.config.string = newString;
60
71
  } else {
61
- table.config.string = "";
72
+ table.config.string = "";
62
73
  table.config.collection = table.config.rowsCopy.slice(0);
63
74
  if(table.config.container){
75
+ // Revert to default table
64
76
  table.config.container.show();
77
+ if (newString.length === 0 && table.config.oldString.length > 0) {
78
+ table.config.reset = true;
79
+ replaceRows(table);
80
+ }
65
81
  } else {
66
82
  replaceRows(table);
67
83
  }
68
84
  }
85
+ table.config.oldString = newString;
69
86
  }
70
87
 
71
88
  this.defaults = {
@@ -90,9 +107,9 @@
90
107
  $(this).trigger("appendCache");
91
108
  }
92
109
  table.config.string = "";
110
+ table.config.oldString = "";
93
111
  table.config.collection = [];
94
112
  table.config.collection = table.config.rowsCopy.slice(0)
95
-
96
113
  function filterMe(){
97
114
  renderTable(table);
98
115
  return false;
@@ -103,9 +120,7 @@
103
120
  }
104
121
  }
105
122
  });
106
-
107
-
108
123
  $.fn.extend({
109
124
  tablesorterMultiPageFilter: $.tablesorterMultiPageFilter.init
110
125
  });
111
- }(jQuery))
126
+ }(jQuery))
@@ -7,74 +7,75 @@
7
7
  <% if !table.hard_paginate? %>
8
8
  <div id="filter">Filter: <input type="text"></div>
9
9
  <% end %>
10
- <div id="pager" class="pager">
11
- <form>
12
- <a href="<%= url_for "/#{table.slug}/#{table.prev_page}/" if !table.prev_page.nil? %>" class="prev">prev</a>
13
- <span class="pagedisplay"/><%= "#{table.page} / #{table.total_pages}" if table.hard_paginate? %></span>
14
- <a href="<%= url_for "/#{table.slug}/#{table.next_page}/" if !table.next_page.nil? %>" class="next">next</a>
15
- <% if !table.hard_paginate? %>
16
- <select class="pagesize">
17
- <% (1..4).each do |count|%>
18
- <option value="<%= table.per_page * count%>">
19
- <%= table.per_page * count%></option>
20
- <% end %>
21
- </select>
22
- <% end %>
23
- </form>
24
- </div>
10
+ <% if table.per_page > 0 %>
11
+ <div id="pager" class="pager">
12
+ <form>
13
+ <a href="<%= url_for "/#{table.slug}/#{table.prev_page}/" if !table.prev_page.nil? %>" class="prev">prev</a>
14
+ <span class="pagedisplay"/><%= "#{table.page} / #{table.total_pages}" if table.hard_paginate? %></span>
15
+ <a href="<%= url_for "/#{table.slug}/#{table.next_page}/" if !table.next_page.nil? %>" class="next">next</a>
16
+ <% if !table.hard_paginate? %>
17
+ <select class="pagesize">
18
+ <% (1..4).each do |count|%>
19
+ <option value="<%= table.per_page * count%>">
20
+ <%= table.per_page * count%></option>
21
+ <% end %>
22
+ </select>
23
+ <% end %>
24
+ </form>
25
+ </div>
26
+ <% end %>
25
27
  <% end %>
26
28
  </div>
27
- <table id="data" class="tabular">
28
- <thead>
29
- <tr>
30
- <% if table.faceted? %>
31
- <th></th>
32
- <% end %>
33
- <% table.data.headers.each do |header| %>
34
- <% unless header.ignored? %>
35
- <th<%= " style=\"#{header.style}\"" %>><%= header %></th>
36
- <% end %>
29
+ <table id="data" class="tabular">
30
+ <thead>
31
+ <tr>
32
+ <% if table.faceted? %>
33
+ <th></th>
34
+ <% end %>
35
+ <% table.data.headers.each do |header| %>
36
+ <% unless header.ignored? %>
37
+ <th<%= " style=\"#{header.style}\"" %>><%= header %></th>
37
38
  <% end %>
38
- </tr>
39
- </thead>
40
- <tbody>
41
- <% if table.faceted? %>
42
- <% table.facets.each do |facet| %>
43
- <tr>
44
- <th style="text-align:left;"><%= facet.faceted_on %></th>
45
- <% facet.headers.each_with_index do |header, i| %>
46
- <% unless i == 0 %>
47
- <th style="<%= header.style %>">
48
- <%= facet.total_for(header.to_s).to_s if header.total? %>
49
- </th>
50
- <% end %>
39
+ <% end %>
40
+ </tr>
41
+ </thead>
42
+ <tfoot>
43
+ </tfoot>
44
+ <tbody>
45
+ <% if table.faceted? %>
46
+ <% table.facets.each do |facet| %>
47
+ <tr>
48
+ <th style="text-align:left;"><%= facet.faceted_on %></th>
49
+ <% facet.headers.each_with_index do |header, i| %>
50
+ <% unless i == 0 %>
51
+ <th style="<%= header.style %>">
52
+ <%= facet.total_for(header.to_s).to_s if header.total? %>
53
+ </th>
51
54
  <% end %>
52
- </tr>
53
- <% facet.rows.each do |row| %>
54
- <tr>
55
- <td></td>
56
- <% row.columns.each do |column| %>
57
- <% unless column.ignored? %>
58
- <td <%= "style=\"#{column.style}\"" %>><%= column %></td>
59
- <% end %>
60
- <% end %>
61
- </tr>
62
55
  <% end %>
63
- <% end %>
64
- <% else %>
65
- <% table.data.rows.each do |row| %>
56
+ </tr>
57
+ <% facet.rows.each do |row| %>
66
58
  <tr>
59
+ <td></td>
67
60
  <% row.columns.each do |column| %>
68
61
  <% unless column.ignored? %>
69
- <td<%= " style=\"#{column.style}\"" %>><%= column %></td>
62
+ <td <%= "style=\"#{column.style}\"" %>><%= column %></td>
70
63
  <% end %>
71
64
  <% end %>
72
65
  </tr>
73
66
  <% end %>
74
67
  <% end %>
75
- </tbody>
76
- <tfoot>
77
- </tfoot>
78
- </table>
79
- <div><%= table.footer %></div>
80
- </div>
68
+ <% else %>
69
+ <% table.data.rows.each do |row| %>
70
+ <tr>
71
+ <% row.columns.each do |column| %>
72
+ <% unless column.ignored? %>
73
+ <td<%= " style=\"#{column.style}\"" %>><%= column %></td>
74
+ <% end %>
75
+ <% end %>
76
+ </tr>
77
+ <% end %>
78
+ <% end %>
79
+ </tbody>
80
+ </table>
81
+ <div><%= table.footer %></div>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_setter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 4
10
- version: 0.2.4
9
+ - 5
10
+ version: 0.2.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jeff Larson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-19 00:00:00 -05:00
18
+ date: 2011-02-19 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -24,14 +24,12 @@ dependencies:
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ~>
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
- hash: 13
29
+ hash: 3
30
30
  segments:
31
- - 1
32
- - 2
33
- - 9
34
- version: 1.2.9
31
+ - 0
32
+ version: "0"
35
33
  type: :development
36
34
  version_requirements: *id001
37
35
  - !ruby/object:Gem::Dependency
@@ -177,7 +175,6 @@ extra_rdoc_files:
177
175
  - TODO
178
176
  files:
179
177
  - .document
180
- - .gitignore
181
178
  - LICENSE
182
179
  - README
183
180
  - Rakefile
@@ -284,8 +281,8 @@ homepage: http://propublica.github.com/table-setter/
284
281
  licenses: []
285
282
 
286
283
  post_install_message:
287
- rdoc_options:
288
- - --charset=UTF-8
284
+ rdoc_options: []
285
+
289
286
  require_paths:
290
287
  - lib
291
288
  required_ruby_version: !ruby/object:Gem::Requirement
data/.gitignore DELETED
@@ -1,20 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
-
9
- ## VIM
10
- *.swp
11
-
12
- ## PROJECT::GENERAL
13
- coverage
14
- rdoc
15
- pkg
16
- tester
17
- template/out/
18
-
19
- ## PROJECT::SPECIFIC
20
- log