table_setter_generator 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +21 -0
  5. data/Rakefile +63 -0
  6. data/USAGE +2 -0
  7. data/VERSION.yml +5 -0
  8. data/documentation/css/styles.css +62 -0
  9. data/documentation/images/proplogo.png +0 -0
  10. data/documentation/index.html.erb +29 -0
  11. data/index.html +46 -0
  12. data/lib/table_setter_generator.rb +3 -0
  13. data/table_setter_generator.gemspec +79 -0
  14. data/table_setter_generator.rb +105 -0
  15. data/templates/table.rb +2 -0
  16. data/templates/table_controller.rb +28 -0
  17. data/templates/ts/config.ru +33 -0
  18. data/templates/ts/public/favicon.ico +0 -0
  19. data/templates/ts/public/images/th_arrow_asc.gif +0 -0
  20. data/templates/ts/public/images/th_arrow_desc.gif +0 -0
  21. data/templates/ts/public/javascripts/application.js +32 -0
  22. data/templates/ts/public/javascripts/jquery.tablesorter.js +852 -0
  23. data/templates/ts/public/javascripts/jquery.tablesorter.multipagefilter.js +111 -0
  24. data/templates/ts/public/javascripts/jquery.tablesorter.pager.js +183 -0
  25. data/templates/ts/public/stylesheets/stylesheet.css +74 -0
  26. data/templates/ts/tables/example.yml +21 -0
  27. data/templates/ts/tables/example_faceted.yml +27 -0
  28. data/templates/ts/tables/example_formatted.csv +1 -0
  29. data/templates/ts/tables/example_formatted.yml +27 -0
  30. data/templates/ts/tables/example_local.csv +5806 -0
  31. data/templates/ts/tables/example_local.yml +27 -0
  32. data/templates/ts/views/404.erb +4 -0
  33. data/templates/ts/views/500.erb +4 -0
  34. data/templates/ts/views/index.erb +8 -0
  35. data/templates/ts/views/layout.erb +35 -0
  36. data/templates/ts/views/table.erb +79 -0
  37. metadata +110 -0
@@ -0,0 +1,27 @@
1
+ table:
2
+ title: Browse All Approved Stimulus Highway Projects
3
+ file: example_local.csv
4
+ deck:
5
+ <p>Road and bridge projects are expected to make up one of the biggest chunks of the jobs created in the stimulus package. Below, you’ll find a chart of more than 5,800 projects that have been approved by the U.S. Department of Transportation. Once given the green light, states can put the projects out to bid, contract them and begin construction work. So far, about 2,300 projects are under way.</p>
6
+ <p>Help us find out how much progress has been made on these projects by participating in our <a href="http://projects.propublica.org/spotcheck/">Stimulus Spot Check</a>.</p>
7
+
8
+ <p>For more on the stimulus, check out our <a href="http://www.propublica.org/ion/stimulus">blog and resource page</a>.</p>
9
+ footer:
10
+ <p>Source:&nbsp;<a href="http://www.fdic.gov/bank/individual/failed/banklist.html">FDIC</a></p>
11
+ column_options:
12
+ columns:
13
+ - State
14
+ - Urban Area
15
+ - Project Description
16
+ - Improvement Type
17
+ - ARRA Funds Obligated
18
+ style:
19
+ State: 'text-align:left;'
20
+ Project Description: 'text-align:right;'
21
+ sorted_by:
22
+ State: ascending
23
+ formatting:
24
+ ARRA Funds Obligated: currency
25
+ hard_paginate: true
26
+ per_page: 250
27
+ live: true
@@ -0,0 +1,4 @@
1
+ <h2>404 Not Found</h2>
2
+
3
+ <p>The table you asked for could not be found</p>
4
+ <p>Go <a href="<%= url_for "/" %>">back</a>.</p>
@@ -0,0 +1,4 @@
1
+ <h2>500 - Error</h2>
2
+
3
+ <p>The table you asked for could not be found.</p>
4
+ <p>Go <a href="<%= url_for "/" %>">back</a>.</p>
@@ -0,0 +1,8 @@
1
+ <% tables = @tables %>
2
+ <ul>
3
+ <% for table in tables %>
4
+ <li>
5
+ <a href="<%= url_for "/#{table.slug}/" %>"><%= table.title %></a>
6
+ </li>
7
+ <% end %>
8
+ </ul>
@@ -0,0 +1,35 @@
1
+ <% table = @table unless @table.nil? %>
2
+ <% table ||= nil %>
3
+ <!DOCTYPE html>
4
+ <html>
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7
+ <title><%= @table.nil? ? "All Tables" : @table.title %></title>
8
+ <script type="text/javascript"
9
+ src="http://www.google.com/jsapi"></script>
10
+ <script type="text/javascript">
11
+ google.load("jquery", "1", {uncompressed:true})
12
+ </script>
13
+ <%= javascript_script_tag "/javascripts/jquery.tablesorter.js" %>
14
+ <%= javascript_script_tag "/javascripts/jquery.tablesorter.pager.js" %>
15
+ <%= javascript_script_tag "/javascripts/jquery.tablesorter.multipagefilter.js" %>
16
+ <%= javascript_script_tag "/javascripts/application.js" %>
17
+ <%= stylesheet_link_tag "/stylesheets/stylesheet.css", :media=>"screen" %>
18
+
19
+ <script>
20
+ <% if !table.nil? %>
21
+ var sortPlease = <%= @table.sortable? %>;
22
+ var sortOrder = <%= @table.sort_array.inspect || "null"%>;
23
+ var perPage = <%= @table.per_page %>;
24
+ <% else %>
25
+ var sortPlease = false;
26
+ <% end %>
27
+ </script>
28
+
29
+ </head>
30
+ <body>
31
+ <div id="table_fu">
32
+ <%= yield %>
33
+ </div>
34
+ </body>
35
+ </html>
@@ -0,0 +1,79 @@
1
+ <% table = @table unless @table.nil? %>
2
+ <div id="table_title"><%= table.title %></div>
3
+ <div id="deck"><%= table.deck %></div>
4
+ <div id="controls">
5
+ <% if !table.faceted? %>
6
+ <% if !table.hard_paginate? %>
7
+ <div id="filter">Filter: <input type="text"></div>
8
+ <% end %>
9
+ <div id="pager" class="pager">
10
+ <form>
11
+ <a href="<%= url_for "/#{table.slug}/#{table.prev_page}/" if !table.prev_page.nil? %>" class="prev">prev</a>
12
+ <span class="pagedisplay"/><%= "#{table.page} / #{table.total_pages}" if table.hard_paginate? %></span>
13
+ <a href="<%= url_for "/#{table.slug}/#{table.next_page}/" if !table.next_page.nil? %>" class="next">next</a>
14
+ <% if !table.hard_paginate? %>
15
+ <select class="pagesize">
16
+ <% (1..4).each do |count|%>
17
+ <option value="<%= table.per_page * count%>">
18
+ <%= table.per_page * count%></option>
19
+ <% end %>
20
+ </select>
21
+ <% end %>
22
+ </form>
23
+ </div>
24
+ <% end %>
25
+ </div>
26
+ <table id="data" class="tabular">
27
+ <thead>
28
+ <tr>
29
+ <% if table.faceted? %>
30
+ <th></th>
31
+ <% end %>
32
+ <% table.data.headers.each do |header| %>
33
+ <% unless header.ignored? %>
34
+ <th<%= " style=\"#{header.style}\"" %>><%= header %></th>
35
+ <% end %>
36
+ <% end %>
37
+ </tr>
38
+ </thead>
39
+ <tbody>
40
+ <% if table.faceted? %>
41
+ <% table.facets.each do |facet| %>
42
+ <tr>
43
+ <th style="text-align:left;"><%= facet.faceted_on %></th>
44
+ <% facet.headers.each_with_index do |header, i| %>
45
+ <% unless i == 0 %>
46
+ <th style="<%= header.style %>">
47
+ <%= facet.total_for(header.to_s).to_s if header.total? %>
48
+ </th>
49
+ <% end %>
50
+ <% end %>
51
+ </tr>
52
+ <% facet.rows.each do |row| %>
53
+ <tr>
54
+ <td></td>
55
+ <% row.columns.each do |column| %>
56
+ <% unless column.ignored? %>
57
+ <td <%= "style=\"#{column.style}\"" %>><%= column %></td>
58
+ <% end %>
59
+ <% end %>
60
+ </tr>
61
+ <% end %>
62
+ <% end %>
63
+ <% else %>
64
+ <% table.data.rows.each do |row| %>
65
+ <tr>
66
+ <% row.columns.each do |column| %>
67
+ <% unless column.ignored? %>
68
+ <td<%= " style=\"#{column.style}\"" %>><%= column %></td>
69
+ <% end %>
70
+ <% end %>
71
+ </tr>
72
+ <% end %>
73
+ <% end %>
74
+ </tbody>
75
+ <tfoot>
76
+ </tfoot>
77
+ </table>
78
+ <div><%= table.footer %></div>
79
+ </div>
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: table_setter_generator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jeff Larson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-03-10 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: table_setter
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.1.2
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rails
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 2.3.5
34
+ version:
35
+ description: Generate a hackable version of TableSetter
36
+ email: jeff.larson@propublica.org
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - LICENSE
43
+ - README.rdoc
44
+ files:
45
+ - .document
46
+ - .gitignore
47
+ - LICENSE
48
+ - README.rdoc
49
+ - Rakefile
50
+ - USAGE
51
+ - VERSION.yml
52
+ - documentation/css/styles.css
53
+ - documentation/images/proplogo.png
54
+ - documentation/index.html.erb
55
+ - index.html
56
+ - lib/table_setter_generator.rb
57
+ - table_setter_generator.gemspec
58
+ - table_setter_generator.rb
59
+ - templates/table.rb
60
+ - templates/table_controller.rb
61
+ - templates/ts/config.ru
62
+ - templates/ts/public/favicon.ico
63
+ - templates/ts/public/images/th_arrow_asc.gif
64
+ - templates/ts/public/images/th_arrow_desc.gif
65
+ - templates/ts/public/javascripts/application.js
66
+ - templates/ts/public/javascripts/jquery.tablesorter.js
67
+ - templates/ts/public/javascripts/jquery.tablesorter.multipagefilter.js
68
+ - templates/ts/public/javascripts/jquery.tablesorter.pager.js
69
+ - templates/ts/public/stylesheets/stylesheet.css
70
+ - templates/ts/tables/example.yml
71
+ - templates/ts/tables/example_faceted.yml
72
+ - templates/ts/tables/example_formatted.csv
73
+ - templates/ts/tables/example_formatted.yml
74
+ - templates/ts/tables/example_local.csv
75
+ - templates/ts/tables/example_local.yml
76
+ - templates/ts/views/404.erb
77
+ - templates/ts/views/500.erb
78
+ - templates/ts/views/index.erb
79
+ - templates/ts/views/layout.erb
80
+ - templates/ts/views/table.erb
81
+ has_rdoc: true
82
+ homepage: http://github.com/propublica/table-setter-generator
83
+ licenses: []
84
+
85
+ post_install_message:
86
+ rdoc_options:
87
+ - --charset=UTF-8
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: "0"
95
+ version:
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: "0"
101
+ version:
102
+ requirements: []
103
+
104
+ rubyforge_project:
105
+ rubygems_version: 1.3.5
106
+ signing_key:
107
+ specification_version: 3
108
+ summary: A Rails Generator for TableSetter
109
+ test_files: []
110
+