Skip to content

Commit

Permalink
Render slim views without overloading find_template in sinatra
Browse files Browse the repository at this point in the history
  • Loading branch information
zquestz committed Feb 21, 2013
1 parent 543a0a8 commit 92eb5ff
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions lib/sidekiq/failures/web_extension.rb
Expand Up @@ -3,20 +3,14 @@ module Failures
module WebExtension module WebExtension


def self.registered(app) def self.registered(app)
app.helpers do
def find_template(view, *a, &b)
dir = File.expand_path("../views/", __FILE__)
super(dir, *a, &b)
super
end
end

app.get "/failures" do app.get "/failures" do
view_path = File.join(File.expand_path("..", __FILE__), "views")

@count = (params[:count] || 25).to_i @count = (params[:count] || 25).to_i
(@current_page, @total_size, @messages) = page("failed", params[:page], @count) (@current_page, @total_size, @messages) = page("failed", params[:page], @count)
@messages = @messages.map { |msg| Sidekiq.load_json(msg) } @messages = @messages.map { |msg| Sidekiq.load_json(msg) }


slim :failures render(:slim, File.read(File.join(view_path, "failures.slim")))
end end


app.post "/failures/remove" do app.post "/failures/remove" do
Expand Down

0 comments on commit 92eb5ff

Please sign in to comment.