summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/trigger_controller.rb12
-rw-r--r--app/views/fax_documents/_fax_document.html.haml66
-rw-r--r--app/views/fax_documents/show.html.haml66
-rw-r--r--config/routes.rb2
4 files changed, 81 insertions, 65 deletions
diff --git a/app/controllers/trigger_controller.rb b/app/controllers/trigger_controller.rb
index fb53c37..e3fc524 100644
--- a/app/controllers/trigger_controller.rb
+++ b/app/controllers/trigger_controller.rb
@@ -63,6 +63,18 @@ class TriggerController < ApplicationController
end
end
+ def fax_has_been_sent
+ fax_document = FaxDocument.find(params[:id])
+
+ 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 + "));")
+ 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/fax_documents/_fax_document.html.haml b/app/views/fax_documents/_fax_document.html.haml
new file mode 100644
index 0000000..1fd5270
--- /dev/null
+++ b/app/views/fax_documents/_fax_document.html.haml
@@ -0,0 +1,66 @@
+.div{:id => "fax_document_#{fax_document.id}"}
+ .row
+ .span12
+ %table.table.table-striped
+ - case fax_document.state
+ - when 'unsuccessful'
+ - current_status = 'error'
+ - when 'sending'
+ - current_status = 'success'
+ - when 'queued_for_sending'
+ - current_status = 'warning'
+ - else
+ - current_status = ''
+
+ %tr{:class => current_status}
+ %td
+ %strong= t('fax_documents.index.state') + ":"
+ %td
+ = t("fax_documents.states.#{fax_document.state}")
+ %tr
+ %td
+ %strong= t('fax_documents.index.result_code') + ":"
+ %td
+ = fax_document.result_code
+ %tr
+ %td
+ %strong= t('fax_documents.index.result_text') + ":"
+ %td
+ = t("fax_documents.result_codes.code_#{fax_document.result_code}")
+ %tr
+ %td
+ %strong= t('fax_documents.show.document_transferred_pages') + ":"
+ %td
+ = fax_document.document_transferred_pages
+ %tr
+ %td
+ %strong= t('fax_documents.show.remote_station_id') + ":"
+ %td
+ = fax_document.remote_station_id
+ %tr
+ %td
+ %strong= t('fax_documents.show.fax_resolution') + ":"
+ %td
+ = fax_document.fax_resolution
+
+ - if fax_document.document?
+ %p
+ %a{:href => fax_account_fax_document_path(fax_document.fax_account, fax_document, :format => :pdf), :method => :get}
+ %i{:class => 'icon-download'}
+ = t("fax_documents.index.actions.download_pdf") + " (#{number_to_human_size(fax_document.document.size, :precision => 2)})"
+
+ .row
+ .span12
+ - if fax_document.fax_thumbnails.any?
+ %ul.thumbnails
+ - fax_document.fax_thumbnails.limit(50).each do |fax_thumbnail|
+ %li.span4
+ %div.thumbnail
+ %a.thumbnail{:href => fax_thumbnail.thumbnail.url}
+ =image_tag(fax_thumbnail.thumbnail.url, :alt => "Page #{fax_thumbnail.position}")
+ %p
+ = "#{fax_thumbnail.position}/#{fax_document.fax_thumbnails.count}"
+
+ .row
+ .span12
+ = render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => fax_document.fax_account, :child => fax_document } \ No newline at end of file
diff --git a/app/views/fax_documents/show.html.haml b/app/views/fax_documents/show.html.haml
index af5552d..6ae0ee1 100644
--- a/app/views/fax_documents/show.html.haml
+++ b/app/views/fax_documents/show.html.haml
@@ -1,70 +1,6 @@
- content_for :title, t("fax_documents.show.page_title")
-.row
- .span12
- %table.table.table-striped
- - case @fax_document.state
- - when 'unsuccessful'
- - current_status = 'error'
- - when 'sending'
- - current_status = 'success'
- - when 'queued_for_sending'
- - current_status = 'warning'
- - else
- - current_status = ''
-
- %tr{:class => current_status}
- %td
- %strong= t('fax_documents.index.state') + ":"
- %td
- = t("fax_documents.states.#{@fax_document.state}")
- %tr
- %td
- %strong= t('fax_documents.index.result_code') + ":"
- %td
- = @fax_document.result_code
- %tr
- %td
- %strong= t('fax_documents.index.result_text') + ":"
- %td
- = t("fax_documents.result_codes.code_#{@fax_document.result_code}")
- %tr
- %td
- %strong= t('fax_documents.show.document_transferred_pages') + ":"
- %td
- = @fax_document.document_transferred_pages
- %tr
- %td
- %strong= t('fax_documents.show.remote_station_id') + ":"
- %td
- = @fax_document.remote_station_id
- %tr
- %td
- %strong= t('fax_documents.show.fax_resolution') + ":"
- %td
- = @fax_document.fax_resolution
-
- - if @fax_document.document?
- %p
- %a{:href => fax_account_fax_document_path(@fax_account, @fax_document, :format => :pdf), :method => :get}
- %i{:class => 'icon-download'}
- = t("fax_documents.index.actions.download_pdf") + " (#{number_to_human_size(@fax_document.document.size, :precision => 2)})"
-
-.row
- .span12
- - if @fax_document.fax_thumbnails.any?
- %ul.thumbnails
- - @fax_document.fax_thumbnails.limit(50).each do |fax_thumbnail|
- %li.span4
- %div.thumbnail
- %a.thumbnail{:href => fax_thumbnail.thumbnail.url}
- =image_tag(fax_thumbnail.thumbnail.url, :alt => "Page #{fax_thumbnail.position}")
- %p
- = "#{fax_thumbnail.position}/#{@fax_document.fax_thumbnails.count}"
-
-.row
- .span12
- = render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @fax_document.fax_account, :child => @fax_document }
+= render :partial => 'fax_document', :locals => {:fax_document => @fax_document}
- if ['sending', 'queued_for_sending'].include? @fax_document.state
= subscribe_to "/fax_documents/#{@fax_document.id}" \ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 976bac8..c661dfb 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -26,6 +26,8 @@ Gemeinschaft42c::Application.routes.draw do
get "trigger/fax"
end
+ get "trigger/fax_has_been_sent"
+
resources :call_routes do
collection {
post :sort