summaryrefslogtreecommitdiff
path: root/app/controllers/trigger_controller.rb
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-03-12 12:32:32 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-03-12 12:32:32 +0100
commitd11a8692e742720435c4286e3752c8c136cc88cf (patch)
treef01b4c5c5e4a7f713a13ffbb3eaba031ecdb3979 /app/controllers/trigger_controller.rb
parentb16aeeccff8de5fd579d79a48740df7a3e34e7bc (diff)
jquery replaceWith for FaxDocument#view after sending the fax
Diffstat (limited to 'app/controllers/trigger_controller.rb')
-rw-r--r--app/controllers/trigger_controller.rb20
1 files changed, 17 insertions, 3 deletions
diff --git a/app/controllers/trigger_controller.rb b/app/controllers/trigger_controller.rb
index e3fc524..3bd75a1 100644
--- a/app/controllers/trigger_controller.rb
+++ b/app/controllers/trigger_controller.rb
@@ -69,10 +69,24 @@ class TriggerController < ApplicationController
if fax_document
# push the partial to the webbrowser
#
- new_html = render_to_string("fax_documents/_fax_document", :layout => false, :locals => {:fax_document => fax_document})
- PrivatePub.publish_to("/fax_documents/#{fax_document.id}", "$('#fax_document_" + fax_document.id.to_s + "').replaceWith(escape_javascript(" + new_html + "));")
+ new_html = ActionController::Base.helpers.escape_javascript(render_to_string("fax_documents/_fax_document", :layout => false, :locals => {:fax_document => fax_document}))
+ Rails.logger.debug new_html
+ PrivatePub.publish_to("/fax_documents/#{fax_document.id}", "$('#" + fax_document.id.to_s + ".fax_document').replaceWith('#{new_html}');")
+
+ render(
+ :status => 200,
+ :layout => false,
+ :content_type => 'text/plain',
+ :text => "<!-- OK -->",
+ )
+ else
+ render(
+ :status => 501,
+ :layout => false,
+ :content_type => 'text/plain',
+ :text => "<!-- ERRORS: #{errors.join(', ')} -->",
+ )
end
-
end
def fax