summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/trigger_controller.rb25
-rw-r--r--app/views/switchboards/show.html.haml2
-rw-r--r--config/routes.rb1
3 files changed, 28 insertions, 0 deletions
diff --git a/app/controllers/trigger_controller.rb b/app/controllers/trigger_controller.rb
index df6f39f..3445802 100644
--- a/app/controllers/trigger_controller.rb
+++ b/app/controllers/trigger_controller.rb
@@ -89,6 +89,31 @@ class TriggerController < ApplicationController
end
end
+ def sip_account_update
+ sip_account = SipAccount.find(params[:id])
+
+ if sip_account
+ # push the partial to the webbrowser
+ #
+ # new_html = ActionController::Base.helpers.escape_javascript(render_to_string("fax_documents/_fax_document", :layout => false, :locals => {:fax_document => fax_document}))
+ # 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
if !params[:fax_account_id].blank?
fax_account = FaxAccount.where(:id => params[:fax_account_id].to_i).first
diff --git a/app/views/switchboards/show.html.haml b/app/views/switchboards/show.html.haml
index 18671c2..2932366 100644
--- a/app/views/switchboards/show.html.haml
+++ b/app/views/switchboards/show.html.haml
@@ -16,3 +16,5 @@
%i.icon-edit.icon-white
%span.hidden-phone
=t("switchboard_entries.index.page_title")
+
+= subscribe_to "/switchboards/#{@switchboard.id}" \ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index c2f9cb5..ecfefa3 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -25,6 +25,7 @@ Gemeinschaft42c::Application.routes.draw do
get "trigger/voicemail"
get "trigger/fax"
match 'trigger/fax_has_been_sent/:id' => 'trigger#fax_has_been_sent'
+ match 'trigger/sip_account_update/:id' => 'trigger#sip_account_update'
end
resources :call_routes do