summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/phone_numbers_controller.rb17
-rw-r--r--app/views/phone_book_entries/show.html.haml15
2 files changed, 25 insertions, 7 deletions
diff --git a/app/controllers/phone_numbers_controller.rb b/app/controllers/phone_numbers_controller.rb
index 065934c..c562954 100644
--- a/app/controllers/phone_numbers_controller.rb
+++ b/app/controllers/phone_numbers_controller.rb
@@ -77,6 +77,23 @@ class PhoneNumbersController < ApplicationController
redirect_to :back
end
+ def call
+ sip_account = nil
+ current_user.sip_accounts.each do |user_sip_account|
+ if user_sip_account.registration
+ sip_account = user_sip_account
+ break
+ end
+ end
+
+ if can?(:call, @phone_number) && sip_account
+ if ! @phone_number.number.blank?
+ sip_account.call(@phone_number.number)
+ end
+ end
+ redirect_to(:back)
+ end
+
private
def set_and_authorize_parent
@parent = @phone_book_entry || @sip_account || @conference || @fax_account ||
diff --git a/app/views/phone_book_entries/show.html.haml b/app/views/phone_book_entries/show.html.haml
index a9e1e8f..ff43b8a 100644
--- a/app/views/phone_book_entries/show.html.haml
+++ b/app/views/phone_book_entries/show.html.haml
@@ -67,27 +67,28 @@
= @phone_book_entry.description
.widget.phones
- @phone_book_entry.phone_numbers.each do |phone_number|
- - case phone_number.name
+ - case phone_number.name.to_s.downcase
- when /fax/
.fax
- %a= phone_number
+ = link_to phone_number, call_phone_book_entry_phone_number_path(@phone_book_entry, phone_number), :method => :put, :title => t('phone_numbers.show.actions.call')
%span= phone_number.name
- when /home/
.home
- %a= phone_number
- %span= phone_number.name
+ = link_to phone_number, call_phone_book_entry_phone_number_path(@phone_book_entry, phone_number), :method => :put, :title => t('phone_numbers.show.actions.call')
+ %span
- when /mobile/
.cellphone
- %a= phone_number
+ = link_to phone_number, call_phone_book_entry_phone_number_path(@phone_book_entry, phone_number), :method => :put, :title => t('phone_numbers.show.actions.call')
%span= phone_number.name
- when /office/
.office
- %a= phone_number
+ = link_to phone_number, call_phone_book_entry_phone_number_path(@phone_book_entry, phone_number), :method => :put, :title => t('phone_numbers.show.actions.call')
%span= phone_number.name
- else
.phone
- %a= phone_number
+ = link_to phone_number, call_phone_book_entry_phone_number_path(@phone_book_entry, phone_number), :method => :put, :title => t('phone_numbers.show.actions.call')
%span= phone_number.name
+
= link_to t('phone_book_entries.show.manage_phone_numbers'), phone_book_entry_phone_numbers_path(@phone_book_entry)
.widget.adresses