raindrops RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* [PATCH] Watcher: Use relative paths in HTML links
@ 2012-11-30  0:37 Lawrence Pit
  2012-11-30  1:30 ` Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Lawrence Pit @ 2012-11-30  0:37 UTC (permalink / raw)
  To: raindrops

When I mount Raindrops::Watcher like so:

   map "/_raindrops" do
     run Raindrops::Watcher.new
   end

Then in the HTML output links use an absolute path instead of relative 
to the path /_raindrops/

Cheers,
Lawrence

---
  lib/raindrops/watcher.rb | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/raindrops/watcher.rb b/lib/raindrops/watcher.rb
index 43c30ef..b7199a1 100644
--- a/lib/raindrops/watcher.rb
+++ b/lib/raindrops/watcher.rb
@@ -260,7 +260,7 @@ class Raindrops::Watcher
        headers.map { |k,v|
          "<tr><td>#{k.gsub(/^X-/, '')}</td><td>#{v}</td></tr>"
        }.join << "</table><pre>#{escape_html agg}</pre>" \
-      "<form action='/reset/#{escape addr}' method='post'>" \
+      "<form action='../reset/#{escape addr}' method='post'>" \
        "<input type='submit' name='x' value='reset' /></form>" \
        "</body>"
      headers["Content-Type"] = "text/html"
@@ -346,14 +346,14 @@ class Raindrops::Watcher
        end.map do |addr,stats|
          e_addr = escape addr
          "<tr>" \
-          "<td><a href='/tail/#{e_addr}.txt' " \
+          "<td><a href='tail/#{e_addr}.txt' " \
              "title='&quot;tail&quot; output in real time'" \
              ">#{escape_html addr}</a></td>" \
-          "<td><a href='/active/#{e_addr}.html' " \
+          "<td><a href='active/#{e_addr}.html' " \
              "title='show active connection 
stats'>#{stats.active}</a></td>" \
-          "<td><a href='/queued/#{e_addr}.html' " \
+          "<td><a href='queued/#{e_addr}.html' " \
              "title='show queued connection 
stats'>#{stats.queued}</a></td>" \
-          "<td><form action='/reset/#{e_addr}' method='post'>" \
+          "<td><form action='reset/#{e_addr}' method='post'>" \
              "<input title='reset statistics' " \
                "type='submit' name='x' value='x' /></form></td>" \
          "</tr>" \
--
1.7.11.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-30  1:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-30  0:37 [PATCH] Watcher: Use relative paths in HTML links Lawrence Pit
2012-11-30  1:30 ` Eric Wong

Code repositories for project(s) associated with this inbox:

	../../../raindrops.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).