summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/views/tenants/_admin_area.html.haml14
-rw-r--r--app/views/tenants/_sip_accounts_and_phones.html.haml68
2 files changed, 13 insertions, 69 deletions
diff --git a/app/views/tenants/_admin_area.html.haml b/app/views/tenants/_admin_area.html.haml
index 627f221..d634f73 100644
--- a/app/views/tenants/_admin_area.html.haml
+++ b/app/views/tenants/_admin_area.html.haml
@@ -1,4 +1,16 @@
-= render :partial => 'tenants/sip_accounts_and_phones', :locals => {:tenant => tenant}
+-# SIP accounts
+-#
+%h2= t('sip_accounts.index.page_title')
+- if tenant.sip_accounts.any?
+ = render "sip_accounts/index_core", :sip_accounts => tenant.sip_accounts
+= render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => SipAccount}
+
+-# Phones
+-#
+%h2= t('phones.index.page_title')
+- if tenant.phones.any?
+ = render "phones/index_core", :phones => tenant.phones
+= render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => Phone}
= render :partial => 'users_table', :locals => {:tenant => tenant}
diff --git a/app/views/tenants/_sip_accounts_and_phones.html.haml b/app/views/tenants/_sip_accounts_and_phones.html.haml
deleted file mode 100644
index bcc2dd6..0000000
--- a/app/views/tenants/_sip_accounts_and_phones.html.haml
+++ /dev/null
@@ -1,68 +0,0 @@
-%table{:class => 'table table-striped'}
- %tr
- %th
- %th= t("sip_accounts.index.page_title")
- %th= t("phones.index.page_title")
-
- - cache(['tenant_show_admin_area_sip_accounts_and_phones_row', I18n.locale, @tenant, @tenant.sip_accounts.count, @tenant.sip_accounts.reorder(:updated_at).last, @tenant.phones.count, @tenant.phones.reorder(:updated_at).last]) do
-
- %tr
- %td= tenant
- - cache(['tenant_show_admin_area_sip_accounts_table_cell', I18n.locale, @tenant, @tenant.sip_accounts.count, @tenant.sip_accounts.reorder(: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}
-
- - cache(['tenant_show_admin_area_phones_table_cell', I18n.locale, @tenant, @tenant.phones.count, @tenant.phones.reorder(: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
- - cache(['tenant_show_tenant_phones', I18n.locale, tenant, tenant.phones]) do
- - 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}
-
- %tr
- %td= t("users.index.page_title")
- %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
- = "-"
-
- %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
- = '-'