Skip to content

Commit

Permalink
Renaming server url method to url_path to avoid conflicting with Sina…
Browse files Browse the repository at this point in the history
…tra 1.2 url helper
  • Loading branch information
guilleiguaran authored and defunkt committed Mar 17, 2011
1 parent 855b2e6 commit 65f7bb0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions lib/resque/server.rb
Expand Up @@ -16,17 +16,17 @@ class Server < Sinatra::Base
alias_method :h, :escape_html

def current_section
url request.path_info.sub('/','').split('/')[0].downcase
url_path request.path_info.sub('/','').split('/')[0].downcase
end

def current_page
url request.path_info.sub('/','')
url_path request.path_info.sub('/','')
end

def url(*path_parts)
def url_path(*path_parts)
[ path_prefix, path_parts ].join("/").squeeze('/')
end
alias_method :u, :url
alias_method :u, :url_path

def path_prefix
request.env['SCRIPT_NAME']
Expand All @@ -38,7 +38,7 @@ def class_if_current(path = '')

def tab(name)
dname = name.to_s.downcase
path = url(dname)
path = url_path(dname)
"<li #{class_if_current(path)}><a href='#{path}'>#{name}</a></li>"
end

Expand Down Expand Up @@ -127,7 +127,7 @@ def show(page, layout = true)

# to make things easier on ourselves
get "/?" do
redirect url(:overview)
redirect url_path(:overview)
end

%w( overview queues working workers key ).each do |page|
Expand Down Expand Up @@ -181,7 +181,7 @@ def show(page, layout = true)
end

get "/stats" do
redirect url("/stats/resque")
redirect url_path("/stats/resque")
end

get "/stats/:id" do
Expand Down
2 changes: 1 addition & 1 deletion lib/resque/server/views/failed.erb
Expand Up @@ -22,7 +22,7 @@
<% else %>
<dt>Worker</dt>
<dd>
<a href="<%= url(:workers, job['worker']) %>"><%= job['worker'].split(':')[0...2].join(':') %></a> on <b class='queue-tag'><%= job['queue'] %></b > at <b><span class="time"><%= job['failed_at'] %></span></b>
<a href="<%= u(:workers, job['worker']) %>"><%= job['worker'].split(':')[0...2].join(':') %></a> on <b class='queue-tag'><%= job['queue'] %></b > at <b><span class="time"><%= job['failed_at'] %></span></b>
<% if job['retried_at'] %>
<div class='retried'>
Retried <b><span class="time"><%= job['retried_at'] %></span></b>
Expand Down
4 changes: 2 additions & 2 deletions lib/resque/server/views/queues.erb
Expand Up @@ -36,12 +36,12 @@
</tr>
<% for queue in resque.queues.sort_by { |q| q.to_s } %>
<tr>
<td class='queue'><a class="queue" href="<%= url "queues/#{queue}" %>"><%= queue %></a></td>
<td class='queue'><a class="queue" href="<%= u "queues/#{queue}" %>"><%= queue %></a></td>
<td class='size'><%= resque.size queue %></td>
</tr>
<% end %>
<tr class="<%= Resque::Failure.count.zero? ? "failed" : "failure" %>">
<td class='queue failed'><a class="queue" href="<%= url :failed %>">failed</a></td>
<td class='queue failed'><a class="queue" href="<%= u :failed %>">failed</a></td>
<td class='size'><%= Resque::Failure.count %></td>
</tr>
</table>
Expand Down
4 changes: 2 additions & 2 deletions lib/resque/server/views/workers.erb
Expand Up @@ -95,12 +95,12 @@
</tr>
<% for hostname, workers in worker_hosts.sort_by { |h,w| h } %>
<tr>
<td class='queue'><a class="queue" href="<%= url "workers/#{hostname}" %>"><%= hostname %></a></td>
<td class='queue'><a class="queue" href="<%= u "workers/#{hostname}" %>"><%= hostname %></a></td>
<td class='size'><%= workers.size %></td>
</tr>
<% end %>
<tr class="failed">
<td class='queue failed'><a class="queue" href="<%= url "workers/all" %>">all workers</a></td>
<td class='queue failed'><a class="queue" href="<%= u "workers/all" %>">all workers</a></td>
<td class='size'><%= Resque.workers.size %></td>
</tr>
</table>
Expand Down

0 comments on commit 65f7bb0

Please sign in to comment.