summaryrefslogtreecommitdiff
path: root/app/views/tenants/_sip_accounts_and_phones.html.haml
blob: 905912676860a64d32c1ab975a7284b8beb7a0d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
- cache([I18n.locale, tenant, Phone.count, Phone.order(:updated_at).last, PhoneNumber.count, PhoneNumber.order(:updated_at).last, GsParameter.get('NUMBER_OF_SHOWN_ITEMS')]) do
  %table
    %tr{:class => 'even'}
      %th
      %th
        = tenant
      %th= t("users.index.page_title")

    %tr{:class => 'odd'}
      %td= t("sip_accounts.index.page_title")
      - cache([I18n.locale, tenant, tenant.sip_accounts.count, tenant.sip_accounts.order(:updated_at).last]) do
        %td
          - if tenant.sip_accounts.any?
            - if tenant.sip_accounts.count > GsParameter.get('NUMBER_OF_SHOWN_ITEMS')
              = link_to tenant.sip_accounts.count.to_s, tenant_sip_accounts_path(tenant)
            - else
              - tenant.sip_accounts.each do |sip_account|
                = succeed ', ' do
                  =link_to "#{sip_account.caller_name}", tenant_sip_account_path(tenant,sip_account)
                  - if sip_account.phone_numbers.any?
                    = '[' + truncate(sip_account.phone_numbers.map{|phone_number| phone_number.to_s}.join(', '), :length => 25) + ']'
            = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => SipAccount}
      %td
        - if tenant.users_sip_accounts.any?
          - if tenant.users_sip_accounts.count > GsParameter.get('NUMBER_OF_SHOWN_ITEMS')
            = tenant.users_sip_accounts.count
          - else
            - tenant.users_sip_accounts.each do |sip_account|
              - if sip_account != tenant.users_sip_accounts.last
                = succeed ', ' do
                  =link_to "#{sip_account.caller_name}", user_sip_account_path(sip_account.sip_accountable,sip_account)
                  - if sip_account.phone_numbers.any?
                    = '[' + truncate(sip_account.phone_numbers.map{|phone_number| phone_number.to_s}.join(', '), :length => 25) + ']'
              - else
                =link_to "#{sip_account.caller_name}", user_sip_account_path(sip_account.sip_accountable,sip_account)
                - if sip_account.phone_numbers.any?
                  = '[' + truncate(sip_account.phone_numbers.map{|phone_number| phone_number.to_s}.join(', '), :length => 25) + ']'
        - else
          = "-"

    %tr{:class => 'even'}
      %td= t("phones.index.page_title")
      - cache([I18n.locale, tenant, tenant.phones.count, tenant.phones.order(:updated_at).last]) do
        %td
          - if tenant.phones.any?
            - if tenant.phones.count > GsParameter.get('NUMBER_OF_SHOWN_ITEMS')
              = link_to tenant.phones.count.to_s, tenant_phones_path(tenant)
            - else
              - tenant.phones.each do |phone|
                = succeed ', ' do
                  = link_to "#{phone.phone_model.to_s} (#{phone.pretty_mac_address})#{(phone.ip_address.blank? ? '' : " - #{phone.ip_address}")}", tenant_phone_path(tenant, phone)
          = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => Phone}
      %td
        - if tenant.users_phones.any?
          - if tenant.users_phones.count > GsParameter.get('NUMBER_OF_SHOWN_ITEMS')
            = tenant.users_phones.count
          - else
            - tenant.users_phones.each do |phone|
              - if phone != tenant.users_phones.last
                = succeed ', ' do
                  = link_to "#{phone.phone_model.to_s} (#{phone.pretty_mac_address})#{(phone.ip_address.blank? ? '' : " - #{phone.ip_address}")}", user_phone_path(phone.phoneable, phone)
              - else
                = link_to "#{phone.phone_model.to_s} (#{phone.pretty_mac_address})#{(phone.ip_address.blank? ? '' : " - #{phone.ip_address}")}", user_phone_path(phone.phoneable, phone)            
        - else
          = '-'