Permalink
Browse files

Redefined method render.

  • Loading branch information...
1 parent 7a2133d commit 6dee097b77dd8719fafce297b7e7d35916f292fa Julia Egorova committed Nov 28, 2012
Showing with 28 additions and 1 deletion.
  1. +1 −0 app/views/layouts/wiselinks.html.erb
  2. +1 −1 lib/assets/javascripts/wiselinks.js.coffee
  3. +20 −0 lib/layout.rb
  4. +6 −0 lib/wiselinks.rb
@@ -0,0 +1 @@
+<%= yield %>
@@ -93,7 +93,7 @@ class Wiselinks
serialized = []
for key of params
- serialized.push("#{params[key]}=key")
+ serialized.push("#{key}=#{params[key]}")
serialized = serialized.join('&').replace(/%|!/g, '')
View
@@ -0,0 +1,20 @@
+module Wiselinks
+ module Layout
+
+ def wiselinks_layout
+ 'wiselinks'
+ end
+
+ def render(options = {}, *args, &block)
+ if request.headers['X-Slide'].present?
+ if request.headers['X-Slide'] == 'partial'
+ options[:partial] ||= action_name
+ else
+ options[:layout] = self.wiselinks_layout
+ end
+ end
+
+ super
+ end
+ end
+end
View
@@ -1,5 +1,11 @@
+require 'layout'
+
module Wiselinks
class Engine < ::Rails::Engine
+
+ initializer "wiselinks.register" do
+ ActionController::Base.send :include, Layout
+ end
end
end

0 comments on commit 6dee097

Please sign in to comment.