summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/api/v1/calls_controller.rb24
-rw-r--r--app/controllers/switchboard_entries_controller.rb2
-rw-r--r--app/views/switchboard_entries/_form_core.html.haml1
-rw-r--r--app/views/switchboard_entries/show.html.haml5
-rw-r--r--app/views/switchboards/show.html.erb22
5 files changed, 42 insertions, 12 deletions
diff --git a/app/controllers/api/v1/calls_controller.rb b/app/controllers/api/v1/calls_controller.rb
new file mode 100644
index 0000000..e6fbed4
--- /dev/null
+++ b/app/controllers/api/v1/calls_controller.rb
@@ -0,0 +1,24 @@
+module Api
+ module V1
+ class CallsController < ApplicationController
+ respond_to :json
+
+ def index
+ @calls = Call.limit(10)
+
+ respond_with @calls
+ end
+
+ def show
+ @call = Call.find(params[:id])
+
+ if params[:transfer_blind]
+ @call.transfer_blind(params[:transfer_blind])
+ end
+
+ respond_with @call
+ end
+
+ end
+ end
+end
diff --git a/app/controllers/switchboard_entries_controller.rb b/app/controllers/switchboard_entries_controller.rb
index ef6c72e..5b41816 100644
--- a/app/controllers/switchboard_entries_controller.rb
+++ b/app/controllers/switchboard_entries_controller.rb
@@ -58,7 +58,7 @@ class SwitchboardEntriesController < ApplicationController
private
def switchboard_entry_params
- params.require(:switchboard_entry).permit(:name, :sip_account_id)
+ params.require(:switchboard_entry).permit(:name, :sip_account_id, :switchable)
end
def spread_breadcrumbs
diff --git a/app/views/switchboard_entries/_form_core.html.haml b/app/views/switchboard_entries/_form_core.html.haml
index 6f340c2..2caaba5 100644
--- a/app/views/switchboard_entries/_form_core.html.haml
+++ b/app/views/switchboard_entries/_form_core.html.haml
@@ -1,3 +1,4 @@
.inputs
= f.association :sip_account, :collection => @sip_accounts, :label => t('switchboard_entries.form.sip_account_id.label'), :hint => conditional_hint('switchboard_entries.form.sip_account_id.hint'), :autofocus => true, :include_blank => false
= f.input :name, :label => t('switchboard_entries.form.name.label'), :hint => conditional_hint('switchboard_entries.form.name.hint')
+ = f.input :switchable, :as => :boolean, :label => t('switchboard_entries.form.switchable.label'), :hint => conditional_hint('switchboard_entries.form.switchable.hint') \ No newline at end of file
diff --git a/app/views/switchboard_entries/show.html.haml b/app/views/switchboard_entries/show.html.haml
index b519781..85b8166 100644
--- a/app/views/switchboard_entries/show.html.haml
+++ b/app/views/switchboard_entries/show.html.haml
@@ -18,5 +18,10 @@
%strong= t('switchboard_entries.show.position') + ":"
%td
= @switchboard_entry.position
+ %tr
+ %td
+ %strong= t('switchboard_entries.show.switchable') + ":"
+ %td
+ = @switchboard_entry.switchable
= render :partial => 'shared/show_edit_destroy_part', :locals => {:parent => @switchboard, :child => @switchboard_entry } \ No newline at end of file
diff --git a/app/views/switchboards/show.html.erb b/app/views/switchboards/show.html.erb
index 2a2765f..4877613 100644
--- a/app/views/switchboards/show.html.erb
+++ b/app/views/switchboards/show.html.erb
@@ -26,16 +26,27 @@
{{avatar_img switchboardEntry.avatar_src}}
<small>
<p>
+ {{#if switchboardEntry.name}}
<span class="label">{{switchboardEntry.name}}</span>
+ {{/if}}
{{#each phoneNumber in switchboardEntry.sipAccount.phoneNumberShortList}}
<span class="label">
{{phoneNumber.number}}
</span>
+
+ {{#if activeCalls.length}}
+ <p>
+ {{#each activeCall in activeCalls}}
+ <button {{action transfer_blind activeCall.id phoneNumber.number}} class="btn btn-small">Blind Transfer ({{activeCall.b_caller_id_number}})</button>
+ {{/each}}
+ </p>
+ {{/if}}
{{/each}}
</p>
{{show_callstate switchboardEntry.callstate}}
+
{{#if switchboardEntry.sipAccount.calls.length}}
<p>
Anrufe:
@@ -51,17 +62,6 @@
</p>
{{/if}}
- {{#if activeCalls.length}}
- <p>
- Verbinden mit:
- <br>
- {{#each activeCall in activeCalls}}
- <button {{action blind_transfer}}>
- {{activeCall.b_caller_id_number}}
- </button>
- {{/each}}
- </p>
- {{/if}}
</small>
</div>
</li>