Commit 73a73f879efe51a3ddfec407e6e3de4bdd039719
Exists in
master
and in
1 other branch
Merge pull request #220 from martinciu/head-and-tail
Head and tail
Showing
6 changed files
with
100 additions
and
62 deletions
Show diff stats
Gemfile
| @@ -32,9 +32,9 @@ gem 'fabrication', "~> 1.3.0" # Both for tests, and loading demo data | @@ -32,9 +32,9 @@ gem 'fabrication', "~> 1.3.0" # Both for tests, and loading demo data | ||
| 32 | gem 'rails_autolink', '~> 1.0.9' | 32 | gem 'rails_autolink', '~> 1.0.9' |
| 33 | 33 | ||
| 34 | platform :ruby do | 34 | platform :ruby do |
| 35 | - gem 'mongo', '= 1.3.1' | ||
| 36 | - gem 'bson', '= 1.3.1' | ||
| 37 | - gem 'bson_ext', '= 1.3.1' | 35 | + gem 'mongo', '= 1.6.2' |
| 36 | + gem 'bson', '= 1.6.2' | ||
| 37 | + gem 'bson_ext', '= 1.6.2' | ||
| 38 | end | 38 | end |
| 39 | 39 | ||
| 40 | gem 'ri_cal' | 40 | gem 'ri_cal' |
| @@ -47,7 +47,8 @@ group :development, :test do | @@ -47,7 +47,8 @@ group :development, :test do | ||
| 47 | gem 'ruby-debug', :platform => :mri_18 | 47 | gem 'ruby-debug', :platform => :mri_18 |
| 48 | gem 'debugger', :platform => :mri_19 | 48 | gem 'debugger', :platform => :mri_19 |
| 49 | end | 49 | end |
| 50 | - # gem 'rpm_contrib', :git => "git://github.com/bensymonds/rpm_contrib.git", :branch => "mongo-1.4.0_update" | 50 | +# gem 'rpm_contrib' |
| 51 | +# gem 'newrelic_rpm' | ||
| 51 | end | 52 | end |
| 52 | 53 | ||
| 53 | group :test do | 54 | group :test do |
Gemfile.lock
| @@ -33,11 +33,12 @@ GEM | @@ -33,11 +33,12 @@ GEM | ||
| 33 | activesupport (3.2.6) | 33 | activesupport (3.2.6) |
| 34 | i18n (~> 0.6) | 34 | i18n (~> 0.6) |
| 35 | multi_json (~> 1.0) | 35 | multi_json (~> 1.0) |
| 36 | - addressable (2.2.8) | 36 | + addressable (2.3.2) |
| 37 | arel (3.0.2) | 37 | arel (3.0.2) |
| 38 | bcrypt-ruby (3.0.1) | 38 | bcrypt-ruby (3.0.1) |
| 39 | - bson (1.3.1) | ||
| 40 | - bson_ext (1.3.1) | 39 | + bson (1.6.2) |
| 40 | + bson_ext (1.6.2) | ||
| 41 | + bson (~> 1.6.2) | ||
| 41 | builder (3.0.0) | 42 | builder (3.0.0) |
| 42 | capybara (1.1.2) | 43 | capybara (1.1.2) |
| 43 | mime-types (>= 1.16) | 44 | mime-types (>= 1.16) |
| @@ -46,8 +47,8 @@ GEM | @@ -46,8 +47,8 @@ GEM | ||
| 46 | rack-test (>= 0.5.4) | 47 | rack-test (>= 0.5.4) |
| 47 | selenium-webdriver (~> 2.0) | 48 | selenium-webdriver (~> 2.0) |
| 48 | xpath (~> 0.1.4) | 49 | xpath (~> 0.1.4) |
| 49 | - childprocess (0.3.2) | ||
| 50 | - ffi (~> 1.0.6) | 50 | + childprocess (0.3.5) |
| 51 | + ffi (~> 1.0, >= 1.0.6) | ||
| 51 | columnize (0.3.6) | 52 | columnize (0.3.6) |
| 52 | crack (0.3.1) | 53 | crack (0.3.1) |
| 53 | css_parser (1.2.6) | 54 | css_parser (1.2.6) |
| @@ -55,13 +56,13 @@ GEM | @@ -55,13 +56,13 @@ GEM | ||
| 55 | rdoc | 56 | rdoc |
| 56 | daemons (1.1.8) | 57 | daemons (1.1.8) |
| 57 | database_cleaner (0.6.7) | 58 | database_cleaner (0.6.7) |
| 58 | - debugger (1.1.3) | 59 | + debugger (1.2.0) |
| 59 | columnize (>= 0.3.1) | 60 | columnize (>= 0.3.1) |
| 60 | debugger-linecache (~> 1.1.1) | 61 | debugger-linecache (~> 1.1.1) |
| 61 | - debugger-ruby_core_source (~> 1.1.2) | ||
| 62 | - debugger-linecache (1.1.1) | 62 | + debugger-ruby_core_source (~> 1.1.3) |
| 63 | + debugger-linecache (1.1.2) | ||
| 63 | debugger-ruby_core_source (>= 1.1.1) | 64 | debugger-ruby_core_source (>= 1.1.1) |
| 64 | - debugger-ruby_core_source (1.1.2) | 65 | + debugger-ruby_core_source (1.1.3) |
| 65 | devise (1.5.3) | 66 | devise (1.5.3) |
| 66 | bcrypt-ruby (~> 3.0) | 67 | bcrypt-ruby (~> 3.0) |
| 67 | orm_adapter (~> 0.0.3) | 68 | orm_adapter (~> 0.0.3) |
| @@ -77,10 +78,10 @@ GEM | @@ -77,10 +78,10 @@ GEM | ||
| 77 | fabrication (1.3.2) | 78 | fabrication (1.3.2) |
| 78 | faraday (0.8.1) | 79 | faraday (0.8.1) |
| 79 | multipart-post (~> 1.1) | 80 | multipart-post (~> 1.1) |
| 80 | - faraday_middleware (0.8.7) | 81 | + faraday_middleware (0.8.8) |
| 81 | faraday (>= 0.7.4, < 0.9) | 82 | faraday (>= 0.7.4, < 0.9) |
| 82 | - ffi (1.0.11) | ||
| 83 | - haml (3.1.5) | 83 | + ffi (1.1.4) |
| 84 | + haml (3.1.6) | ||
| 84 | happymapper (0.4.0) | 85 | happymapper (0.4.0) |
| 85 | libxml-ruby (~> 2.0) | 86 | libxml-ruby (~> 2.0) |
| 86 | has_scope (0.5.1) | 87 | has_scope (0.5.1) |
| @@ -90,23 +91,26 @@ GEM | @@ -90,23 +91,26 @@ GEM | ||
| 90 | activesupport | 91 | activesupport |
| 91 | builder | 92 | builder |
| 92 | htmlentities (4.3.1) | 93 | htmlentities (4.3.1) |
| 94 | + httpauth (0.1) | ||
| 93 | i18n (0.6.0) | 95 | i18n (0.6.0) |
| 94 | inherited_resources (1.3.1) | 96 | inherited_resources (1.3.1) |
| 95 | has_scope (~> 0.5.0) | 97 | has_scope (~> 0.5.0) |
| 96 | responders (~> 0.6) | 98 | responders (~> 0.6) |
| 97 | journey (1.0.4) | 99 | journey (1.0.4) |
| 98 | - json (1.7.3) | 100 | + json (1.7.4) |
| 101 | + jwt (0.1.5) | ||
| 102 | + multi_json (>= 1.0) | ||
| 99 | kaminari (0.13.0) | 103 | kaminari (0.13.0) |
| 100 | actionpack (>= 3.0.0) | 104 | actionpack (>= 3.0.0) |
| 101 | activesupport (>= 3.0.0) | 105 | activesupport (>= 3.0.0) |
| 102 | railties (>= 3.0.0) | 106 | railties (>= 3.0.0) |
| 103 | kgio (2.7.4) | 107 | kgio (2.7.4) |
| 104 | - launchy (2.1.0) | ||
| 105 | - addressable (~> 2.2.6) | 108 | + launchy (2.1.2) |
| 109 | + addressable (~> 2.3) | ||
| 106 | libv8 (3.3.10.4) | 110 | libv8 (3.3.10.4) |
| 107 | - libwebsocket (0.1.3) | 111 | + libwebsocket (0.1.5) |
| 108 | addressable | 112 | addressable |
| 109 | - libxml-ruby (2.3.2) | 113 | + libxml-ruby (2.3.3) |
| 110 | lighthouse-api (2.0) | 114 | lighthouse-api (2.0) |
| 111 | activeresource (>= 3.0.0) | 115 | activeresource (>= 3.0.0) |
| 112 | activesupport (>= 3.0.0) | 116 | activesupport (>= 3.0.0) |
| @@ -116,9 +120,9 @@ GEM | @@ -116,9 +120,9 @@ GEM | ||
| 116 | i18n (>= 0.4.0) | 120 | i18n (>= 0.4.0) |
| 117 | mime-types (~> 1.16) | 121 | mime-types (~> 1.16) |
| 118 | treetop (~> 1.4.8) | 122 | treetop (~> 1.4.8) |
| 119 | - mime-types (1.18) | ||
| 120 | - mongo (1.3.1) | ||
| 121 | - bson (>= 1.3.1) | 123 | + mime-types (1.19) |
| 124 | + mongo (1.6.2) | ||
| 125 | + bson (~> 1.6.2) | ||
| 122 | mongoid (2.4.10) | 126 | mongoid (2.4.10) |
| 123 | activemodel (~> 3.1) | 127 | activemodel (~> 3.1) |
| 124 | mongo (~> 1.3) | 128 | mongo (~> 1.3) |
| @@ -130,25 +134,28 @@ GEM | @@ -130,25 +134,28 @@ GEM | ||
| 130 | railties (>= 3.0.0) | 134 | railties (>= 3.0.0) |
| 131 | multi_json (1.3.6) | 135 | multi_json (1.3.6) |
| 132 | multipart-post (1.1.5) | 136 | multipart-post (1.1.5) |
| 133 | - nokogiri (1.5.0) | 137 | + nokogiri (1.5.5) |
| 134 | oa-core (0.3.2) | 138 | oa-core (0.3.2) |
| 135 | - oauth2 (0.5.2) | ||
| 136 | - faraday (~> 0.7) | 139 | + oauth2 (0.8.0) |
| 140 | + faraday (~> 0.8) | ||
| 141 | + httpauth (~> 0.1) | ||
| 142 | + jwt (~> 0.1.4) | ||
| 137 | multi_json (~> 1.0) | 143 | multi_json (~> 1.0) |
| 144 | + rack (~> 1.2) | ||
| 138 | octokit (1.0.7) | 145 | octokit (1.0.7) |
| 139 | addressable (~> 2.2) | 146 | addressable (~> 2.2) |
| 140 | faraday (~> 0.8) | 147 | faraday (~> 0.8) |
| 141 | faraday_middleware (~> 0.8) | 148 | faraday_middleware (~> 0.8) |
| 142 | hashie (~> 1.2) | 149 | hashie (~> 1.2) |
| 143 | multi_json (~> 1.3) | 150 | multi_json (~> 1.3) |
| 144 | - omniauth (1.0.3) | 151 | + omniauth (1.1.0) |
| 145 | hashie (~> 1.2) | 152 | hashie (~> 1.2) |
| 146 | rack | 153 | rack |
| 147 | - omniauth-github (1.0.1) | 154 | + omniauth-github (1.0.2) |
| 148 | omniauth (~> 1.0) | 155 | omniauth (~> 1.0) |
| 149 | - omniauth-oauth2 (~> 1.0) | ||
| 150 | - omniauth-oauth2 (1.0.0) | ||
| 151 | - oauth2 (~> 0.5.0) | 156 | + omniauth-oauth2 (~> 1.1) |
| 157 | + omniauth-oauth2 (1.1.0) | ||
| 158 | + oauth2 (~> 0.8.0) | ||
| 152 | omniauth (~> 1.0) | 159 | omniauth (~> 1.0) |
| 153 | orm_adapter (0.0.7) | 160 | orm_adapter (0.0.7) |
| 154 | oruen_redmine_client (0.0.1) | 161 | oruen_redmine_client (0.0.1) |
| @@ -191,29 +198,29 @@ GEM | @@ -191,29 +198,29 @@ GEM | ||
| 191 | rake (>= 0.8.7) | 198 | rake (>= 0.8.7) |
| 192 | rdoc (~> 3.4) | 199 | rdoc (~> 3.4) |
| 193 | thor (>= 0.14.6, < 2.0) | 200 | thor (>= 0.14.6, < 2.0) |
| 194 | - raindrops (0.8.0) | 201 | + raindrops (0.10.0) |
| 195 | rake (0.9.2.2) | 202 | rake (0.9.2.2) |
| 196 | rbx-require-relative (0.0.9) | 203 | rbx-require-relative (0.0.9) |
| 197 | rdoc (3.12) | 204 | rdoc (3.12) |
| 198 | json (~> 1.4) | 205 | json (~> 1.4) |
| 199 | - responders (0.9.1) | 206 | + responders (0.9.2) |
| 200 | railties (~> 3.1) | 207 | railties (~> 3.1) |
| 201 | rest-client (1.6.7) | 208 | rest-client (1.6.7) |
| 202 | mime-types (>= 1.16) | 209 | mime-types (>= 1.16) |
| 203 | ri_cal (0.8.8) | 210 | ri_cal (0.8.8) |
| 204 | - rspec (2.10.0) | ||
| 205 | - rspec-core (~> 2.10.0) | ||
| 206 | - rspec-expectations (~> 2.10.0) | ||
| 207 | - rspec-mocks (~> 2.10.0) | ||
| 208 | - rspec-core (2.10.0) | ||
| 209 | - rspec-expectations (2.10.0) | 211 | + rspec (2.11.0) |
| 212 | + rspec-core (~> 2.11.0) | ||
| 213 | + rspec-expectations (~> 2.11.0) | ||
| 214 | + rspec-mocks (~> 2.11.0) | ||
| 215 | + rspec-core (2.11.1) | ||
| 216 | + rspec-expectations (2.11.2) | ||
| 210 | diff-lcs (~> 1.1.3) | 217 | diff-lcs (~> 1.1.3) |
| 211 | - rspec-mocks (2.10.1) | ||
| 212 | - rspec-rails (2.10.1) | 218 | + rspec-mocks (2.11.1) |
| 219 | + rspec-rails (2.11.0) | ||
| 213 | actionpack (>= 3.0) | 220 | actionpack (>= 3.0) |
| 214 | activesupport (>= 3.0) | 221 | activesupport (>= 3.0) |
| 215 | railties (>= 3.0) | 222 | railties (>= 3.0) |
| 216 | - rspec (~> 2.10.0) | 223 | + rspec (~> 2.11.0) |
| 217 | ruby-debug (0.10.4) | 224 | ruby-debug (0.10.4) |
| 218 | columnize (>= 0.1) | 225 | columnize (>= 0.1) |
| 219 | ruby-debug-base (~> 0.10.4.0) | 226 | ruby-debug-base (~> 0.10.4.0) |
| @@ -221,10 +228,9 @@ GEM | @@ -221,10 +228,9 @@ GEM | ||
| 221 | linecache (>= 0.3) | 228 | linecache (>= 0.3) |
| 222 | ruby-fogbugz (0.1.1) | 229 | ruby-fogbugz (0.1.1) |
| 223 | crack | 230 | crack |
| 224 | - rubyzip (0.9.8) | ||
| 225 | - selenium-webdriver (2.21.2) | 231 | + rubyzip (0.9.9) |
| 232 | + selenium-webdriver (2.25.0) | ||
| 226 | childprocess (>= 0.2.5) | 233 | childprocess (>= 0.2.5) |
| 227 | - ffi (~> 1.0) | ||
| 228 | libwebsocket (~> 0.1.3) | 234 | libwebsocket (~> 0.1.3) |
| 229 | multi_json (~> 1.0) | 235 | multi_json (~> 1.0) |
| 230 | rubyzip | 236 | rubyzip |
| @@ -232,29 +238,29 @@ GEM | @@ -232,29 +238,29 @@ GEM | ||
| 232 | hike (~> 1.2) | 238 | hike (~> 1.2) |
| 233 | rack (~> 1.0) | 239 | rack (~> 1.0) |
| 234 | tilt (~> 1.1, != 1.3.0) | 240 | tilt (~> 1.1, != 1.3.0) |
| 235 | - therubyracer (0.10.1) | 241 | + therubyracer (0.10.2) |
| 236 | libv8 (~> 3.3.10) | 242 | libv8 (~> 3.3.10) |
| 237 | - thin (1.3.1) | 243 | + thin (1.4.1) |
| 238 | daemons (>= 1.0.9) | 244 | daemons (>= 1.0.9) |
| 239 | eventmachine (>= 0.12.6) | 245 | eventmachine (>= 0.12.6) |
| 240 | rack (>= 1.0.0) | 246 | rack (>= 1.0.0) |
| 241 | - thor (0.15.2) | 247 | + thor (0.15.4) |
| 242 | tilt (1.3.3) | 248 | tilt (1.3.3) |
| 243 | treetop (1.4.10) | 249 | treetop (1.4.10) |
| 244 | polyglot | 250 | polyglot |
| 245 | polyglot (>= 0.3.1) | 251 | polyglot (>= 0.3.1) |
| 246 | tzinfo (0.3.33) | 252 | tzinfo (0.3.33) |
| 247 | - uglifier (1.2.4) | 253 | + uglifier (1.2.7) |
| 248 | execjs (>= 0.3.0) | 254 | execjs (>= 0.3.0) |
| 249 | - multi_json (>= 1.0.2) | 255 | + multi_json (~> 1.3) |
| 250 | unicorn (4.3.1) | 256 | unicorn (4.3.1) |
| 251 | kgio (~> 2.6) | 257 | kgio (~> 2.6) |
| 252 | rack | 258 | rack |
| 253 | raindrops (~> 0.7) | 259 | raindrops (~> 0.7) |
| 254 | useragent (0.3.2) | 260 | useragent (0.3.2) |
| 255 | - warden (1.2.0) | 261 | + warden (1.2.1) |
| 256 | rack (>= 1.0) | 262 | rack (>= 1.0) |
| 257 | - webmock (1.8.6) | 263 | + webmock (1.8.7) |
| 258 | addressable (>= 2.2.7) | 264 | addressable (>= 2.2.7) |
| 259 | crack (>= 0.1.7) | 265 | crack (>= 0.1.7) |
| 260 | xpath (0.1.4) | 266 | xpath (0.1.4) |
| @@ -267,8 +273,8 @@ PLATFORMS | @@ -267,8 +273,8 @@ PLATFORMS | ||
| 267 | DEPENDENCIES | 273 | DEPENDENCIES |
| 268 | SystemTimer | 274 | SystemTimer |
| 269 | actionmailer_inline_css (~> 1.3.0) | 275 | actionmailer_inline_css (~> 1.3.0) |
| 270 | - bson (= 1.3.1) | ||
| 271 | - bson_ext (= 1.3.1) | 276 | + bson (= 1.6.2) |
| 277 | + bson_ext (= 1.6.2) | ||
| 272 | capybara | 278 | capybara |
| 273 | database_cleaner (~> 0.6.0) | 279 | database_cleaner (~> 0.6.0) |
| 274 | debugger | 280 | debugger |
| @@ -283,7 +289,7 @@ DEPENDENCIES | @@ -283,7 +289,7 @@ DEPENDENCIES | ||
| 283 | kaminari | 289 | kaminari |
| 284 | launchy | 290 | launchy |
| 285 | lighthouse-api | 291 | lighthouse-api |
| 286 | - mongo (= 1.3.1) | 292 | + mongo (= 1.6.2) |
| 287 | mongoid (~> 2.4.10) | 293 | mongoid (~> 2.4.10) |
| 288 | mongoid_rails_migrations | 294 | mongoid_rails_migrations |
| 289 | nokogiri | 295 | nokogiri |
app/assets/javascripts/errbit.js
| @@ -130,5 +130,10 @@ $(function() { | @@ -130,5 +130,10 @@ $(function() { | ||
| 130 | // Hide external backtrace on page load | 130 | // Hide external backtrace on page load |
| 131 | hide_external_backtrace(); | 131 | hide_external_backtrace(); |
| 132 | 132 | ||
| 133 | + $('.head a.show_tail').click(function(e) { | ||
| 134 | + $(this).hide().closest('.head_and_tail').find('.tail').show(); | ||
| 135 | + e.preventDefault(); | ||
| 136 | + }); | ||
| 137 | + | ||
| 133 | init(); | 138 | init(); |
| 134 | }); | 139 | }); |
app/helpers/application_helper.rb
| @@ -61,9 +61,22 @@ module ApplicationHelper | @@ -61,9 +61,22 @@ module ApplicationHelper | ||
| 61 | render "errs/tally_table", :rows => rows | 61 | render "errs/tally_table", :rows => rows |
| 62 | end | 62 | end |
| 63 | 63 | ||
| 64 | + def head(collection) | ||
| 65 | + collection.first(head_size) | ||
| 66 | + end | ||
| 67 | + | ||
| 68 | + def tail(collection) | ||
| 69 | + collection.to_a[head_size..-1].to_a | ||
| 70 | + end | ||
| 71 | + | ||
| 64 | private | 72 | private |
| 65 | def total_from_tallies(tallies) | 73 | def total_from_tallies(tallies) |
| 66 | tallies.values.inject(0) {|sum, n| sum + n} | 74 | tallies.values.inject(0) {|sum, n| sum + n} |
| 67 | end | 75 | end |
| 76 | + | ||
| 77 | + def head_size | ||
| 78 | + 4 | ||
| 79 | + end | ||
| 80 | + | ||
| 68 | end | 81 | end |
| 69 | 82 |
app/views/errs/_tally_table.html.haml
| 1 | -%table.tally | ||
| 2 | - - rows.each do |row| | ||
| 3 | - %tr | ||
| 4 | - %td.percent= number_to_percentage(row[0], :precision => 1) | ||
| 5 | - %th.value= row[1] | 1 | +.head_and_tail |
| 2 | + %table.tally.head | ||
| 3 | + %tbody | ||
| 4 | + - head(rows).each do |row| | ||
| 5 | + %tr | ||
| 6 | + %td.percent= number_to_percentage(row[0], :precision => 1) | ||
| 7 | + %th.value= row[1] | ||
| 8 | + - if rows.size > head_size | ||
| 9 | + %tfoot | ||
| 10 | + %tr | ||
| 11 | + %td{colspan: 2} | ||
| 12 | + = link_to 'Show more...', '#', class: :show_tail | ||
| 13 | + %table.tally.tail{style: "display: none"} | ||
| 14 | + %tbody | ||
| 15 | + - tail(rows).each do |row| | ||
| 16 | + %tr | ||
| 17 | + %td.percent= number_to_percentage(row[0], :precision => 1) | ||
| 18 | + %th.value= row[1] |
config/mongoid.mongohq.yml