diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/api/v1/phone_book_entries_controller.rb | 3 | ||||
-rw-r--r-- | app/views/switchboards/_form_core.html.haml | 3 |
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 |