summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-03-11 12:19:57 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-03-11 12:19:57 +0100
commit64afdeacb1444b319abfcad6c9a8cfd656fe2dd4 (patch)
tree1cbf99d5b3084f8deb6986e8bbd30c20b44bfb27
parentaa46f61cc84043a81f760c961ec53786671e7e50 (diff)
Reload FaxDocument#show when a fax was send.
-rw-r--r--app/controllers/trigger_controller.rb4
-rw-r--r--app/views/fax_documents/show.html.haml3
2 files changed, 7 insertions, 0 deletions
diff --git a/app/controllers/trigger_controller.rb b/app/controllers/trigger_controller.rb
index db379f9..0de9223 100644
--- a/app/controllers/trigger_controller.rb
+++ b/app/controllers/trigger_controller.rb
@@ -110,6 +110,10 @@ class TriggerController < ApplicationController
end
if errors.count == 0
+ # Reload FaxDocument#show
+ #
+ PrivatePub.publish_to("/fax_documents/#{fax_document.id}", "location.reload();")
+
# Indicate a new fax in the navigation bar.
#
if fax_document.fax_accountable.class == User
diff --git a/app/views/fax_documents/show.html.haml b/app/views/fax_documents/show.html.haml
index b8f3e9e..f860143 100644
--- a/app/views/fax_documents/show.html.haml
+++ b/app/views/fax_documents/show.html.haml
@@ -65,3 +65,6 @@
.row
.span12
= render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @fax_document.fax_account, :child => @fax_document }
+
+- if @fax_document.state == 'sending' || @fax_document.state == 'queued_for_sending'
+ = subscribe_to "/fax_documents/#{@fax_document.id}" \ No newline at end of file