summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/views/tenants/_admin_area.de.html.haml25
-rw-r--r--app/views/tenants/_admin_area.html.haml25
-rw-r--r--app/views/tenants/_sip_accounts_and_phones.html.haml65
-rw-r--r--db/migrate/20130110205056_add_number_of_shown_items_to_gs_parameter.rb9
-rw-r--r--db/schema.rb2
5 files changed, 77 insertions, 49 deletions
diff --git a/app/views/tenants/_admin_area.de.html.haml b/app/views/tenants/_admin_area.de.html.haml
index d125e58..3c9440b 100644
--- a/app/views/tenants/_admin_area.de.html.haml
+++ b/app/views/tenants/_admin_area.de.html.haml
@@ -25,30 +25,7 @@
= succeed '.' do
=link_to manufacturer, manufacturer_path(manufacturer)
-%h3 SIP-Konten und Telefone
-
-%table
- %tr{:class => 'even'}
- %th
- %th
- = @tenant
- %th
- Alle Benutzer von
- = "\"#{@tenant}\""
- %tr{:class => 'odd'}
- %td
- SIP-Konten
- %td
- = link_to @tenant.sip_accounts.count.to_s, tenant_sip_accounts_path(@tenant)
- = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => SipAccount}
- %td= @tenant.users_sip_accounts.count.to_s
- %tr{:class => 'even'}
- %td
- Telefone
- %td
- = link_to @tenant.phones.count.to_s, tenant_phones_path(@tenant)
- = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => Phone}
- %td= @tenant.users_phones.count.to_s
+= render :partial => 'tenants/sip_accounts_and_phones', :locals => {:tenant => @tenant}
%h3 Allgemein
diff --git a/app/views/tenants/_admin_area.html.haml b/app/views/tenants/_admin_area.html.haml
index afd50b5..c838a18 100644
--- a/app/views/tenants/_admin_area.html.haml
+++ b/app/views/tenants/_admin_area.html.haml
@@ -25,30 +25,7 @@
= succeed '.' do
=link_to manufacturer, manufacturer_path(manufacturer)
-%h3 SIP-Accounts and Phones
-
-%table
- %tr{:class => 'even'}
- %th
- %th
- = @tenant
- %th
- All users of
- = "\"#{@tenant}\""
- %tr{:class => 'odd'}
- %td
- SIP accounts
- %td
- = link_to @tenant.sip_accounts.count.to_s, tenant_sip_accounts_path(@tenant)
- = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => SipAccount}
- %td= @tenant.users_sip_accounts.count.to_s
- %tr{:class => 'even'}
- %td
- Phones
- %td
- = link_to @tenant.phones.count.to_s, tenant_phones_path(@tenant)
- = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => Phone}
- %td= @tenant.users_phones.count.to_s
+= render :partial => 'tenants/sip_accounts_and_phones', :locals => {:tenant => @tenant}
%h3 Misc
diff --git a/app/views/tenants/_sip_accounts_and_phones.html.haml b/app/views/tenants/_sip_accounts_and_phones.html.haml
new file mode 100644
index 0000000..9059126
--- /dev/null
+++ b/app/views/tenants/_sip_accounts_and_phones.html.haml
@@ -0,0 +1,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
+ = '-' \ No newline at end of file
diff --git a/db/migrate/20130110205056_add_number_of_shown_items_to_gs_parameter.rb b/db/migrate/20130110205056_add_number_of_shown_items_to_gs_parameter.rb
new file mode 100644
index 0000000..72b477a
--- /dev/null
+++ b/db/migrate/20130110205056_add_number_of_shown_items_to_gs_parameter.rb
@@ -0,0 +1,9 @@
+class AddNumberOfShownItemsToGsParameter < ActiveRecord::Migration
+ def up
+ GsParameter.create(:name => 'NUMBER_OF_SHOWN_ITEMS', :section => 'Views', :value => '10', :class_type => 'Integer')
+ end
+
+ def down
+ GsParameter.where(:name => 'NUMBER_OF_SHOWN_ITEMS').destroy_all
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 40326a6..2c14be3 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130109182800) do
+ActiveRecord::Schema.define(:version => 20130110205056) do
create_table "access_authorizations", :force => true do |t|
t.string "access_authorizationable_type"