summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-06-27 13:02:28 +0200
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-06-27 13:02:28 +0200
commit7ffb10465ecdbd96fc3c3ba9d8df92485f787e62 (patch)
treef8a93ec49ef5baf7002b10b8c7deff5fd555f69e
parentace935fd2793b09925ab4b8a6b352585b5bdf3d2 (diff)
blind and attended transfer can be configured for each switchboard.
-rw-r--r--app/controllers/switchboards_controller.rb4
-rw-r--r--app/serializers/switchboard_serializer.rb2
-rw-r--r--app/views/switchboards/_form_core.html.haml4
-rw-r--r--app/views/switchboards/show.html.erb8
-rw-r--r--config/locales/views/switchboards/de.yml13
-rw-r--r--config/locales/views/switchboards/en.yml10
-rw-r--r--db/migrate/20130627103456_add_blind_transfer_to_switchboard.rb17
-rw-r--r--public/js/app.js4
8 files changed, 55 insertions, 7 deletions
diff --git a/app/controllers/switchboards_controller.rb b/app/controllers/switchboards_controller.rb
index 3e2f8d6..d162a85 100644
--- a/app/controllers/switchboards_controller.rb
+++ b/app/controllers/switchboards_controller.rb
@@ -19,6 +19,8 @@ class SwitchboardsController < ApplicationController
@switchboard.entry_width = 2
@switchboard.reload_interval = 2000
@switchboard.amount_of_displayed_phone_numbers = 1
+ @switchboard.blind_transfer_activated = true
+ @switchboard.attended_transfer_activated = false
spread_breadcrumbs
end
@@ -56,7 +58,7 @@ class SwitchboardsController < ApplicationController
private
def switchboard_params
- params.require(:switchboard).permit(:name, :reload_interval, :show_avatars, :entry_width, :amount_of_displayed_phone_numbers)
+ params.require(:switchboard).permit(:name, :reload_interval, :show_avatars, :entry_width, :amount_of_displayed_phone_numbers, :blind_transfer_activated, :attended_transfer_activated)
end
def spread_breadcrumbs
diff --git a/app/serializers/switchboard_serializer.rb b/app/serializers/switchboard_serializer.rb
index 7c21f82..c1cc0fe 100644
--- a/app/serializers/switchboard_serializer.rb
+++ b/app/serializers/switchboard_serializer.rb
@@ -1,7 +1,7 @@
class SwitchboardSerializer < ActiveModel::Serializer
embed :ids, :include => true
- attributes :id, :name
+ attributes :id, :name, :blind_transfer_activated, :attended_transfer_activated
has_many :switchboard_entries
has_many :sip_accounts, :through => :switchboard_entries
has_many :phone_numbers
diff --git a/app/views/switchboards/_form_core.html.haml b/app/views/switchboards/_form_core.html.haml
index 2258640..a4fd15f 100644
--- a/app/views/switchboards/_form_core.html.haml
+++ b/app/views/switchboards/_form_core.html.haml
@@ -3,4 +3,6 @@
= f.input :reload_interval, :label => t('switchboards.form.reload_interval.label'), :hint => conditional_hint('switchboards.form.reload_interval.hint')
= f.input :show_avatars, :label => t('switchboards.form.show_avatars.label'), :hint => conditional_hint('switchboards.form.show_avatars.hint')
= f.input :entry_width, :label => t('switchboards.form.entry_width.label'), :hint => conditional_hint('switchboards.form.entry_width.hint')
- = 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') \ No newline at end of file
+ = 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')
diff --git a/app/views/switchboards/show.html.erb b/app/views/switchboards/show.html.erb
index 1952a3c..61adde7 100644
--- a/app/views/switchboards/show.html.erb
+++ b/app/views/switchboards/show.html.erb
@@ -59,8 +59,12 @@
{{#if dispatchableIncomingCalls.length}}
<p>
{{#each dispatchableIncomingCall in dispatchableIncomingCalls}}
- <button {{action transfer_blind dispatchableIncomingCall.id phoneNumber.number}} class="btn btn-small">Transfer</button>
- <button {{action transfer_attended dispatchableIncomingCall.id phoneNumber.number}} class="btn btn-small">Attended Transfer</button>
+ {{#if switchboardEntry.switchboard.blind_transfer_activated}}
+ <button {{action transfer_blind dispatchableIncomingCall.id phoneNumber.number}} class="btn btn-small">Transfer</button>
+ {{/if}}
+ {{#if switchboardEntry.switchboard.attended_transfer_activated}}
+ <button {{action transfer_attended dispatchableIncomingCall.id phoneNumber.number}} class="btn btn-small">Attended Transfer</button>
+ {{/if}}
{{/each}}
</p>
{{/if}}
diff --git a/config/locales/views/switchboards/de.yml b/config/locales/views/switchboards/de.yml
index 1f66b9f..d86a656 100644
--- a/config/locales/views/switchboards/de.yml
+++ b/config/locales/views/switchboards/de.yml
@@ -13,6 +13,8 @@ de:
show_avatars: 'Show avatars'
entry_width: 'Entry width'
amount_of_displayed_phone_numbers: 'Anzahl der angezeigten Telefonnummern'
+ blind_transfer_activated: 'Transfer'
+ attended_transfer_activated: 'Transfer mit Rückfrage'
actions:
confirm_destroy: 'Sind Sie sicher, dass Sie folgendes löschen möchten: Switchboard'
destroy: 'Löschen'
@@ -28,6 +30,8 @@ de:
show_avatars: 'Show avatars'
entry_width: 'Entry width'
amount_of_displayed_phone_numbers: 'Anzahl der angezeigten Telefonnummern'
+ blind_transfer_activated: 'Transfer'
+ attended_transfer_activated: 'Transfer mit Rückfrage'
actions:
confirm_destroy: 'Sind Sie sicher, dass die dieses Element löschen möchten?'
destroy: 'Löschen'
@@ -61,5 +65,12 @@ de:
hint: '1 - 4'
amount_of_displayed_phone_numbers:
label: 'Anzahl Telefonnummern'
- hint: 'Wie viel Telefonnummern werden in einem Eintrag angezeigt.'
+ hint: 'Wie viel Telefonnummern werden in einem Eintrag angezeigt.'
+ blind_transfer_activated:
+ label: 'Transfer'
+ hint: ''
+ attended_transfer_activated:
+ label: 'Transfer mit Rückfrage'
+ hint: 'Funktioniert nicht mit allen Telefonen.'
+
submit: 'Absenden' \ No newline at end of file
diff --git a/config/locales/views/switchboards/en.yml b/config/locales/views/switchboards/en.yml
index fd160b5..6a5dd6f 100644
--- a/config/locales/views/switchboards/en.yml
+++ b/config/locales/views/switchboards/en.yml
@@ -13,6 +13,8 @@ en:
show_avatars: 'Show avatars'
entry_width: 'Entry width'
amount_of_displayed_phone_numbers: 'Amount of displayed phone numbers'
+ blind_transfer_activated: 'Blind Transfer'
+ attended_transfer_activated: 'Attended Transfer'
actions:
confirm_destroy: 'Are you sure you want to delete this Switchboard?'
destroy: 'Delete'
@@ -28,6 +30,8 @@ en:
show_avatars: 'Show avatars'
entry_width: 'Entry width'
amount_of_displayed_phone_numbers: 'Amount of displayed phone numbers'
+ blind_transfer_activated: 'Blind Transfer'
+ attended_transfer_activated: 'Attended Transfer'
actions:
confirm_destroy: 'Are you sure you want to delete this element?'
destroy: 'Delete'
@@ -62,4 +66,10 @@ en:
amount_of_displayed_phone_numbers:
label: 'Amount of phone numbers'
hint: 'How many phone numbers should be displayed for a single entry.'
+ blind_transfer_activated:
+ label: 'Blind Transfer'
+ hint: ''
+ attended_transfer_activated:
+ label: 'Attended Transfer'
+ hint: 'Does not work with all phone models.'
submit: 'Submit' \ No newline at end of file
diff --git a/db/migrate/20130627103456_add_blind_transfer_to_switchboard.rb b/db/migrate/20130627103456_add_blind_transfer_to_switchboard.rb
new file mode 100644
index 0000000..a947a51
--- /dev/null
+++ b/db/migrate/20130627103456_add_blind_transfer_to_switchboard.rb
@@ -0,0 +1,17 @@
+class AddBlindTransferToSwitchboard < ActiveRecord::Migration
+ def up
+ add_column :switchboards, :blind_transfer_activated, :boolean
+ add_column :switchboards, :attended_transfer_activated, :boolean
+
+ Switchboard.all.each do |switchboard|
+ switchboard.blind_transfer_activated = true
+ switchboard.attended_transfer_activated = true
+ switchboard.save
+ end
+ end
+
+ def down
+ remove_column :switchboards, :blind_transfer_activated
+ remove_column :switchboards, :attended_transfer_activated
+ end
+end
diff --git a/public/js/app.js b/public/js/app.js
index 6d4ba65..5b7469a 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -52,7 +52,9 @@ App.Switchboard = DS.Model.extend({
switchboardEntrys: DS.hasMany('App.SwitchboardEntry'),
activeCalls: DS.hasMany('App.ActiveCall'),
dispatchableIncomingCalls: DS.hasMany('App.DispatchableIncomingCall'),
- name: DS.attr('string')
+ name: DS.attr('string'),
+ blind_transfer_activated: DS.attr('boolean'),
+ attended_transfer_activated: DS.attr('boolean')
});
App.SwitchboardEntry = DS.Model.extend({