mirror of
https://github.com/kbparagua/paloma
synced 2023-03-27 23:21:17 -04:00
Issue #3: Adding paloma txt before the end of body element
This commit is contained in:
parent
00ac329a8f
commit
451c0c3fb5
2 changed files with 8 additions and 1 deletions
|
@ -20,10 +20,16 @@ module Paloma
|
|||
def update_callback
|
||||
add_to_callbacks @__callback__, @__js_params__
|
||||
|
||||
response_body[0] += view_context.render(
|
||||
paloma_txt = view_context.render(
|
||||
:partial => "paloma/callback_hook",
|
||||
:locals => {:callbacks => session[:callbacks]})
|
||||
|
||||
before_body_end_index = response_body[0].rindex('</body>')
|
||||
before_body_end_content = response_body[0][0, before_body_end_index].html_safe
|
||||
after_body_end_content = response_body[0][before_body_end_index..-1].html_safe
|
||||
|
||||
response_body[0] = before_body_end_content + paloma_txt + after_body_end_content
|
||||
|
||||
response.body = response_body[0]
|
||||
clear_callbacks
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ feature 'Callbacks' do
|
|||
|
||||
it 'should execute articles/new callback', :js => true do
|
||||
visit new_article_path
|
||||
|
||||
page.has_selector?('#from-articles-new-callback').should == true
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue