From 49738b091eea2ca65d6f8c71b88747e314ec2950 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Thu, 10 Jan 2013 22:44:10 +0100 Subject: Refactoring and adding some caches. --- app/views/tenants/_admin_area.de.html.haml | 118 +++++++---------------------- 1 file changed, 29 insertions(+), 89 deletions(-) (limited to 'app/views/tenants/_admin_area.de.html.haml') diff --git a/app/views/tenants/_admin_area.de.html.haml b/app/views/tenants/_admin_area.de.html.haml index 3c9440b..c3411bc 100644 --- a/app/views/tenants/_admin_area.de.html.haml +++ b/app/views/tenants/_admin_area.de.html.haml @@ -1,95 +1,35 @@ -%p - Sie sind Mitglied der - = link_to 'Admin Gruppe', tenant_user_group_path(@tenant, @tenant.user_groups.find_by_name('Admins')) - und haben deshalb besondere Rechte. Aber wie Peter Parker schon sagte: "With great power comes great responsibility." +- cache([I18n.locale, @tenant, UserGroup.count, UserGroup.order(:updated_at).last, User.count, User.order(:updated_at).last, Manufacturer.count, Manufacturer.order(:updated_at).last, PhoneModel.count]) do + %p + Sie sind Mitglied der + = link_to 'Admin Gruppe', tenant_user_group_path(@tenant, @tenant.user_groups.find_by_name('Admins')) + und haben deshalb besondere Rechte. Aber wie Peter Parker schon sagte: "With great power comes great responsibility." -%p - Dieser Mandant hat - = link_to pluralize(@tenant.user_groups.count, 'user group'), tenant_user_groups_path(@tenant) - - if @tenant.user_groups.count < 5 - = "(#{@tenant.user_groups.order(:name).map{|group| group.to_s }.join(', ')})" - die in Summe - = link_to pluralize(@tenant.users.count, 'user'), tenant_users_path(@tenant) - verwalten. - Das System kann - = PhoneModel.count - verschiedene Telefonmodelle von den folgenden Herstellern verwalten: - - Manufacturer.all.each do |manufacturer| - - if manufacturer != Manufacturer.last && manufacturer != Manufacturer.limit(Manufacturer.count - 1).last - = succeed ', ' do - =link_to manufacturer, manufacturer_path(manufacturer) - - elsif manufacturer == Manufacturer.limit(Manufacturer.count - 1).last - = succeed ' und ' do - =link_to manufacturer, manufacturer_path(manufacturer) - - else - = succeed '.' do - =link_to manufacturer, manufacturer_path(manufacturer) + %p + = @tenant + hat + = link_to pluralize(@tenant.user_groups.count, 'user group'), tenant_user_groups_path(@tenant) + - if @tenant.user_groups.count < 5 + = "(#{@tenant.user_groups.order(:name).map{|group| group.to_s }.join(', ')})" + die in Summe + = link_to pluralize(@tenant.users.count, 'user'), tenant_users_path(@tenant) + verwalten. + Das System kann + = PhoneModel.count + verschiedene Telefonmodelle von den folgenden Herstellern verwalten: + - Manufacturer.all.each do |manufacturer| + - if manufacturer != Manufacturer.last && manufacturer != Manufacturer.limit(Manufacturer.count - 1).last + = succeed ', ' do + =link_to manufacturer, manufacturer_path(manufacturer) + - elsif manufacturer == Manufacturer.limit(Manufacturer.count - 1).last + = succeed ' und ' do + =link_to manufacturer, manufacturer_path(manufacturer) + - else + = succeed '.' do + =link_to manufacturer, manufacturer_path(manufacturer) = render :partial => 'tenants/sip_accounts_and_phones', :locals => {:tenant => @tenant} -%h3 Allgemein += render :partial => 'tenants/table_of_functions', :locals => {:tenant => @tenant} -%table - %tr{:class => 'even'} - %th - Funktion - %th - Anzahl - %th - %tr{:class => 'odd'} - %td - Callthrough - %td - = link_to @tenant.callthroughs.count.to_s, tenant_callthroughs_path(@tenant) - %td - = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => Callthrough} - %tr{:class => 'even'} - %td - Konferenzen - %td - = link_to @tenant.conferences.count.to_s, tenant_conferences_path(@tenant) - %td - = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => Conference} - %tr{:class => 'odd'} - %td - Rufgruppen - %td - = link_to @tenant.hunt_groups.count.to_s, tenant_hunt_groups_path(@tenant) - %td - = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => HuntGroup} - %tr{:class => 'even'} - %td - Warteschleifen - %td - = link_to @tenant.automatic_call_distributors.count.to_s, tenant_automatic_call_distributors_path(@tenant) - %td - = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => AutomaticCallDistributor} - %tr{:class => 'odd'} - %td - Oberflächen-Funktionen - %td - = link_to GuiFunction.count.to_s, gui_functions_path - %td += render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => @tenant} --# Phone books --# -- if GuiFunction.display?('show_phone_books_in_user_show_view', current_user) - - if can?( :index, PhoneBook ) - %h2=t("phone_books.index.page_title") - = render "phone_books/index_core", :phone_books => @tenant.phone_books - = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => PhoneBook} - -- if GsParameter.get('STRICT_INTERNAL_EXTENSION_HANDLING') == true - %h3= t('phone_number_ranges.index.page_title') - - - if @tenant.created_at > (Time.now - 15.minutes) && Delayed::Job.count > 0 && @tenant.phone_number_ranges.find_by_name(GsParameter.get('INTERNAL_EXTENSIONS')).try(:phone_numbers).try(:count).to_i == 0 - Der Mandant - = "\"#{@tenant}\"" - wurde erst vor - = distance_of_time_in_words_to_now(@tenant.created_at) - erstellt. Es gibt immer noch nicht abgeschlossene - = pluralize(Delayed::Job.count, 'Hintergrundprozesse') - \. Bitte warten Sie noch ein paar Minuten und laden anschließend diese Seite erneut. - - else - =render 'phone_number_ranges/index_core', :phone_number_ranges => (@tenant.phone_number_ranges + @tenant.country.phone_number_ranges.where(:name => GsParameter.get('SERVICE_NUMBERS'))) - =render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => PhoneNumberRange} -- cgit v1.2.3