summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/serializers/sip_account_serializer.rb10
-rw-r--r--app/views/switchboards/show.html.erb79
2 files changed, 56 insertions, 33 deletions
diff --git a/app/serializers/sip_account_serializer.rb b/app/serializers/sip_account_serializer.rb
index aa749b0..7465a17 100644
--- a/app/serializers/sip_account_serializer.rb
+++ b/app/serializers/sip_account_serializer.rb
@@ -1,7 +1,15 @@
class SipAccountSerializer < ActiveModel::Serializer
embed :ids, :include => true
- attributes :id, :auth_name, :caller_name, :sip_accountable_id
+ attributes :id, :auth_name, :caller_name, :sip_accountable_id, :is_registrated
has_many :phone_numbers
has_many :calls
+
+ def is_registrated
+ if object.registration
+ true
+ else
+ false
+ end
+ end
end
diff --git a/app/views/switchboards/show.html.erb b/app/views/switchboards/show.html.erb
index b390ce5..1952a3c 100644
--- a/app/views/switchboards/show.html.erb
+++ b/app/views/switchboards/show.html.erb
@@ -40,44 +40,59 @@
</p>
{{/if}}
- {{#if switchboardEntry.switchable}}
- <p>
- {{#each phoneNumber in switchboardEntry.sipAccount.phoneNumberShortList}}
- <span class="label">
- {{phoneNumber.number}}
- </span>
- {{/each}}
- </p>
- {{else}}
- <p>
+ {{#if switchboardEntry.sipAccount.is_registrated}}
+ {{#if switchboardEntry.switchable}}
+ <p>
+ {{#each phoneNumber in switchboardEntry.sipAccount.phoneNumberShortList}}
+ <span class="label">
+ {{phoneNumber.number}}
+ </span>
+ {{/each}}
+ </p>
+ {{else}}
+ <p>
+ {{#each phoneNumber in switchboardEntry.sipAccount.phoneNumberShortList}}
+ <span class="label">
+ {{phoneNumber.number}}
+ </span>
+
+ {{#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>
+ {{/each}}
+ </p>
+ {{/if}}
+ {{/each}}
+ </p>
+ {{/if}}
+
+ {{#if switchboardEntry.sipAccount.calls.length}}
+ <p>
+ {{#each call in switchboardEntry.sipAccount.calls}}
+ <span {{bindAttr class=":label call.isRinging:label-warning:label-success"}}>
+ {{#if call.isRinging}}<i class="icon-bell icon-white"></i>{{/if}}
+ von {{call.b_caller_id_number}} an {{call.destination}}
+ </span>
+ {{/each}}
+ </p>
+ {{/if}}
+ {{else}}
+ <p>
{{#each phoneNumber in switchboardEntry.sipAccount.phoneNumberShortList}}
<span class="label">
{{phoneNumber.number}}
</span>
-
- {{#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>
- {{/each}}
- </p>
- {{/if}}
{{/each}}
- </p>
- {{/if}}
-
- {{#if switchboardEntry.sipAccount.calls.length}}
- <p>
- {{#each call in switchboardEntry.sipAccount.calls}}
- <span {{bindAttr class=":label call.isRinging:label-warning:label-success"}}>
- {{#if call.isRinging}}<i class="icon-bell icon-white"></i>{{/if}}
- von {{call.b_caller_id_number}} an {{call.destination}}
- </span>
- {{/each}}
- </p>
- {{/if}}
+ </p>
+ <p>
+ <span class="label label-warning">
+ offline
+ </span>
+ </p>
+ {{/if}}
</small>
</div>
</li>