summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/switchboards_controller.rb1
-rw-r--r--app/views/switchboard_entries/_switchboard_entry.html.haml32
-rw-r--r--app/views/switchboards/show.html.haml29
3 files changed, 34 insertions, 28 deletions
diff --git a/app/controllers/switchboards_controller.rb b/app/controllers/switchboards_controller.rb
index 8f21d5e..98008c1 100644
--- a/app/controllers/switchboards_controller.rb
+++ b/app/controllers/switchboards_controller.rb
@@ -9,6 +9,7 @@ class SwitchboardsController < ApplicationController
def show
@switchboard = @user.switchboards.find(params[:id])
+ @switchboard_entries = @switchboard.switchboard_entries
spread_breadcrumbs
end
diff --git a/app/views/switchboard_entries/_switchboard_entry.html.haml b/app/views/switchboard_entries/_switchboard_entry.html.haml
new file mode 100644
index 0000000..5608757
--- /dev/null
+++ b/app/views/switchboard_entries/_switchboard_entry.html.haml
@@ -0,0 +1,32 @@
+%li.span1{:id => "switchboard_entry_id_#{switchboard_entry.id}"}
+ %div.thumbnail
+ %a.thumbnail{:href => tenant_user_path(switchboard_entry.sip_account.sip_accountable.current_tenant, switchboard_entry.sip_account.sip_accountable)}
+ - if switchboard_entry.sip_account.sip_accountable.image?
+ = image_tag(switchboard_entry.sip_account.sip_accountable.image_url(:mini).to_s, :class => 'img-rounded')
+ - else
+ - if switchboard_entry.sip_account.sip_accountable.male?
+ = image_tag 'icons/user-male-16x.png', :class => 'img-rounded'
+ - else
+ = image_tag 'icons/user-female-16x.png', :class => 'img-rounded'
+ %p
+ %small
+ = truncate(switchboard_entry.to_s, :length => 10)
+ %br
+ - if !switchboard_entry.sip_account.registration
+ %span.label.label-inverse
+ %i.icon-ban-circle.icon-white
+ - else
+ - if switchboard_entry.sip_account.call_legs(:where => ["HELD", "ACTIVE"]).size != 0
+ %span.label.label-success
+ %i.icon-user.icon-white
+ - if switchboard_entry.sip_account.call_legs(:where => ["RINGING"]).size != 0
+ %span.label.label-info
+ %i.icon-bell.icon-white
+ - if switchboard_entry.sip_account.non_e164_phone_numbers.size == 0
+ - phone_numbers = switchboard_entry.sip_account.phone_numbers
+ - else
+ - phone_numbers = switchboard_entry.sip_account.non_e164_phone_numbers
+
+ - phone_numbers.each do |phone_number|
+ %span.label
+ = phone_number.number
diff --git a/app/views/switchboards/show.html.haml b/app/views/switchboards/show.html.haml
index b81980c..18671c2 100644
--- a/app/views/switchboards/show.html.haml
+++ b/app/views/switchboards/show.html.haml
@@ -1,6 +1,5 @@
- content_for :title, @switchboard.name
-
.row
.span12
.well.pull-right
@@ -8,33 +7,7 @@
=current_user
%ul.thumbnails
- - @switchboard.switchboard_entries.each do |switchboard_entry|
- %li.span1
- %div.thumbnail
- %a.thumbnail{:href => tenant_user_path(switchboard_entry.sip_account.sip_accountable.current_tenant, switchboard_entry.sip_account.sip_accountable)}
- - if switchboard_entry.sip_account.sip_accountable.image?
- = image_tag(switchboard_entry.sip_account.sip_accountable.image_url(:mini).to_s, :class => 'img-rounded')
- - else
- - if switchboard_entry.sip_account.sip_accountable.male?
- = image_tag 'icons/user-male-16x.png', :class => 'img-rounded'
- - else
- = image_tag 'icons/user-female-16x.png', :class => 'img-rounded'
- %p
- %small
- = truncate(switchboard_entry.to_s, :length => 10)
- %span{:class => "label #{(switchboard_entry.sip_account.registration ? '' : 'label-inverse')}"}
- - if !switchboard_entry.sip_account.registration
- %i.icon-ban-circle.icon-white
- - if switchboard_entry.sip_account.phone_numbers.count > 1
- - phone_numbers = []
- - switchboard_entry.sip_account.phone_numbers.order(:position).each do |phone_number|
- - if phone_number.number.length < 6
- - phone_numbers << phone_number
- - if phone_numbers.size == 0
- - phone_numbers = switchboard_entry.sip_account.phone_numbers.order(:position)
- - else
- - phone_numbers = switchboard_entry.sip_account.phone_numbers
- = render 'phone_numbers/listing', :phone_numbers => phone_numbers
+ = render :partial => "switchboard_entries/switchboard_entry", :collection => @switchboard_entries
- if can? :edit, @switchboard
.row