summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/trigger_controller.rb20
-rw-r--r--app/views/fax_documents/_fax_document.html.haml2
-rw-r--r--config/routes.rb3
3 files changed, 19 insertions, 6 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
diff --git a/app/views/fax_documents/_fax_document.html.haml b/app/views/fax_documents/_fax_document.html.haml
index 1fd5270..930a0c3 100644
--- a/app/views/fax_documents/_fax_document.html.haml
+++ b/app/views/fax_documents/_fax_document.html.haml
@@ -1,4 +1,4 @@
-.div{:id => "fax_document_#{fax_document.id}"}
+.fax_document{:id => fax_document.id}
.row
.span12
%table.table.table-striped
diff --git a/config/routes.rb b/config/routes.rb
index c661dfb..c2f9cb5 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -24,10 +24,9 @@ Gemeinschaft42c::Application.routes.draw do
scope :constraints => lambda{|req|%w(127.0.0.1).include? req.remote_addr} do
get "trigger/voicemail"
get "trigger/fax"
+ match 'trigger/fax_has_been_sent/:id' => 'trigger#fax_has_been_sent'
end
- get "trigger/fax_has_been_sent"
-
resources :call_routes do
collection {
post :sort