Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'hstove-master'

  • Loading branch information...
commit 29c80b8a29f52e4f9e6a497dd01cef78d1685d1d 2 parents d2e16f3 + 7791f8f
Kevin Burke kevinburke authored
4 app/app.rb
@@ -171,13 +171,15 @@ def initialize(*args)
171 171 type = url =~ /(\.js)$/ ? 'js' : curl.content_type
172 172 body = pretty_print(type, curl.body_str)
173 173 request = pretty_print_requests(sent_headers, post_data)
  174 + params['response_time'] = curl.total_time
174 175
175 176 json :header => header,
176 177 :body => body,
177 178 :request => request,
178 179 :hurl_id => save_hurl(params),
179 180 :prev_hurl => @user ? @user.second_to_last_hurl_id : nil,
180   - :view_id => save_view(header, body, request)
  181 + :view_id => save_view(header, body, request),
  182 + :response_time => curl.total_time
181 183 rescue => e
182 184 json :error => CGI::escapeHTML(e.to_s)
183 185 end
4 app/templates/index.mustache
@@ -126,6 +126,7 @@
126 126 </div>
127 127 <div id="request-and-response" {{# hide_request_and_response? }}style="display:none;"{{/ hide_request_and_response? }}>
128 128 <div class="utils">
  129 + <span class="response-time">{{ hurl_response_time_pretty }}</span>
129 130 <a href="{{ view_permalink }}" class="full-size-link nav-item" target="_blank">view full size</a>
130 131 <a href="{{ hurl_permalink }}" class="permalink nav-item">permalink</a>
131 132 </div>
@@ -150,7 +151,8 @@
150 151 </div>
151 152 </div>
152 153 <div class="utils">
  154 + <span class="response-time">{{ hurl_response_time_pretty }}</span>
153 155 <a href="#" class="full-size-link nav-item" target="_blank">view full size</a>
154 156 <a href="#" class="permalink nav-item">permalink</a>
155 157 </div>
156   -</div>
  158 +</div>
12 app/views/index.rb
@@ -114,6 +114,16 @@ def follows_redirects?
114 114 @hurl['follows_redirects']
115 115 end
116 116
  117 + def hurl_response_time
  118 + @hurl['response_time']
  119 + end
  120 +
  121 + def hurl_response_time_pretty
  122 + if hurl_response_time
  123 + hurl_response_time.round(3).to_s + " seconds"
  124 + end
  125 + end
  126 +
117 127
118 128 #
119 129 # view related
@@ -132,4 +142,4 @@ def view
132 142 [ :header => @view['header'], :body => @view['body'] ]
133 143 end
134 144 end
135   -end
  145 +end
6 public/css/style.css
@@ -275,3 +275,9 @@ td.date {
275 275 .unicorn {
276 276 text-align: center;
277 277 }
  278 +
  279 +.response-time{
  280 + margin-right: 10px;
  281 + color: #ddd;
  282 + font-size: 12px;
  283 +}
33 public/js/hurl.js
@@ -8,23 +8,23 @@ var Hurl = {
8 8 // indicate inputs using defaults
9 9 self.addClass('defaulted')
10 10
11   - if (self.val() === '' || self.val() === title) {
12   - self.val(title).css('color', '#E9EAEA')
13   - } else {
14   - self.addClass('focused')
  11 + if (self.val() === '' || self.val() === title) {
  12 + self.val(title).css('color', '#E9EAEA')
  13 + } else {
  14 + self.addClass('focused')
15 15 }
16 16
17   - self.focus(function() {
18   - if (self.val() === title) {
19   - self.val('').addClass('focused').css('color', '#333')
20   - }
21   - })
22   -
23   - self.blur(function() {
24   - if (self.val() === '') {
25   - self.val(title).removeClass('focused').css('color', '#E9EAEA')
26   - }
27   - })
  17 + self.focus(function() {
  18 + if (self.val() === title) {
  19 + self.val('').addClass('focused').css('color', '#333')
  20 + }
  21 + })
  22 +
  23 + self.blur(function() {
  24 + if (self.val() === '') {
  25 + self.val(title).removeClass('focused').css('color', '#E9EAEA')
  26 + }
  27 + })
28 28 })
29 29 },
30 30
@@ -211,6 +211,7 @@ $(document).ready(function() {
211 211 $('#request').html(data.request)
212 212 $('#response').html('<pre>' + data.header + '</pre>' + data.body)
213 213 $('.help-blurb').hide()
  214 + $('.response-time').text((data.response_time.toFixed(3) + " seconds"))
214 215 $('#request-and-response').show()
215 216 } else {
216 217 $('#flash-error-msg').html("Weird response. Sorry.")
@@ -252,7 +253,7 @@ $(document).ready(function() {
252 253 })
253 254
254 255 // in-field labels
255   - Hurl.labelHints('input[title]')
  256 + Hurl.labelHints('input[title]')
256 257
257 258 // relatize dates
258 259 $('.relatize').relatizeDate()

0 comments on commit 29c80b8

Please sign in to comment.
Something went wrong with that request. Please try again.