diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-01-15 22:43:03 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-01-15 22:43:03 +0100 |
commit | 4efaf6c14338bd3b63b2aa4a25f1813e25fc5de7 (patch) | |
tree | 4fedffdfcad5a9826b889a6cf4e00006c0e8ce86 | |
parent | 0820f0e79a28aaa22ff98e969cd202ed422298ff (diff) | |
parent | 8d622f127f8d951c50bbf3fd0921626fd3746dae (diff) |
Merge branch 'optimize_caching' into develop
-rw-r--r-- | app/views/tenants/_sip_accounts_and_phones.html.haml | 64 | ||||
-rw-r--r-- | app/views/tenants/show.html.haml | 15 | ||||
-rw-r--r-- | config/locales/views/users/de.yml | 34 |
3 files changed, 59 insertions, 54 deletions
diff --git a/app/views/tenants/_sip_accounts_and_phones.html.haml b/app/views/tenants/_sip_accounts_and_phones.html.haml index c698fef..e322b67 100644 --- a/app/views/tenants/_sip_accounts_and_phones.html.haml +++ b/app/views/tenants/_sip_accounts_and_phones.html.haml @@ -1,24 +1,40 @@ %table %tr{:class => 'even'} %th - %th - = tenant - %th= t("users.index.page_title") + %th= t("sip_accounts.index.page_title") + %th= t("phones.index.page_title") - %tr{:class => 'odd'} - %td= t("sip_accounts.index.page_title") - %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 - - cache(['tenant_show_tenant_sip_accounts',I18n.locale, tenant, tenant.sip_accounts, PhoneNumber.where(:phone_numberable_type => 'SipAccount').where(:id => tenant.sip_account_ids)]) do - - 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_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{:class => 'odd'} + %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_sip_accounts_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{:class => 'even'} + %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') @@ -37,18 +53,6 @@ - else = "-" - %tr{:class => 'even'} - %td= t("phones.index.page_title") - %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} %td - if tenant.users_phones.any? - if tenant.users_phones.count > GsParameter.get('NUMBER_OF_SHOWN_ITEMS') @@ -61,4 +65,4 @@ - 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/app/views/tenants/show.html.haml b/app/views/tenants/show.html.haml index cb2b895..10845cf 100644 --- a/app/views/tenants/show.html.haml +++ b/app/views/tenants/show.html.haml @@ -1,14 +1,15 @@ - title t("tenants.show.page_title") -%p - %strong= t('tenants.show.name') + ":" - = @tenant.name -- if !@tenant.description.blank? +- cache(['tenant_show_name_and_description', I18n.locale, @tenant, current_user]) do %p - %strong= t('tenants.show.description') + ":" - = @tenant.description + %strong= t('tenants.show.name') + ":" + = @tenant.name + - if !@tenant.description.blank? + %p + %strong= t('tenants.show.description') + ":" + = @tenant.description -= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @tenant } + = render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @tenant } - if @tenant.user_groups.where(:name => 'Admins').count > 0 && @tenant.user_groups.where(:name => 'Admins').first.users.include?(current_user) = render 'admin_area'
\ No newline at end of file diff --git a/config/locales/views/users/de.yml b/config/locales/views/users/de.yml index 951600d..e4a0ae2 100644 --- a/config/locales/views/users/de.yml +++ b/config/locales/views/users/de.yml @@ -1,15 +1,15 @@ de: users: - name: "Benutzer" + name: "User" controller: - successfuly_created: 'Der Benutzer %{resource} wurde erstellt.' - successfuly_created_and_login: 'Der Benutzer %{resource} wurde erstellt. Sie sind jetzt als dieser Benutzer angemeldet.' - successfuly_updated: 'Benutzer-Daten aktualisiert.' - successfuly_destroyed: 'Der Benutzer wurde gelöscht.' + successfuly_created: 'Der User %{resource} wurde erstellt.' + successfuly_created_and_login: 'Der User %{resource} wurde erstellt. Sie sind jetzt als dieser User angemeldet.' + successfuly_updated: 'User-Daten aktualisiert.' + successfuly_destroyed: 'Der User wurde gelöscht.' avatar_destroyed: 'Der Avatar wurde gelöscht.' index: - page_title: 'Benutzer' - user_name: 'Benutzer-Name' + page_title: 'User' + user_name: 'User-Name' email: 'E-Mail Adresse' first_name: 'Vorname' middle_name: 'Zweiter Vorname' @@ -20,15 +20,15 @@ de: language_id: 'Sprache' send_voicemail_as_email_attachment: 'Sprachnachrichten per E-Mail' actions: - confirm: 'Sind Sie sicher, dass Sie diesen Benutzer löschen möchten?' + confirm: 'Sind Sie sicher, dass Sie diesen User löschen möchten?' destroy: 'Löschen' edit: 'Bearbeiten' show: 'Anzeigen' - create: 'Neuen Benutzer anlegen' - create_for: 'Neuen Benutzer für %{resource} anlegen' + create: 'Neuen User anlegen' + create_for: 'Neuen User für %{resource} anlegen' show: - page_title: 'Benutzer anzeigen' - user_name: 'Benutzer-Name' + page_title: 'User anzeigen' + user_name: 'User-Name' email: 'E-Mail Adresse' first_name: 'Vorname' middle_name: 'Zweiter Vorname' @@ -39,17 +39,17 @@ de: language_id: 'Sprache' send_voicemail_as_email_attachment: 'Sprachnachrichten per E-Mail' actions: - confirm: 'Sind Sie sicher, dass Sie diesen Benutzer löschen möchten?' + confirm: 'Sind Sie sicher, dass Sie diesen User löschen möchten?' destroy: 'Löschen' edit: 'Bearbeiten' - view_all: 'Alle Benutzer anzeigen' + view_all: 'Alle User anzeigen' new: - page_title: 'Neuen Benutzer anlegen' + page_title: 'Neuen User anlegen' edit: - page_title: 'Benutzer %{resource} bearbeiten' + page_title: 'User %{resource} bearbeiten' form: user_name: - label: 'Benutzer-Name' + label: 'User-Name' hint: '' email: label: 'E-Mail Adresse' |