Commit 73a73f879efe51a3ddfec407e6e3de4bdd039719

Authored by Marcin Ciunelis
2 parents 37355272 e4e97310
Exists in master and in 1 other branch production

Merge pull request #220 from martinciu/head-and-tail

Head and tail
Gemfile
... ... @@ -32,9 +32,9 @@ gem 'fabrication', "~> 1.3.0" # Both for tests, and loading demo data
32 32 gem 'rails_autolink', '~> 1.0.9'
33 33  
34 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 38 end
39 39  
40 40 gem 'ri_cal'
... ... @@ -47,7 +47,8 @@ group :development, :test do
47 47 gem 'ruby-debug', :platform => :mri_18
48 48 gem 'debugger', :platform => :mri_19
49 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 52 end
52 53  
53 54 group :test do
... ...
Gemfile.lock
... ... @@ -33,11 +33,12 @@ GEM
33 33 activesupport (3.2.6)
34 34 i18n (~> 0.6)
35 35 multi_json (~> 1.0)
36   - addressable (2.2.8)
  36 + addressable (2.3.2)
37 37 arel (3.0.2)
38 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 42 builder (3.0.0)
42 43 capybara (1.1.2)
43 44 mime-types (>= 1.16)
... ... @@ -46,8 +47,8 @@ GEM
46 47 rack-test (>= 0.5.4)
47 48 selenium-webdriver (~> 2.0)
48 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 52 columnize (0.3.6)
52 53 crack (0.3.1)
53 54 css_parser (1.2.6)
... ... @@ -55,13 +56,13 @@ GEM
55 56 rdoc
56 57 daemons (1.1.8)
57 58 database_cleaner (0.6.7)
58   - debugger (1.1.3)
  59 + debugger (1.2.0)
59 60 columnize (>= 0.3.1)
60 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 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 66 devise (1.5.3)
66 67 bcrypt-ruby (~> 3.0)
67 68 orm_adapter (~> 0.0.3)
... ... @@ -77,10 +78,10 @@ GEM
77 78 fabrication (1.3.2)
78 79 faraday (0.8.1)
79 80 multipart-post (~> 1.1)
80   - faraday_middleware (0.8.7)
  81 + faraday_middleware (0.8.8)
81 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 85 happymapper (0.4.0)
85 86 libxml-ruby (~> 2.0)
86 87 has_scope (0.5.1)
... ... @@ -90,23 +91,26 @@ GEM
90 91 activesupport
91 92 builder
92 93 htmlentities (4.3.1)
  94 + httpauth (0.1)
93 95 i18n (0.6.0)
94 96 inherited_resources (1.3.1)
95 97 has_scope (~> 0.5.0)
96 98 responders (~> 0.6)
97 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 103 kaminari (0.13.0)
100 104 actionpack (>= 3.0.0)
101 105 activesupport (>= 3.0.0)
102 106 railties (>= 3.0.0)
103 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 110 libv8 (3.3.10.4)
107   - libwebsocket (0.1.3)
  111 + libwebsocket (0.1.5)
108 112 addressable
109   - libxml-ruby (2.3.2)
  113 + libxml-ruby (2.3.3)
110 114 lighthouse-api (2.0)
111 115 activeresource (>= 3.0.0)
112 116 activesupport (>= 3.0.0)
... ... @@ -116,9 +120,9 @@ GEM
116 120 i18n (>= 0.4.0)
117 121 mime-types (~> 1.16)
118 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 126 mongoid (2.4.10)
123 127 activemodel (~> 3.1)
124 128 mongo (~> 1.3)
... ... @@ -130,25 +134,28 @@ GEM
130 134 railties (>= 3.0.0)
131 135 multi_json (1.3.6)
132 136 multipart-post (1.1.5)
133   - nokogiri (1.5.0)
  137 + nokogiri (1.5.5)
134 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 143 multi_json (~> 1.0)
  144 + rack (~> 1.2)
138 145 octokit (1.0.7)
139 146 addressable (~> 2.2)
140 147 faraday (~> 0.8)
141 148 faraday_middleware (~> 0.8)
142 149 hashie (~> 1.2)
143 150 multi_json (~> 1.3)
144   - omniauth (1.0.3)
  151 + omniauth (1.1.0)
145 152 hashie (~> 1.2)
146 153 rack
147   - omniauth-github (1.0.1)
  154 + omniauth-github (1.0.2)
148 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 159 omniauth (~> 1.0)
153 160 orm_adapter (0.0.7)
154 161 oruen_redmine_client (0.0.1)
... ... @@ -191,29 +198,29 @@ GEM
191 198 rake (>= 0.8.7)
192 199 rdoc (~> 3.4)
193 200 thor (>= 0.14.6, < 2.0)
194   - raindrops (0.8.0)
  201 + raindrops (0.10.0)
195 202 rake (0.9.2.2)
196 203 rbx-require-relative (0.0.9)
197 204 rdoc (3.12)
198 205 json (~> 1.4)
199   - responders (0.9.1)
  206 + responders (0.9.2)
200 207 railties (~> 3.1)
201 208 rest-client (1.6.7)
202 209 mime-types (>= 1.16)
203 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 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 220 actionpack (>= 3.0)
214 221 activesupport (>= 3.0)
215 222 railties (>= 3.0)
216   - rspec (~> 2.10.0)
  223 + rspec (~> 2.11.0)
217 224 ruby-debug (0.10.4)
218 225 columnize (>= 0.1)
219 226 ruby-debug-base (~> 0.10.4.0)
... ... @@ -221,10 +228,9 @@ GEM
221 228 linecache (>= 0.3)
222 229 ruby-fogbugz (0.1.1)
223 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 233 childprocess (>= 0.2.5)
227   - ffi (~> 1.0)
228 234 libwebsocket (~> 0.1.3)
229 235 multi_json (~> 1.0)
230 236 rubyzip
... ... @@ -232,29 +238,29 @@ GEM
232 238 hike (~> 1.2)
233 239 rack (~> 1.0)
234 240 tilt (~> 1.1, != 1.3.0)
235   - therubyracer (0.10.1)
  241 + therubyracer (0.10.2)
236 242 libv8 (~> 3.3.10)
237   - thin (1.3.1)
  243 + thin (1.4.1)
238 244 daemons (>= 1.0.9)
239 245 eventmachine (>= 0.12.6)
240 246 rack (>= 1.0.0)
241   - thor (0.15.2)
  247 + thor (0.15.4)
242 248 tilt (1.3.3)
243 249 treetop (1.4.10)
244 250 polyglot
245 251 polyglot (>= 0.3.1)
246 252 tzinfo (0.3.33)
247   - uglifier (1.2.4)
  253 + uglifier (1.2.7)
248 254 execjs (>= 0.3.0)
249   - multi_json (>= 1.0.2)
  255 + multi_json (~> 1.3)
250 256 unicorn (4.3.1)
251 257 kgio (~> 2.6)
252 258 rack
253 259 raindrops (~> 0.7)
254 260 useragent (0.3.2)
255   - warden (1.2.0)
  261 + warden (1.2.1)
256 262 rack (>= 1.0)
257   - webmock (1.8.6)
  263 + webmock (1.8.7)
258 264 addressable (>= 2.2.7)
259 265 crack (>= 0.1.7)
260 266 xpath (0.1.4)
... ... @@ -267,8 +273,8 @@ PLATFORMS
267 273 DEPENDENCIES
268 274 SystemTimer
269 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 278 capybara
273 279 database_cleaner (~> 0.6.0)
274 280 debugger
... ... @@ -283,7 +289,7 @@ DEPENDENCIES
283 289 kaminari
284 290 launchy
285 291 lighthouse-api
286   - mongo (= 1.3.1)
  292 + mongo (= 1.6.2)
287 293 mongoid (~> 2.4.10)
288 294 mongoid_rails_migrations
289 295 nokogiri
... ...
app/assets/javascripts/errbit.js
... ... @@ -130,5 +130,10 @@ $(function() {
130 130 // Hide external backtrace on page load
131 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 138 init();
134 139 });
... ...
app/helpers/application_helper.rb
... ... @@ -61,9 +61,22 @@ module ApplicationHelper
61 61 render "errs/tally_table", :rows => rows
62 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 72 private
65 73 def total_from_tallies(tallies)
66 74 tallies.values.inject(0) {|sum, n| sum + n}
67 75 end
  76 +
  77 + def head_size
  78 + 4
  79 + end
  80 +
68 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
... ... @@ -5,4 +5,4 @@
5 5 # commit it to your repo, then push to heroku.
6 6  
7 7 production:
8   - uri: <%= ENV['MONGOHQ_URL'] %>
9 8 \ No newline at end of file
  9 + uri: <%= ENV['MONGOHQ_URL'] %>
... ...