From f0932e38b890b08397020a5994ddde7110d7b8db Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sun, 10 Mar 2013 10:50:49 +0100 Subject: refactoring --- .../_switchboard_entry.html.haml | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 app/views/switchboard_entries/_switchboard_entry.html.haml (limited to 'app/views/switchboard_entries/_switchboard_entry.html.haml') 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..2902a83 --- /dev/null +++ b/app/views/switchboard_entries/_switchboard_entry.html.haml @@ -0,0 +1,26 @@ +%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) + %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 -- cgit v1.2.3 From 63339834ec520efae48f16f4d16b90d74e7bcdfd Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sun, 10 Mar 2013 12:36:25 +0100 Subject: Added labels with the current status. --- .../_switchboard_entry.html.haml | 30 +++++++++++++--------- 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'app/views/switchboard_entries/_switchboard_entry.html.haml') diff --git a/app/views/switchboard_entries/_switchboard_entry.html.haml b/app/views/switchboard_entries/_switchboard_entry.html.haml index 2902a83..5608757 100644 --- a/app/views/switchboard_entries/_switchboard_entry.html.haml +++ b/app/views/switchboard_entries/_switchboard_entry.html.haml @@ -11,16 +11,22 @@ %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 + %br + - if !switchboard_entry.sip_account.registration + %span.label.label-inverse %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 + - 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 -- cgit v1.2.3 From b9aeac77779f7a9ae0e51b8d95adc7d542e09ece Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sun, 10 Mar 2013 18:32:13 +0100 Subject: Small fixes. --- app/views/switchboard_entries/_switchboard_entry.html.haml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'app/views/switchboard_entries/_switchboard_entry.html.haml') diff --git a/app/views/switchboard_entries/_switchboard_entry.html.haml b/app/views/switchboard_entries/_switchboard_entry.html.haml index 5608757..8d8e747 100644 --- a/app/views/switchboard_entries/_switchboard_entry.html.haml +++ b/app/views/switchboard_entries/_switchboard_entry.html.haml @@ -21,12 +21,7 @@ %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| + %i.icon-bell.icon-white + - if switchboard_entry.sip_account.phone_numbers.any? %span.label - = phone_number.number + = switchboard_entry.sip_account.phone_numbers.first.number -- cgit v1.2.3