summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-07-01 12:02:00 +0200
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-07-01 12:02:00 +0200
commit14363079481d3a985060820225b571aefd0e4a04 (patch)
tree8e226e860839bbfd518149eb2ce1db9e1ce1aec9 /app
parent9f23443a86ad145c2739ac289e42ac0f13ef0929 (diff)
Added a reverse lookup switch. closes #295
Diffstat (limited to 'app')
-rw-r--r--app/controllers/api/v1/phone_book_entries_controller.rb3
-rw-r--r--app/views/switchboards/_form_core.html.haml3
2 files changed, 4 insertions, 2 deletions
diff --git a/app/controllers/api/v1/phone_book_entries_controller.rb b/app/controllers/api/v1/phone_book_entries_controller.rb
index cae3259..6a39623 100644
--- a/app/controllers/api/v1/phone_book_entries_controller.rb
+++ b/app/controllers/api/v1/phone_book_entries_controller.rb
@@ -5,13 +5,14 @@ module Api
def index
query = params[:query]
+ switchboard = Switchboard.find(params[:switchboard_id])
return nil if query.blank?
current_ability = Ability.new(current_user)
phone_book_entries = PhoneBookEntry.accessible_by(current_ability)
- if query.match(/^\+?\d+$/) != nil
+ if query.match(/^\+?\d+$/) != nil && switchboard && switchboard.reverse_lookup_activated
# Find by phone number
phone_book_entries_ids = phone_book_entries.map{|entry| entry.id}
found_phone_numbers = PhoneNumber.
diff --git a/app/views/switchboards/_form_core.html.haml b/app/views/switchboards/_form_core.html.haml
index 0bfcb86..db843ad 100644
--- a/app/views/switchboards/_form_core.html.haml
+++ b/app/views/switchboards/_form_core.html.haml
@@ -6,4 +6,5 @@
= f.input :amount_of_displayed_phone_numbers, :label => t('switchboards.form.amount_of_displayed_phone_numbers.label'), :hint => conditional_hint('switchboards.form.amount_of_displayed_phone_numbers.hint')
= f.input :blind_transfer_activated, :label => t('switchboards.form.blind_transfer_activated.label'), :hint => conditional_hint('switchboards.form.blind_transfer_activated.hint')
= f.input :attended_transfer_activated, :label => t('switchboards.form.attended_transfer_activated.label'), :hint => conditional_hint('switchboards.form.attended_transfer_activated.hint')
- = f.input :search_activated, :label => t('switchboards.form.search_activated.label'), :hint => conditional_hint('switchboards.form.search_activated.hint') \ No newline at end of file
+ = f.input :search_activated, :label => t('switchboards.form.search_activated.label'), :hint => conditional_hint('switchboards.form.search_activated.hint')
+ = f.input :reverse_lookup_activated, :label => t('switchboards.form.reverse_lookup_activated.label'), :hint => conditional_hint('switchboards.form.reverse_lookup_activated.hint') \ No newline at end of file