diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/call_route.rb | 11 | ||||
-rw-r--r-- | app/models/sip_account.rb | 2 | ||||
-rw-r--r-- | app/models/sip_registration.rb | 21 | ||||
-rw-r--r-- | app/views/call_routes/_index_core.html.haml | 11 | ||||
-rw-r--r-- | app/views/call_routes/show.html.haml | 11 | ||||
-rw-r--r-- | app/views/fax_accounts/_index_core.html.haml | 6 | ||||
-rw-r--r-- | app/views/sip_accounts/show.html.haml | 7 |
7 files changed, 58 insertions, 11 deletions
diff --git a/app/models/call_route.rb b/app/models/call_route.rb index 28120c1..b4496ab 100644 --- a/app/models/call_route.rb +++ b/app/models/call_route.rb @@ -238,4 +238,15 @@ class CallRoute < ActiveRecord::Base end end end + + def endpoint + if self.endpoint_id.to_i > 0 + begin + return self.endpoint_type.camelize.constantize.where(:id => self.endpoint_id.to_i).first + rescue + return nil + end + end + end + end diff --git a/app/models/sip_account.rb b/app/models/sip_account.rb index d35f9b4..444eb12 100644 --- a/app/models/sip_account.rb +++ b/app/models/sip_account.rb @@ -133,7 +133,7 @@ class SipAccount < ActiveRecord::Base end def registration - return FreeswitchRegistration.where(:reg_user => self.auth_name).first + return SipRegistration.where(:sip_user => self.auth_name).first end def call( phone_number ) diff --git a/app/models/sip_registration.rb b/app/models/sip_registration.rb new file mode 100644 index 0000000..b668301 --- /dev/null +++ b/app/models/sip_registration.rb @@ -0,0 +1,21 @@ +class SipRegistration < ActiveRecord::Base + # Makes sure that this is a readonly model. + def readonly? + return true + end + + # Prevent objects from being destroyed + def before_destroy + raise ActiveRecord::ReadOnlyRecord + end + + # Prevent objects from being deleted + def self.delete_all + raise ActiveRecord::ReadOnlyRecord + end + + # Prevent objects from being deleted + def delete + raise ActiveRecord::ReadOnlyRecord + end +end diff --git a/app/views/call_routes/_index_core.html.haml b/app/views/call_routes/_index_core.html.haml index 2e9238e..f0acebb 100644 --- a/app/views/call_routes/_index_core.html.haml +++ b/app/views/call_routes/_index_core.html.haml @@ -4,7 +4,7 @@ %tr %th= t('call_routes.index.name') %th= t('route_elements.index.pattern') - %th= t('call_routes.index.endpoint_type') + %th= t('call_routes.index.endpoint') %tbody - for call_route in call_routes @@ -18,5 +18,10 @@ = ', ...' - else = '-' - %td= call_route.endpoint_type - =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => call_route}
\ No newline at end of file + %td + - endpoint = call_route.endpoint + - if endpoint + = endpoint + - else + = call_route.endpoint_type + =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => call_route} diff --git a/app/views/call_routes/show.html.haml b/app/views/call_routes/show.html.haml index 70fe13e..09daf53 100644 --- a/app/views/call_routes/show.html.haml +++ b/app/views/call_routes/show.html.haml @@ -7,11 +7,12 @@ %strong= t('call_routes.show.name') + ":" = @call_route.name %p - %strong= t('call_routes.show.endpoint_type') + ":" - = @call_route.endpoint_type -%p - %strong= t('call_routes.show.endpoint_id') + ":" - = @call_route.endpoint_id + %strong= t('call_routes.show.endpoint') + ":" + - endpoint = @call_route.endpoint + - if endpoint + = endpoint + - else + = @call_route.endpoint_type = render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @call_route } diff --git a/app/views/fax_accounts/_index_core.html.haml b/app/views/fax_accounts/_index_core.html.haml index f86a4ac..d694f8f 100644 --- a/app/views/fax_accounts/_index_core.html.haml +++ b/app/views/fax_accounts/_index_core.html.haml @@ -28,9 +28,11 @@ %br = truncate(fax_account.station_id, :length => 20) %td - = link_to fax_account.fax_documents.inbound.count, fax_account_fax_documents_path(fax_account, :anchor => "fax_document_#{fax_account.fax_documents.inbound.first.try(:id)}") + - inbound_documents = fax_account.fax_documents.where(:inbound => true) + - outbound_documents = fax_account.fax_documents.where(:inbound => [false, nil]) + = link_to inbound_documents.count, fax_account_fax_documents_path(fax_account, :anchor => "fax_document_#{inbound_documents.first.try(:id)}") = '/' - = link_to fax_account.fax_documents.outbound.count, fax_account_fax_documents_path(fax_account, :anchor => "fax_document_#{fax_account.fax_documents.outbound.first.try(:id)}") + = link_to outbound_documents.count, fax_account_fax_documents_path(fax_account, :anchor => "fax_document_#{outbound_documents.first.try(:id)}") - if fax_account.fax_documents.any? %br %small diff --git a/app/views/sip_accounts/show.html.haml b/app/views/sip_accounts/show.html.haml index c21b3f4..72e10df 100644 --- a/app/views/sip_accounts/show.html.haml +++ b/app/views/sip_accounts/show.html.haml @@ -55,6 +55,13 @@ %strong= t('sip_accounts.show.expires') + ":" %td = "#{@sip_account.registration.try(:expires) - Time.now.to_i} s" + - if @sip_account.registration.try(:user_agent) + %tr + %td + %strong= t('sip_accounts.show.user_agent') + ":" + %td + = @sip_account.registration.try(:user_agent) + = render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @sip_account.sip_accountable, :child => @sip_account } |