From ddb3dfa92ec0878240211cb2b7a8e125961b1360 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sat, 5 Jan 2013 23:01:16 +0100 Subject: Moved to GsParemeter.get and set defaults for a couple of validations. --- app/views/tenants/_admin_area.de.html.haml | 6 +++--- app/views/tenants/_admin_area.html.haml | 6 +++--- app/views/tenants/_form.html.haml | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'app/views/tenants') diff --git a/app/views/tenants/_admin_area.de.html.haml b/app/views/tenants/_admin_area.de.html.haml index b9b47d5..d125e58 100644 --- a/app/views/tenants/_admin_area.de.html.haml +++ b/app/views/tenants/_admin_area.de.html.haml @@ -102,10 +102,10 @@ = render "phone_books/index_core", :phone_books => @tenant.phone_books = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => PhoneBook} -- if STRICT_INTERNAL_EXTENSION_HANDLING == true +- 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(INTERNAL_EXTENSIONS).try(:phone_numbers).try(:count).to_i == 0 + - 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 @@ -114,5 +114,5 @@ = 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 => SERVICE_NUMBERS)) + =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} diff --git a/app/views/tenants/_admin_area.html.haml b/app/views/tenants/_admin_area.html.haml index d648143..afd50b5 100644 --- a/app/views/tenants/_admin_area.html.haml +++ b/app/views/tenants/_admin_area.html.haml @@ -102,15 +102,15 @@ = render "phone_books/index_core", :phone_books => @tenant.phone_books = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => PhoneBook} -- if STRICT_INTERNAL_EXTENSION_HANDLING == true +- 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(INTERNAL_EXTENSIONS).try(:phone_numbers).try(:count).to_i == 0 + - 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 This tenant was created = distance_of_time_in_words_to_now(@tenant.created_at) ago. There are still = pluralize(Delayed::Job.count, 'background job') not finished. This can take a couple of minutes. Please reload this page later. - else - =render 'phone_number_ranges/index_core', :phone_number_ranges => (@tenant.phone_number_ranges + @tenant.country.phone_number_ranges.where(:name => SERVICE_NUMBERS)) + =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} diff --git a/app/views/tenants/_form.html.haml b/app/views/tenants/_form.html.haml index 2ca8a69..1641e78 100644 --- a/app/views/tenants/_form.html.haml +++ b/app/views/tenants/_form.html.haml @@ -11,13 +11,13 @@ = f.input :from_field_voicemail_email, :label => t('tenants.form.from_field_voicemail_email.label'), :hint => conditional_hint('tenants.form.from_field_voicemail_email.hint') = f.input :from_field_pin_change_email, :label => t('tenants.form.from_field_pin_change_email.label'), :hint => conditional_hint('tenants.form.from_field_pin_change_email.hint') - - if STRICT_INTERNAL_EXTENSION_HANDLING == true || STRICT_DID_HANDLING == true + - if GsParameter.get('STRICT_INTERNAL_EXTENSION_HANDLING') == true || GsParameter.get('STRICT_DID_HANDLING') == true %h2= t('tenants.form.phone_numbers') %p= t('tenants.form.intro') - - if STRICT_INTERNAL_EXTENSION_HANDLING == true + - if GsParameter.get('STRICT_INTERNAL_EXTENSION_HANDLING') == true = f.input :internal_extension_ranges, :label => t('tenants.form.internal_extension_ranges.label'), :hint => conditional_hint('tenants.form.internal_extension_ranges.hint') - - if STRICT_DID_HANDLING == true + - if GsParameter.get('STRICT_DID_HANDLING') == true = f.input :did_list, :label => t('tenants.form.did_list.label'), :hint => conditional_hint('tenants.form.did_list.hint') .actions -- cgit v1.2.3 From 9f0034ff3c969c867258a90d1a9c6f76f392092a Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Thu, 10 Jan 2013 21:58:18 +0100 Subject: Refactoring and adding some caching for tenant#view. --- app/views/tenants/_admin_area.de.html.haml | 25 +-------- app/views/tenants/_admin_area.html.haml | 25 +-------- .../tenants/_sip_accounts_and_phones.html.haml | 65 ++++++++++++++++++++++ 3 files changed, 67 insertions(+), 48 deletions(-) create mode 100644 app/views/tenants/_sip_accounts_and_phones.html.haml (limited to 'app/views/tenants') 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 -- cgit v1.2.3 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 ++++++---------------- app/views/tenants/_admin_area.html.haml | 115 +++++---------------- app/views/tenants/_table_of_functions.html.haml | 60 +++++++++++ app/views/tenants/_table_of_phone_books.html.haml | 8 ++ 4 files changed, 125 insertions(+), 176 deletions(-) create mode 100644 app/views/tenants/_table_of_functions.html.haml create mode 100644 app/views/tenants/_table_of_phone_books.html.haml (limited to 'app/views/tenants') 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} diff --git a/app/views/tenants/_admin_area.html.haml b/app/views/tenants/_admin_area.html.haml index c838a18..56b0820 100644 --- a/app/views/tenants/_admin_area.html.haml +++ b/app/views/tenants/_admin_area.html.haml @@ -1,93 +1,34 @@ -%p - You belong to the - = link_to 'admin group', tenant_user_group_path(@tenant, @tenant.user_groups.find_by_name('Admins')) - and therefore have super powers. But always remember Peter Parker's: "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 + You belong to the + = link_to 'admin group', tenant_user_group_path(@tenant, @tenant.user_groups.find_by_name('Admins')) + and therefore have super powers. But always remember Peter Parker's: "With great power comes great responsibility." -%p - = succeed '.' do - This tenant has - = 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(', ')})" - which handle a total of - = link_to pluralize(@tenant.users.count, 'user'), tenant_users_path(@tenant) - This system can setup - = PhoneModel.count - different phone models from the manufacturers - - 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 ' and ' do - =link_to manufacturer, manufacturer_path(manufacturer) - - else - = succeed '.' do - =link_to manufacturer, manufacturer_path(manufacturer) + %p + = succeed '.' do + This tenant has + = 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(', ')})" + which handle a total of + = link_to pluralize(@tenant.users.count, 'user'), tenant_users_path(@tenant) + This system can setup + = PhoneModel.count + different phone models from the manufacturers + - 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 ' and ' 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 Misc += render :partial => 'tenants/table_of_functions', :locals => {:tenant => @tenant} -%table - %tr{:class => 'even'} - %th - Feature - %th - Counter - %th - %tr{:class => 'odd'} - %td - Callthroughs - %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 - Conferences - %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 - Hunt groups - %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 - ACDs - %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 - GUI functions - %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 - This tenant was created - = distance_of_time_in_words_to_now(@tenant.created_at) - ago. There are still - = pluralize(Delayed::Job.count, 'background job') - not finished. This can take a couple of minutes. Please reload this page later. - - 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} diff --git a/app/views/tenants/_table_of_functions.html.haml b/app/views/tenants/_table_of_functions.html.haml new file mode 100644 index 0000000..d4d3950 --- /dev/null +++ b/app/views/tenants/_table_of_functions.html.haml @@ -0,0 +1,60 @@ +- cache([I18n.locale, tenant, GuiFunction.count, GuiFunction.order(:updated_at).last, GsParameter.count, GsParameter.order(:updated_at)]) do + %table + %tr{:class => 'even'} + %th + Funktion + %th + Anzahl + %th + %tr{:class => 'odd'} + %td + = t("callthroughs.name") + %td + - if tenant.callthroughs.any? + = link_to tenant.callthroughs.count.to_s, tenant_callthroughs_path(tenant) + - else + = '-' + %td + = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => Callthrough} + %tr{:class => 'even'} + %td + = t("conferences.name") + %td + - if tenant.conferences.any? + = link_to tenant.conferences.count.to_s, tenant_conferences_path(tenant) + - else + = '-' + %td + = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => Conference} + %tr{:class => 'odd'} + %td + = t("hunt_groups.name") + %td + - if tenant.hunt_groups.any? + = link_to tenant.hunt_groups.count.to_s, tenant_hunt_groups_path(tenant) + - else + = '-' + %td + = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => HuntGroup} + %tr{:class => 'even'} + %td + = t("automatic_call_distributors.name") + %td + - if tenant.automatic_call_distributors.any? + = link_to tenant.automatic_call_distributors.count.to_s, tenant_automatic_call_distributors_path(tenant) + - else + = '-' + %td + = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => AutomaticCallDistributor} + %tr{:class => 'odd'} + %td + = t("gui_functions.name") + %td + = link_to GuiFunction.count.to_s, gui_functions_path + %td + %tr{:class => 'even'} + %td + = t("gs_parameters.name") + %td + = link_to GsParameter.count.to_s, gs_parameters_path + %td \ No newline at end of file diff --git a/app/views/tenants/_table_of_phone_books.html.haml b/app/views/tenants/_table_of_phone_books.html.haml new file mode 100644 index 0000000..ef118c7 --- /dev/null +++ b/app/views/tenants/_table_of_phone_books.html.haml @@ -0,0 +1,8 @@ +- cache([I18n.locale, tenant]) do + -# 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} \ No newline at end of file -- cgit v1.2.3 From 1e5c4e80fe27eddf87d0e01ea771e8ea050bc4c1 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sat, 12 Jan 2013 21:37:55 +0100 Subject: Fixed a caching bug. #95 --- app/views/tenants/_sip_accounts_and_phones.html.haml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/views/tenants') diff --git a/app/views/tenants/_sip_accounts_and_phones.html.haml b/app/views/tenants/_sip_accounts_and_phones.html.haml index 9059126..ed5599f 100644 --- a/app/views/tenants/_sip_accounts_and_phones.html.haml +++ b/app/views/tenants/_sip_accounts_and_phones.html.haml @@ -8,7 +8,7 @@ %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 + - cache([I18n.locale, tenant, 'sip_accounts', 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') @@ -19,7 +19,7 @@ =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} + = 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') @@ -40,7 +40,7 @@ %tr{:class => 'even'} %td= t("phones.index.page_title") - - cache([I18n.locale, tenant, tenant.phones.count, tenant.phones.order(:updated_at).last]) do + - cache([I18n.locale, tenant, 'phones', 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') -- cgit v1.2.3 From 45ab6dc23ef7d8d6ddf60ab355c2d1b3450f35c8 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sat, 12 Jan 2013 22:54:59 +0100 Subject: Cache fixes. --- app/views/tenants/_admin_area.de.html.haml | 3 +- app/views/tenants/_admin_area.html.haml | 2 +- .../tenants/_sip_accounts_and_phones.html.haml | 117 ++++++++++----------- app/views/tenants/_table_of_functions.html.haml | 2 +- app/views/tenants/_table_of_phone_books.html.haml | 2 +- 5 files changed, 62 insertions(+), 64 deletions(-) (limited to 'app/views/tenants') diff --git a/app/views/tenants/_admin_area.de.html.haml b/app/views/tenants/_admin_area.de.html.haml index c3411bc..d111c9d 100644 --- a/app/views/tenants/_admin_area.de.html.haml +++ b/app/views/tenants/_admin_area.de.html.haml @@ -1,4 +1,4 @@ -- 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 +- cache([I18n.locale, @tenant, UserGroup.count, UserGroup.order(:updated_at).last, User.count, User.order(:updated_at).last, Manufacturer.all]) do %p Sie sind Mitglied der = link_to 'Admin Gruppe', tenant_user_group_path(@tenant, @tenant.user_groups.find_by_name('Admins')) @@ -32,4 +32,3 @@ = render :partial => 'tenants/table_of_functions', :locals => {:tenant => @tenant} = render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => @tenant} - diff --git a/app/views/tenants/_admin_area.html.haml b/app/views/tenants/_admin_area.html.haml index 56b0820..b479995 100644 --- a/app/views/tenants/_admin_area.html.haml +++ b/app/views/tenants/_admin_area.html.haml @@ -1,4 +1,4 @@ -- 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 +- cache([I18n.locale, @tenant, UserGroup.count, UserGroup.order(:updated_at).last, User.count, User.order(:updated_at).last, Manufacturer.all]) do %p You belong to the = link_to 'admin group', tenant_user_group_path(@tenant, @tenant.user_groups.find_by_name('Admins')) diff --git a/app/views/tenants/_sip_accounts_and_phones.html.haml b/app/views/tenants/_sip_accounts_and_phones.html.haml index ed5599f..f9d26f9 100644 --- a/app/views/tenants/_sip_accounts_and_phones.html.haml +++ b/app/views/tenants/_sip_accounts_and_phones.html.haml @@ -1,65 +1,64 @@ -- 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") +%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, 'sip_accounts', 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) + %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([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} + %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 - = "-" - - %tr{:class => 'even'} - %td= t("phones.index.page_title") - - cache([I18n.locale, tenant, 'phones', 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) + - 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 - - 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) + =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") + %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 - = '-' \ No newline at end of file + - cache([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') + = 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/app/views/tenants/_table_of_functions.html.haml b/app/views/tenants/_table_of_functions.html.haml index d4d3950..79ea2b1 100644 --- a/app/views/tenants/_table_of_functions.html.haml +++ b/app/views/tenants/_table_of_functions.html.haml @@ -1,4 +1,4 @@ -- cache([I18n.locale, tenant, GuiFunction.count, GuiFunction.order(:updated_at).last, GsParameter.count, GsParameter.order(:updated_at)]) do +- cache([I18n.locale, tenant, GuiFunction.count, GuiFunction.order(:updated_at).last, GsParameter.count, GsParameter.order(:updated_at).last]) do %table %tr{:class => 'even'} %th diff --git a/app/views/tenants/_table_of_phone_books.html.haml b/app/views/tenants/_table_of_phone_books.html.haml index ef118c7..811fe26 100644 --- a/app/views/tenants/_table_of_phone_books.html.haml +++ b/app/views/tenants/_table_of_phone_books.html.haml @@ -1,4 +1,4 @@ -- cache([I18n.locale, tenant]) do +- cache([I18n.locale, tenant, tenant.phone_books]) do -# Phone books -# - if GuiFunction.display?('show_phone_books_in_user_show_view', current_user) -- cgit v1.2.3 From 801f53f49f5440acaeba70c65df8d3e611c0b4c4 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 15 Jan 2013 17:24:13 +0100 Subject: Fixed not rendered link to create a new SIP account. --- app/views/tenants/_sip_accounts_and_phones.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/views/tenants') diff --git a/app/views/tenants/_sip_accounts_and_phones.html.haml b/app/views/tenants/_sip_accounts_and_phones.html.haml index f9d26f9..618236f 100644 --- a/app/views/tenants/_sip_accounts_and_phones.html.haml +++ b/app/views/tenants/_sip_accounts_and_phones.html.haml @@ -18,7 +18,7 @@ =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} + = 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') -- cgit v1.2.3 From bdad29d001523a2ba4f515e6202babaa61739fc9 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 15 Jan 2013 18:02:06 +0100 Subject: Refactoring and caching. --- app/views/tenants/_admin_area.de.html.haml | 6 ++ app/views/tenants/_admin_area.html.haml | 7 +- app/views/tenants/_gs_parameter_table.html.haml | 24 ++++++ app/views/tenants/_table_of_functions.html.haml | 98 +++++++++++------------ app/views/tenants/_table_of_phone_books.html.haml | 1 - 5 files changed, 81 insertions(+), 55 deletions(-) create mode 100644 app/views/tenants/_gs_parameter_table.html.haml (limited to 'app/views/tenants') diff --git a/app/views/tenants/_admin_area.de.html.haml b/app/views/tenants/_admin_area.de.html.haml index d111c9d..4b8a9e6 100644 --- a/app/views/tenants/_admin_area.de.html.haml +++ b/app/views/tenants/_admin_area.de.html.haml @@ -27,8 +27,14 @@ = succeed '.' do =link_to manufacturer, manufacturer_path(manufacturer) +%h2 Admin Bereich = render :partial => 'tenants/sip_accounts_and_phones', :locals => {:tenant => @tenant} +%h2 Features = render :partial => 'tenants/table_of_functions', :locals => {:tenant => @tenant} +%h2 Gemeinschaft Konfiguration += render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => @tenant} + +%h2=t("phone_books.index.page_title") = render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => @tenant} diff --git a/app/views/tenants/_admin_area.html.haml b/app/views/tenants/_admin_area.html.haml index b479995..b1b17a3 100644 --- a/app/views/tenants/_admin_area.html.haml +++ b/app/views/tenants/_admin_area.html.haml @@ -26,9 +26,14 @@ = succeed '.' do =link_to manufacturer, manufacturer_path(manufacturer) +%h2 Admin Area = render :partial => 'tenants/sip_accounts_and_phones', :locals => {:tenant => @tenant} +%h2 Features = render :partial => 'tenants/table_of_functions', :locals => {:tenant => @tenant} -= render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => @tenant} +%h2 Gemeinschaft Configuration += render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => @tenant} +%h2=t("phone_books.index.page_title") += render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => @tenant} \ No newline at end of file diff --git a/app/views/tenants/_gs_parameter_table.html.haml b/app/views/tenants/_gs_parameter_table.html.haml new file mode 100644 index 0000000..7663f46 --- /dev/null +++ b/app/views/tenants/_gs_parameter_table.html.haml @@ -0,0 +1,24 @@ +- cache([I18n.locale, tenant, GuiFunction.count, GuiFunction.order(:updated_at).last, GsParameter.count, GsParameter.order(:updated_at).last]) do + %table + %tr{:class => 'even'} + %th + Funktion + %th + Anzahl + %th + Letztes Update + + %tr{:class => 'odd'} + %td + = t("gui_functions.name") + %td + = link_to GuiFunction.count.to_s, gui_functions_path + %td + = l GuiFunction.order(:updated_at).last.updated_at, :format => :short + %tr{:class => 'even'} + %td + = t("gs_parameters.name") + %td + = link_to GsParameter.count.to_s, gs_parameters_path + %td + = l GsParameter.order(:updated_at).last.updated_at, :format => :short diff --git a/app/views/tenants/_table_of_functions.html.haml b/app/views/tenants/_table_of_functions.html.haml index 79ea2b1..ef2a2d0 100644 --- a/app/views/tenants/_table_of_functions.html.haml +++ b/app/views/tenants/_table_of_functions.html.haml @@ -1,4 +1,4 @@ -- cache([I18n.locale, tenant, GuiFunction.count, GuiFunction.order(:updated_at).last, GsParameter.count, GsParameter.order(:updated_at).last]) do +- cache([I18n.locale, tenant, tenant.callthroughs.count, tenant.callthroughs.order(:updated_at).last, tenant.conferences.count, tenant.conferences.order(:updated_at).last, tenant.hunt_groups.count, tenant.hunt_groups.order(:updated_at).last, tenant.automatic_call_distributors.count, tenant.automatic_call_distributors.order(:updated_at).last]) do %table %tr{:class => 'even'} %th @@ -6,55 +6,47 @@ %th Anzahl %th - %tr{:class => 'odd'} - %td - = t("callthroughs.name") - %td - - if tenant.callthroughs.any? - = link_to tenant.callthroughs.count.to_s, tenant_callthroughs_path(tenant) - - else - = '-' - %td - = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => Callthrough} - %tr{:class => 'even'} - %td - = t("conferences.name") - %td - - if tenant.conferences.any? - = link_to tenant.conferences.count.to_s, tenant_conferences_path(tenant) - - else - = '-' - %td - = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => Conference} - %tr{:class => 'odd'} - %td - = t("hunt_groups.name") - %td - - if tenant.hunt_groups.any? - = link_to tenant.hunt_groups.count.to_s, tenant_hunt_groups_path(tenant) - - else - = '-' - %td - = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => HuntGroup} - %tr{:class => 'even'} - %td - = t("automatic_call_distributors.name") - %td - - if tenant.automatic_call_distributors.any? - = link_to tenant.automatic_call_distributors.count.to_s, tenant_automatic_call_distributors_path(tenant) - - else - = '-' - %td - = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => AutomaticCallDistributor} - %tr{:class => 'odd'} - %td - = t("gui_functions.name") - %td - = link_to GuiFunction.count.to_s, gui_functions_path - %td - %tr{:class => 'even'} - %td - = t("gs_parameters.name") - %td - = link_to GsParameter.count.to_s, gs_parameters_path - %td \ No newline at end of file + - cache([I18n.locale, tenant, tenant.callthroughs.count, tenant.callthroughs.order(:updated_at).last]) do + %tr{:class => 'odd'} + %td + = t("callthroughs.name") + %td + - if tenant.callthroughs.any? + = link_to tenant.callthroughs.count.to_s, tenant_callthroughs_path(tenant) + - else + = '-' + %td + = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => Callthrough} + - cache([I18n.locale, tenant, tenant.conferences.count, tenant.conferences.order(:updated_at).last]) do + %tr{:class => 'even'} + %td + = t("conferences.name") + %td + - if tenant.conferences.any? + = link_to tenant.conferences.count.to_s, tenant_conferences_path(tenant) + - else + = '-' + %td + = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => Conference} + - cache([I18n.locale, tenant, tenant.hunt_groups.count, tenant.hunt_groups.order(:updated_at).last]) do + %tr{:class => 'odd'} + %td + = t("hunt_groups.name") + %td + - if tenant.hunt_groups.any? + = link_to tenant.hunt_groups.count.to_s, tenant_hunt_groups_path(tenant) + - else + = '-' + %td + = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => HuntGroup} + - cache([I18n.locale, tenant, tenant.automatic_call_distributors.count, tenant.automatic_call_distributors.order(:updated_at).last]) do + %tr{:class => 'even'} + %td + = t("automatic_call_distributors.name") + %td + - if tenant.automatic_call_distributors.any? + = link_to tenant.automatic_call_distributors.count.to_s, tenant_automatic_call_distributors_path(tenant) + - else + = '-' + %td + = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => AutomaticCallDistributor} \ No newline at end of file diff --git a/app/views/tenants/_table_of_phone_books.html.haml b/app/views/tenants/_table_of_phone_books.html.haml index 811fe26..a963bf4 100644 --- a/app/views/tenants/_table_of_phone_books.html.haml +++ b/app/views/tenants/_table_of_phone_books.html.haml @@ -3,6 +3,5 @@ -# - 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} \ No newline at end of file -- cgit v1.2.3 From 7b5c903f96e1c97ad788962c88d6d285852d890e Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 15 Jan 2013 20:50:18 +0100 Subject: Fixed caching. --- app/views/tenants/_gs_parameter_table.html.haml | 2 +- app/views/tenants/_table_of_functions.html.haml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'app/views/tenants') diff --git a/app/views/tenants/_gs_parameter_table.html.haml b/app/views/tenants/_gs_parameter_table.html.haml index 7663f46..3af06cf 100644 --- a/app/views/tenants/_gs_parameter_table.html.haml +++ b/app/views/tenants/_gs_parameter_table.html.haml @@ -1,4 +1,4 @@ -- cache([I18n.locale, tenant, GuiFunction.count, GuiFunction.order(:updated_at).last, GsParameter.count, GsParameter.order(:updated_at).last]) do +- cache(['gs_parameters_tenant_overview_table', I18n.locale, tenant, GuiFunction.count, GuiFunction.order(:updated_at).last, GsParameter.count, GsParameter.order(:updated_at).last]) do %table %tr{:class => 'even'} %th diff --git a/app/views/tenants/_table_of_functions.html.haml b/app/views/tenants/_table_of_functions.html.haml index ef2a2d0..75b2332 100644 --- a/app/views/tenants/_table_of_functions.html.haml +++ b/app/views/tenants/_table_of_functions.html.haml @@ -1,4 +1,4 @@ -- cache([I18n.locale, tenant, tenant.callthroughs.count, tenant.callthroughs.order(:updated_at).last, tenant.conferences.count, tenant.conferences.order(:updated_at).last, tenant.hunt_groups.count, tenant.hunt_groups.order(:updated_at).last, tenant.automatic_call_distributors.count, tenant.automatic_call_distributors.order(:updated_at).last]) do +- cache(['table_of_pbx_features', I18n.locale, tenant, tenant.callthroughs.count, tenant.callthroughs.order(:updated_at).last, tenant.conferences.count, tenant.conferences.order(:updated_at).last, tenant.hunt_groups.count, tenant.hunt_groups.order(:updated_at).last, tenant.automatic_call_distributors.count, tenant.automatic_call_distributors.order(:updated_at).last]) do %table %tr{:class => 'even'} %th @@ -6,7 +6,7 @@ %th Anzahl %th - - cache([I18n.locale, tenant, tenant.callthroughs.count, tenant.callthroughs.order(:updated_at).last]) do + - cache(['table_of_pbx_features_callthroughs_row', I18n.locale, tenant, tenant.callthroughs.count, tenant.callthroughs.order(:updated_at).last]) do %tr{:class => 'odd'} %td = t("callthroughs.name") @@ -17,7 +17,7 @@ = '-' %td = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => Callthrough} - - cache([I18n.locale, tenant, tenant.conferences.count, tenant.conferences.order(:updated_at).last]) do + - cache(['table_of_pbx_features_conferences_row', I18n.locale, tenant, tenant.conferences.count, tenant.conferences.order(:updated_at).last]) do %tr{:class => 'even'} %td = t("conferences.name") @@ -28,7 +28,7 @@ = '-' %td = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => Conference} - - cache([I18n.locale, tenant, tenant.hunt_groups.count, tenant.hunt_groups.order(:updated_at).last]) do + - cache(['table_of_pbx_features_hunt_groups_row', I18n.locale, tenant, tenant.hunt_groups.count, tenant.hunt_groups.order(:updated_at).last]) do %tr{:class => 'odd'} %td = t("hunt_groups.name") @@ -39,7 +39,7 @@ = '-' %td = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => HuntGroup} - - cache([I18n.locale, tenant, tenant.automatic_call_distributors.count, tenant.automatic_call_distributors.order(:updated_at).last]) do + - cache(['table_of_pbx_features_automatic_call_distributors_row', I18n.locale, tenant, tenant.automatic_call_distributors.count, tenant.automatic_call_distributors.order(:updated_at).last]) do %tr{:class => 'even'} %td = t("automatic_call_distributors.name") -- cgit v1.2.3 From 96fc4789d9991548b9fd1144f185da1f3464f156 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 15 Jan 2013 21:47:26 +0100 Subject: Fixed caching bugs. --- app/views/tenants/_admin_area.de.html.haml | 2 +- app/views/tenants/_admin_area.html.haml | 2 +- app/views/tenants/_sip_accounts_and_phones.html.haml | 4 ++-- app/views/tenants/_table_of_phone_books.html.haml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'app/views/tenants') diff --git a/app/views/tenants/_admin_area.de.html.haml b/app/views/tenants/_admin_area.de.html.haml index 4b8a9e6..beab94e 100644 --- a/app/views/tenants/_admin_area.de.html.haml +++ b/app/views/tenants/_admin_area.de.html.haml @@ -1,4 +1,4 @@ -- cache([I18n.locale, @tenant, UserGroup.count, UserGroup.order(:updated_at).last, User.count, User.order(:updated_at).last, Manufacturer.all]) do +- cache(['tenant_show_admin_area', I18n.locale, @tenant, UserGroup.count, UserGroup.order(:updated_at).last, User.count, User.order(:updated_at).last, Manufacturer.all]) do %p Sie sind Mitglied der = link_to 'Admin Gruppe', tenant_user_group_path(@tenant, @tenant.user_groups.find_by_name('Admins')) diff --git a/app/views/tenants/_admin_area.html.haml b/app/views/tenants/_admin_area.html.haml index b1b17a3..65810e7 100644 --- a/app/views/tenants/_admin_area.html.haml +++ b/app/views/tenants/_admin_area.html.haml @@ -1,4 +1,4 @@ -- cache([I18n.locale, @tenant, UserGroup.count, UserGroup.order(:updated_at).last, User.count, User.order(:updated_at).last, Manufacturer.all]) do +- cache(['tenant_show_admin_area', I18n.locale, @tenant, UserGroup.count, UserGroup.order(:updated_at).last, User.count, User.order(:updated_at).last, Manufacturer.all]) do %p You belong to the = link_to 'admin group', tenant_user_group_path(@tenant, @tenant.user_groups.find_by_name('Admins')) diff --git a/app/views/tenants/_sip_accounts_and_phones.html.haml b/app/views/tenants/_sip_accounts_and_phones.html.haml index 618236f..c698fef 100644 --- a/app/views/tenants/_sip_accounts_and_phones.html.haml +++ b/app/views/tenants/_sip_accounts_and_phones.html.haml @@ -12,7 +12,7 @@ - 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([I18n.locale, tenant, tenant.sip_accounts, PhoneNumber.where(:phone_numberable_type => 'SipAccount').where(:id => tenant.sip_account_ids)]) do + - 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) @@ -44,7 +44,7 @@ - if tenant.phones.count > GsParameter.get('NUMBER_OF_SHOWN_ITEMS') = link_to tenant.phones.count.to_s, tenant_phones_path(tenant) - else - - cache([I18n.locale, tenant, tenant.phones]) do + - 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) diff --git a/app/views/tenants/_table_of_phone_books.html.haml b/app/views/tenants/_table_of_phone_books.html.haml index a963bf4..6baca58 100644 --- a/app/views/tenants/_table_of_phone_books.html.haml +++ b/app/views/tenants/_table_of_phone_books.html.haml @@ -1,4 +1,4 @@ -- cache([I18n.locale, tenant, tenant.phone_books]) do +- cache(['user_show_phone_books', I18n.locale, tenant, tenant.phone_books]) do -# Phone books -# - if GuiFunction.display?('show_phone_books_in_user_show_view', current_user) -- cgit v1.2.3 From 8d622f127f8d951c50bbf3fd0921626fd3746dae Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 15 Jan 2013 22:42:15 +0100 Subject: Optimized caching. --- .../tenants/_sip_accounts_and_phones.html.haml | 64 ++++++++++++---------- app/views/tenants/show.html.haml | 15 ++--- 2 files changed, 42 insertions(+), 37 deletions(-) (limited to 'app/views/tenants') 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 -- cgit v1.2.3 From 9ffaaeeb42b364f2c7d9b7d17a272c530f546c83 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Wed, 16 Jan 2013 21:46:37 +0100 Subject: Refactoring and adding user_groups to tenant#show #105 --- app/views/tenants/_admin_area.de.html.haml | 4 ++++ app/views/tenants/_admin_area.html.haml | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'app/views/tenants') diff --git a/app/views/tenants/_admin_area.de.html.haml b/app/views/tenants/_admin_area.de.html.haml index beab94e..89e14cb 100644 --- a/app/views/tenants/_admin_area.de.html.haml +++ b/app/views/tenants/_admin_area.de.html.haml @@ -30,6 +30,10 @@ %h2 Admin Bereich = render :partial => 'tenants/sip_accounts_and_phones', :locals => {:tenant => @tenant} +- if @tenant.user_groups.any? + %h2 Gruppen + = render "user_groups/index_core", :user_groups => @tenant.user_groups + %h2 Features = render :partial => 'tenants/table_of_functions', :locals => {:tenant => @tenant} diff --git a/app/views/tenants/_admin_area.html.haml b/app/views/tenants/_admin_area.html.haml index 65810e7..7136f1e 100644 --- a/app/views/tenants/_admin_area.html.haml +++ b/app/views/tenants/_admin_area.html.haml @@ -29,6 +29,10 @@ %h2 Admin Area = render :partial => 'tenants/sip_accounts_and_phones', :locals => {:tenant => @tenant} +- if @tenant.user_groups.any? + %h2 Groups + = render "user_groups/index_core", :user_groups => @tenant.user_groups + %h2 Features = render :partial => 'tenants/table_of_functions', :locals => {:tenant => @tenant} -- cgit v1.2.3 From 1bd91b138c773aedbd5f18b9df79e28fac240dbc Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Wed, 16 Jan 2013 22:04:44 +0100 Subject: Added a users table to tenant#view. Related to #105. Still a lot of room for improvement. --- app/views/tenants/_admin_area.de.html.haml | 17 +++++++++++++---- app/views/tenants/_admin_area.html.haml | 19 ++++++++++++++----- 2 files changed, 27 insertions(+), 9 deletions(-) (limited to 'app/views/tenants') diff --git a/app/views/tenants/_admin_area.de.html.haml b/app/views/tenants/_admin_area.de.html.haml index 89e14cb..0ef9da3 100644 --- a/app/views/tenants/_admin_area.de.html.haml +++ b/app/views/tenants/_admin_area.de.html.haml @@ -30,15 +30,24 @@ %h2 Admin Bereich = render :partial => 'tenants/sip_accounts_and_phones', :locals => {:tenant => @tenant} +%h2= t("users.index.page_title") +- if @tenant.users.count <= GsParameter.get('NUMBER_OF_SHOWN_ITEMS') + = render "users/index_core", :users => @tenant.users + = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => User} +- else + %p + = link_to "Liste aller User.", tenant_users_path(@tenant) + - if @tenant.user_groups.any? - %h2 Gruppen + %h2= t("user_groups.index.page_title") = render "user_groups/index_core", :user_groups => @tenant.user_groups + = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => UserGroup} %h2 Features = render :partial => 'tenants/table_of_functions', :locals => {:tenant => @tenant} -%h2 Gemeinschaft Konfiguration -= render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => @tenant} - %h2=t("phone_books.index.page_title") = render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => @tenant} + +%h2 Gemeinschaft Konfiguration += render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => @tenant} \ No newline at end of file diff --git a/app/views/tenants/_admin_area.html.haml b/app/views/tenants/_admin_area.html.haml index 7136f1e..7b47587 100644 --- a/app/views/tenants/_admin_area.html.haml +++ b/app/views/tenants/_admin_area.html.haml @@ -29,15 +29,24 @@ %h2 Admin Area = render :partial => 'tenants/sip_accounts_and_phones', :locals => {:tenant => @tenant} +%h2= t("users.index.page_title") +- if @tenant.users.count <= GsParameter.get('NUMBER_OF_SHOWN_ITEMS') + = render "users/index_core", :users => @tenant.users + = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => User} +- else + %p + = link_to "Liste aller User.", tenant_users_path(@tenant) + - if @tenant.user_groups.any? - %h2 Groups + %h2= t("user_groups.index.page_title") = render "user_groups/index_core", :user_groups => @tenant.user_groups + = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => UserGroup} %h2 Features = render :partial => 'tenants/table_of_functions', :locals => {:tenant => @tenant} -%h2 Gemeinschaft Configuration -= render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => @tenant} - %h2=t("phone_books.index.page_title") -= render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => @tenant} \ No newline at end of file += render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => @tenant} + +%h2 Gemeinschaft Configuration += render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => @tenant} \ No newline at end of file -- cgit v1.2.3 From 8feb9102570d23f53c3443ccd3a409d87c97828d Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Fri, 18 Jan 2013 10:57:12 +0100 Subject: Refactoring and fixing #112 --- app/views/tenants/_admin_area.de.html.haml | 46 ++++++++-------------- app/views/tenants/_admin_area.html.haml | 45 ++++++++------------- .../tenants/_sip_accounts_and_phones.html.haml | 2 +- app/views/tenants/show.html.haml | 14 +++---- 4 files changed, 38 insertions(+), 69 deletions(-) (limited to 'app/views/tenants') diff --git a/app/views/tenants/_admin_area.de.html.haml b/app/views/tenants/_admin_area.de.html.haml index 0ef9da3..268c8e7 100644 --- a/app/views/tenants/_admin_area.de.html.haml +++ b/app/views/tenants/_admin_area.de.html.haml @@ -1,32 +1,3 @@ -- cache(['tenant_show_admin_area', I18n.locale, @tenant, UserGroup.count, UserGroup.order(:updated_at).last, User.count, User.order(:updated_at).last, Manufacturer.all]) 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 - = @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) - %h2 Admin Bereich = render :partial => 'tenants/sip_accounts_and_phones', :locals => {:tenant => @tenant} @@ -50,4 +21,19 @@ = render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => @tenant} %h2 Gemeinschaft Konfiguration -= render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => @tenant} \ No newline at end of file += render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => @tenant} + +%p + 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) \ No newline at end of file diff --git a/app/views/tenants/_admin_area.html.haml b/app/views/tenants/_admin_area.html.haml index 7b47587..e708215 100644 --- a/app/views/tenants/_admin_area.html.haml +++ b/app/views/tenants/_admin_area.html.haml @@ -1,31 +1,3 @@ -- cache(['tenant_show_admin_area', I18n.locale, @tenant, UserGroup.count, UserGroup.order(:updated_at).last, User.count, User.order(:updated_at).last, Manufacturer.all]) do - %p - You belong to the - = link_to 'admin group', tenant_user_group_path(@tenant, @tenant.user_groups.find_by_name('Admins')) - and therefore have super powers. But always remember Peter Parker's: "With great power comes great responsibility." - - %p - = succeed '.' do - This tenant has - = 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(', ')})" - which handle a total of - = link_to pluralize(@tenant.users.count, 'user'), tenant_users_path(@tenant) - This system can setup - = PhoneModel.count - different phone models from the manufacturers - - 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 ' and ' do - =link_to manufacturer, manufacturer_path(manufacturer) - - else - = succeed '.' do - =link_to manufacturer, manufacturer_path(manufacturer) - %h2 Admin Area = render :partial => 'tenants/sip_accounts_and_phones', :locals => {:tenant => @tenant} @@ -49,4 +21,19 @@ = render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => @tenant} %h2 Gemeinschaft Configuration -= render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => @tenant} \ No newline at end of file += render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => @tenant} + +%p + This system can setup + = PhoneModel.count + different phone models from the manufacturers + - 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 ' and ' do + =link_to manufacturer, manufacturer_path(manufacturer) + - else + = succeed '.' do + =link_to manufacturer, manufacturer_path(manufacturer) \ No newline at end of file diff --git a/app/views/tenants/_sip_accounts_and_phones.html.haml b/app/views/tenants/_sip_accounts_and_phones.html.haml index e322b67..4b84b1c 100644 --- a/app/views/tenants/_sip_accounts_and_phones.html.haml +++ b/app/views/tenants/_sip_accounts_and_phones.html.haml @@ -21,7 +21,7 @@ = '[' + 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 + - 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') diff --git a/app/views/tenants/show.html.haml b/app/views/tenants/show.html.haml index 10845cf..f5cff5f 100644 --- a/app/views/tenants/show.html.haml +++ b/app/views/tenants/show.html.haml @@ -1,15 +1,11 @@ -- title t("tenants.show.page_title") +- title @tenant.name -- cache(['tenant_show_name_and_description', I18n.locale, @tenant, current_user]) do +- if !@tenant.description.blank? %p - %strong= t('tenants.show.name') + ":" - = @tenant.name - - if !@tenant.description.blank? - %p - %strong= t('tenants.show.description') + ":" - = @tenant.description + %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 -- cgit v1.2.3 From a4c2b5b00c074d8861ef313f672032611d662fff Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sat, 19 Jan 2013 08:53:02 +0100 Subject: Refactoring. --- app/views/tenants/_admin_area.de.html.haml | 15 ++------------- app/views/tenants/_admin_area.html.haml | 15 ++------------- app/views/tenants/_table_of_phone_books.html.haml | 1 + app/views/tenants/_user_groups_table.de.html.haml | 4 ++++ app/views/tenants/_users_table.de.html.haml | 7 +++++++ 5 files changed, 16 insertions(+), 26 deletions(-) create mode 100644 app/views/tenants/_user_groups_table.de.html.haml create mode 100644 app/views/tenants/_users_table.de.html.haml (limited to 'app/views/tenants') diff --git a/app/views/tenants/_admin_area.de.html.haml b/app/views/tenants/_admin_area.de.html.haml index 268c8e7..fed7d4f 100644 --- a/app/views/tenants/_admin_area.de.html.haml +++ b/app/views/tenants/_admin_area.de.html.haml @@ -1,23 +1,12 @@ -%h2 Admin Bereich = render :partial => 'tenants/sip_accounts_and_phones', :locals => {:tenant => @tenant} -%h2= t("users.index.page_title") -- if @tenant.users.count <= GsParameter.get('NUMBER_OF_SHOWN_ITEMS') - = render "users/index_core", :users => @tenant.users - = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => User} -- else - %p - = link_to "Liste aller User.", tenant_users_path(@tenant) += render :partial => 'users_table', :locals => {:tenant => @tenant} -- if @tenant.user_groups.any? - %h2= t("user_groups.index.page_title") - = render "user_groups/index_core", :user_groups => @tenant.user_groups - = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => UserGroup} += render :partial => 'user_groups_table', :locals => {:tenant => @tenant} %h2 Features = render :partial => 'tenants/table_of_functions', :locals => {:tenant => @tenant} -%h2=t("phone_books.index.page_title") = render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => @tenant} %h2 Gemeinschaft Konfiguration diff --git a/app/views/tenants/_admin_area.html.haml b/app/views/tenants/_admin_area.html.haml index e708215..50ed372 100644 --- a/app/views/tenants/_admin_area.html.haml +++ b/app/views/tenants/_admin_area.html.haml @@ -1,23 +1,12 @@ -%h2 Admin Area = render :partial => 'tenants/sip_accounts_and_phones', :locals => {:tenant => @tenant} -%h2= t("users.index.page_title") -- if @tenant.users.count <= GsParameter.get('NUMBER_OF_SHOWN_ITEMS') - = render "users/index_core", :users => @tenant.users - = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => User} -- else - %p - = link_to "Liste aller User.", tenant_users_path(@tenant) += render :partial => 'users_table', :locals => {:tenant => @tenant} -- if @tenant.user_groups.any? - %h2= t("user_groups.index.page_title") - = render "user_groups/index_core", :user_groups => @tenant.user_groups - = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => UserGroup} += render :partial => 'user_groups_table', :locals => {:tenant => @tenant} %h2 Features = render :partial => 'tenants/table_of_functions', :locals => {:tenant => @tenant} -%h2=t("phone_books.index.page_title") = render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => @tenant} %h2 Gemeinschaft Configuration diff --git a/app/views/tenants/_table_of_phone_books.html.haml b/app/views/tenants/_table_of_phone_books.html.haml index 6baca58..9d9b97c 100644 --- a/app/views/tenants/_table_of_phone_books.html.haml +++ b/app/views/tenants/_table_of_phone_books.html.haml @@ -1,4 +1,5 @@ - cache(['user_show_phone_books', I18n.locale, tenant, tenant.phone_books]) do + %h2=t("phone_books.index.page_title") -# Phone books -# - if GuiFunction.display?('show_phone_books_in_user_show_view', current_user) diff --git a/app/views/tenants/_user_groups_table.de.html.haml b/app/views/tenants/_user_groups_table.de.html.haml new file mode 100644 index 0000000..61b3e3d --- /dev/null +++ b/app/views/tenants/_user_groups_table.de.html.haml @@ -0,0 +1,4 @@ +- if @tenant.user_groups.any? + %h2= t("user_groups.index.page_title") + = render "user_groups/index_core", :user_groups => tenant.user_groups + = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => UserGroup} diff --git a/app/views/tenants/_users_table.de.html.haml b/app/views/tenants/_users_table.de.html.haml new file mode 100644 index 0000000..850ea5e --- /dev/null +++ b/app/views/tenants/_users_table.de.html.haml @@ -0,0 +1,7 @@ +%h2= t("users.index.page_title") +- if @tenant.users.count <= GsParameter.get('NUMBER_OF_SHOWN_ITEMS') + = render "users/index_core", :users => tenant.users + = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => User} +- else + %p + = link_to "Liste aller User.", tenant_users_path(tenant) \ No newline at end of file -- cgit v1.2.3 From b4abd87252db53e3d79a9601cf9c581f61827f10 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sat, 19 Jan 2013 09:05:50 +0100 Subject: Added call_routes to tenant#show --- app/views/tenants/_admin_area.de.html.haml | 4 +++- app/views/tenants/_call_routes.html.haml | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 app/views/tenants/_call_routes.html.haml (limited to 'app/views/tenants') diff --git a/app/views/tenants/_admin_area.de.html.haml b/app/views/tenants/_admin_area.de.html.haml index fed7d4f..ba64e9a 100644 --- a/app/views/tenants/_admin_area.de.html.haml +++ b/app/views/tenants/_admin_area.de.html.haml @@ -25,4 +25,6 @@ =link_to manufacturer, manufacturer_path(manufacturer) - else = succeed '.' do - =link_to manufacturer, manufacturer_path(manufacturer) \ No newline at end of file + =link_to manufacturer, manufacturer_path(manufacturer) + += render :partial => 'call_routes', :locals => {:tenant => @tenant} \ No newline at end of file diff --git a/app/views/tenants/_call_routes.html.haml b/app/views/tenants/_call_routes.html.haml new file mode 100644 index 0000000..ade24c9 --- /dev/null +++ b/app/views/tenants/_call_routes.html.haml @@ -0,0 +1,8 @@ +%h2= t("call_routes.index.page_title") + +- if CallRoute.count <= GsParameter.get('NUMBER_OF_SHOWN_ITEMS') + = render "call_routes/index_core", :call_routes => CallRoute.call + = render :partial => 'shared/create_link', :locals => {:child_class => CallRoute} +- else + %p + = link_to t("call_routes.index.page_title"), call_routes_path \ No newline at end of file -- cgit v1.2.3 From 4ea0e252683d89794deff7b1b3689d2cdf61e0d0 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sun, 20 Jan 2013 19:54:11 +0100 Subject: Added a gateways table to tenant#view. --- app/views/tenants/_admin_area.de.html.haml | 4 +++- app/views/tenants/_admin_area.html.haml | 4 +++- app/views/tenants/_call_routes.html.haml | 2 +- app/views/tenants/_gateways.html.haml | 8 ++++++++ 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 app/views/tenants/_gateways.html.haml (limited to 'app/views/tenants') diff --git a/app/views/tenants/_admin_area.de.html.haml b/app/views/tenants/_admin_area.de.html.haml index ba64e9a..6a4bef9 100644 --- a/app/views/tenants/_admin_area.de.html.haml +++ b/app/views/tenants/_admin_area.de.html.haml @@ -27,4 +27,6 @@ = succeed '.' do =link_to manufacturer, manufacturer_path(manufacturer) -= render :partial => 'call_routes', :locals => {:tenant => @tenant} \ No newline at end of file += render :partial => 'call_routes', :locals => {:tenant => @tenant} + += render :partial => 'gateways', :locals => {:tenant => @tenant} \ No newline at end of file diff --git a/app/views/tenants/_admin_area.html.haml b/app/views/tenants/_admin_area.html.haml index 50ed372..b974c02 100644 --- a/app/views/tenants/_admin_area.html.haml +++ b/app/views/tenants/_admin_area.html.haml @@ -25,4 +25,6 @@ =link_to manufacturer, manufacturer_path(manufacturer) - else = succeed '.' do - =link_to manufacturer, manufacturer_path(manufacturer) \ No newline at end of file + =link_to manufacturer, manufacturer_path(manufacturer) + += render :partial => 'call_routes', :locals => {:tenant => @tenant} \ No newline at end of file diff --git a/app/views/tenants/_call_routes.html.haml b/app/views/tenants/_call_routes.html.haml index ade24c9..41066ae 100644 --- a/app/views/tenants/_call_routes.html.haml +++ b/app/views/tenants/_call_routes.html.haml @@ -1,7 +1,7 @@ %h2= t("call_routes.index.page_title") - if CallRoute.count <= GsParameter.get('NUMBER_OF_SHOWN_ITEMS') - = render "call_routes/index_core", :call_routes => CallRoute.call + = render "call_routes/index_core", :call_routes => CallRoute.all = render :partial => 'shared/create_link', :locals => {:child_class => CallRoute} - else %p diff --git a/app/views/tenants/_gateways.html.haml b/app/views/tenants/_gateways.html.haml new file mode 100644 index 0000000..c861ad3 --- /dev/null +++ b/app/views/tenants/_gateways.html.haml @@ -0,0 +1,8 @@ +%h2= t("gateways.index.page_title") + +- if Gateway.count <= GsParameter.get('NUMBER_OF_SHOWN_ITEMS') + = render "gateways/index_core", :gateways => Gateway.all + = render :partial => 'shared/create_link', :locals => {:child_class => Gateway} +- else + %p + = link_to t("gateways.index.page_title"), gateways_path \ No newline at end of file -- cgit v1.2.3 From fe5b9f2c046561f9918a5660b4a5193ef66fd3aa Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sun, 20 Jan 2013 20:01:06 +0100 Subject: Replaced some order with reorder within cache key generation. --- app/views/tenants/_gs_parameter_table.html.haml | 6 +++--- app/views/tenants/_table_of_functions.html.haml | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'app/views/tenants') diff --git a/app/views/tenants/_gs_parameter_table.html.haml b/app/views/tenants/_gs_parameter_table.html.haml index 3af06cf..94c44e5 100644 --- a/app/views/tenants/_gs_parameter_table.html.haml +++ b/app/views/tenants/_gs_parameter_table.html.haml @@ -1,4 +1,4 @@ -- cache(['gs_parameters_tenant_overview_table', I18n.locale, tenant, GuiFunction.count, GuiFunction.order(:updated_at).last, GsParameter.count, GsParameter.order(:updated_at).last]) do +- cache(['gs_parameters_tenant_overview_table', I18n.locale, tenant, GuiFunction.count, GuiFunction.reorder(:updated_at).last, GsParameter.count, GsParameter.reorder(:updated_at).last]) do %table %tr{:class => 'even'} %th @@ -14,11 +14,11 @@ %td = link_to GuiFunction.count.to_s, gui_functions_path %td - = l GuiFunction.order(:updated_at).last.updated_at, :format => :short + = l GuiFunction.reorder(:updated_at).last.updated_at, :format => :short %tr{:class => 'even'} %td = t("gs_parameters.name") %td = link_to GsParameter.count.to_s, gs_parameters_path %td - = l GsParameter.order(:updated_at).last.updated_at, :format => :short + = l GsParameter.reorder(:updated_at).last.updated_at, :format => :short diff --git a/app/views/tenants/_table_of_functions.html.haml b/app/views/tenants/_table_of_functions.html.haml index 75b2332..957687b 100644 --- a/app/views/tenants/_table_of_functions.html.haml +++ b/app/views/tenants/_table_of_functions.html.haml @@ -1,4 +1,4 @@ -- cache(['table_of_pbx_features', I18n.locale, tenant, tenant.callthroughs.count, tenant.callthroughs.order(:updated_at).last, tenant.conferences.count, tenant.conferences.order(:updated_at).last, tenant.hunt_groups.count, tenant.hunt_groups.order(:updated_at).last, tenant.automatic_call_distributors.count, tenant.automatic_call_distributors.order(:updated_at).last]) do +- cache(['table_of_pbx_features', I18n.locale, tenant, tenant.callthroughs.count, tenant.callthroughs.reorder(:updated_at).last, tenant.conferences.count, tenant.conferences.reorder(:updated_at).last, tenant.hunt_groups.count, tenant.hunt_groups.reorder(:updated_at).last, tenant.automatic_call_distributors.count, tenant.automatic_call_distributors.reorder(:updated_at).last]) do %table %tr{:class => 'even'} %th @@ -6,7 +6,7 @@ %th Anzahl %th - - cache(['table_of_pbx_features_callthroughs_row', I18n.locale, tenant, tenant.callthroughs.count, tenant.callthroughs.order(:updated_at).last]) do + - cache(['table_of_pbx_features_callthroughs_row', I18n.locale, tenant, tenant.callthroughs.count, tenant.callthroughs.reorder(:updated_at).last]) do %tr{:class => 'odd'} %td = t("callthroughs.name") @@ -17,7 +17,7 @@ = '-' %td = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => Callthrough} - - cache(['table_of_pbx_features_conferences_row', I18n.locale, tenant, tenant.conferences.count, tenant.conferences.order(:updated_at).last]) do + - cache(['table_of_pbx_features_conferences_row', I18n.locale, tenant, tenant.conferences.count, tenant.conferences.reorder(:updated_at).last]) do %tr{:class => 'even'} %td = t("conferences.name") @@ -28,7 +28,7 @@ = '-' %td = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => Conference} - - cache(['table_of_pbx_features_hunt_groups_row', I18n.locale, tenant, tenant.hunt_groups.count, tenant.hunt_groups.order(:updated_at).last]) do + - cache(['table_of_pbx_features_hunt_groups_row', I18n.locale, tenant, tenant.hunt_groups.count, tenant.hunt_groups.reorder(:updated_at).last]) do %tr{:class => 'odd'} %td = t("hunt_groups.name") @@ -39,7 +39,7 @@ = '-' %td = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => HuntGroup} - - cache(['table_of_pbx_features_automatic_call_distributors_row', I18n.locale, tenant, tenant.automatic_call_distributors.count, tenant.automatic_call_distributors.order(:updated_at).last]) do + - cache(['table_of_pbx_features_automatic_call_distributors_row', I18n.locale, tenant, tenant.automatic_call_distributors.count, tenant.automatic_call_distributors.reorder(:updated_at).last]) do %tr{:class => 'even'} %td = t("automatic_call_distributors.name") -- cgit v1.2.3 From 4e67f8769a3a3199bfb5b363fe9baa231c329a2b Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sun, 20 Jan 2013 20:57:35 +0100 Subject: Refactoring --- app/views/tenants/_admin_area.de.html.haml | 32 ------------------------------ app/views/tenants/_admin_area.html.haml | 24 ++++++++++++---------- app/views/tenants/show.html.haml | 4 ++-- 3 files changed, 15 insertions(+), 45 deletions(-) delete mode 100644 app/views/tenants/_admin_area.de.html.haml (limited to 'app/views/tenants') diff --git a/app/views/tenants/_admin_area.de.html.haml b/app/views/tenants/_admin_area.de.html.haml deleted file mode 100644 index 6a4bef9..0000000 --- a/app/views/tenants/_admin_area.de.html.haml +++ /dev/null @@ -1,32 +0,0 @@ -= render :partial => 'tenants/sip_accounts_and_phones', :locals => {:tenant => @tenant} - -= render :partial => 'users_table', :locals => {:tenant => @tenant} - -= render :partial => 'user_groups_table', :locals => {:tenant => @tenant} - -%h2 Features -= render :partial => 'tenants/table_of_functions', :locals => {:tenant => @tenant} - -= render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => @tenant} - -%h2 Gemeinschaft Konfiguration -= render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => @tenant} - -%p - 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 => 'call_routes', :locals => {:tenant => @tenant} - -= render :partial => 'gateways', :locals => {:tenant => @tenant} \ No newline at end of file diff --git a/app/views/tenants/_admin_area.html.haml b/app/views/tenants/_admin_area.html.haml index b974c02..7e7e46b 100644 --- a/app/views/tenants/_admin_area.html.haml +++ b/app/views/tenants/_admin_area.html.haml @@ -1,30 +1,32 @@ -= render :partial => 'tenants/sip_accounts_and_phones', :locals => {:tenant => @tenant} += render :partial => 'tenants/sip_accounts_and_phones', :locals => {:tenant => tenant} -= render :partial => 'users_table', :locals => {:tenant => @tenant} += render :partial => 'users_table', :locals => {:tenant => tenant} -= render :partial => 'user_groups_table', :locals => {:tenant => @tenant} += render :partial => 'user_groups_table', :locals => {:tenant => tenant} %h2 Features -= render :partial => 'tenants/table_of_functions', :locals => {:tenant => @tenant} += render :partial => 'tenants/table_of_functions', :locals => {:tenant => tenant} -= render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => @tenant} += render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => tenant} -%h2 Gemeinschaft Configuration -= render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => @tenant} +%h2 Gemeinschaft Konfiguration += render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => tenant} %p - This system can setup + Das System kann = PhoneModel.count - different phone models from the manufacturers + 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 ' and ' do + = succeed ' und ' do =link_to manufacturer, manufacturer_path(manufacturer) - else = succeed '.' do =link_to manufacturer, manufacturer_path(manufacturer) -= render :partial => 'call_routes', :locals => {:tenant => @tenant} \ No newline at end of file += render :partial => 'call_routes', :locals => {:tenant => tenant} + += render :partial => 'gateways', :locals => {:tenant => tenant, :gateways => gateways} \ No newline at end of file diff --git a/app/views/tenants/show.html.haml b/app/views/tenants/show.html.haml index f5cff5f..9b9d4ec 100644 --- a/app/views/tenants/show.html.haml +++ b/app/views/tenants/show.html.haml @@ -7,5 +7,5 @@ = 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 +- if @tenant.user_groups.where(:name => 'Admins').any? && @tenant.user_groups.where(:name => 'Admins').first.users.include?(current_user) + = render :partial => 'admin_area', :locals => { :tenant => @tenant, :gateways => @gateways} \ No newline at end of file -- cgit v1.2.3 From 18ed88c7e3c789366f6e5443dc4ee0bc981a4b88 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Mon, 21 Jan 2013 20:18:16 +0100 Subject: Started the migration to Twitter Bootstrap. --- app/views/tenants/_gs_parameter_table.html.haml | 8 ++++---- app/views/tenants/_index_core.html.haml | 2 +- app/views/tenants/_sip_accounts_and_phones.html.haml | 8 ++++---- app/views/tenants/_table_of_functions.html.haml | 12 ++++++------ app/views/tenants/edit.html.haml | 2 +- app/views/tenants/index.html.haml | 2 +- app/views/tenants/new.html.haml | 2 +- app/views/tenants/show.html.haml | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) (limited to 'app/views/tenants') diff --git a/app/views/tenants/_gs_parameter_table.html.haml b/app/views/tenants/_gs_parameter_table.html.haml index 94c44e5..407f6e3 100644 --- a/app/views/tenants/_gs_parameter_table.html.haml +++ b/app/views/tenants/_gs_parameter_table.html.haml @@ -1,6 +1,6 @@ - cache(['gs_parameters_tenant_overview_table', I18n.locale, tenant, GuiFunction.count, GuiFunction.reorder(:updated_at).last, GsParameter.count, GsParameter.reorder(:updated_at).last]) do - %table - %tr{:class => 'even'} + %table{:class => 'table table-striped'} + %tr %th Funktion %th @@ -8,14 +8,14 @@ %th Letztes Update - %tr{:class => 'odd'} + %tr %td = t("gui_functions.name") %td = link_to GuiFunction.count.to_s, gui_functions_path %td = l GuiFunction.reorder(:updated_at).last.updated_at, :format => :short - %tr{:class => 'even'} + %tr %td = t("gs_parameters.name") %td diff --git a/app/views/tenants/_index_core.html.haml b/app/views/tenants/_index_core.html.haml index 60afeee..59d7e6d 100644 --- a/app/views/tenants/_index_core.html.haml +++ b/app/views/tenants/_index_core.html.haml @@ -1,4 +1,4 @@ -%table +%table{:class => 'table table-striped'} %tr %th= t('tenants.index.name') %th= t('tenants.index.description') diff --git a/app/views/tenants/_sip_accounts_and_phones.html.haml b/app/views/tenants/_sip_accounts_and_phones.html.haml index 4b84b1c..bcc2dd6 100644 --- a/app/views/tenants/_sip_accounts_and_phones.html.haml +++ b/app/views/tenants/_sip_accounts_and_phones.html.haml @@ -1,12 +1,12 @@ -%table - %tr{:class => 'even'} +%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{:class => 'odd'} + %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 @@ -33,7 +33,7 @@ = 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'} + %tr %td= t("users.index.page_title") %td - if tenant.users_sip_accounts.any? diff --git a/app/views/tenants/_table_of_functions.html.haml b/app/views/tenants/_table_of_functions.html.haml index 957687b..271bf1e 100644 --- a/app/views/tenants/_table_of_functions.html.haml +++ b/app/views/tenants/_table_of_functions.html.haml @@ -1,13 +1,13 @@ - cache(['table_of_pbx_features', I18n.locale, tenant, tenant.callthroughs.count, tenant.callthroughs.reorder(:updated_at).last, tenant.conferences.count, tenant.conferences.reorder(:updated_at).last, tenant.hunt_groups.count, tenant.hunt_groups.reorder(:updated_at).last, tenant.automatic_call_distributors.count, tenant.automatic_call_distributors.reorder(:updated_at).last]) do - %table - %tr{:class => 'even'} + %table{:class => 'table table-striped'} + %tr %th Funktion %th Anzahl %th - cache(['table_of_pbx_features_callthroughs_row', I18n.locale, tenant, tenant.callthroughs.count, tenant.callthroughs.reorder(:updated_at).last]) do - %tr{:class => 'odd'} + %tr %td = t("callthroughs.name") %td @@ -18,7 +18,7 @@ %td = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => Callthrough} - cache(['table_of_pbx_features_conferences_row', I18n.locale, tenant, tenant.conferences.count, tenant.conferences.reorder(:updated_at).last]) do - %tr{:class => 'even'} + %tr %td = t("conferences.name") %td @@ -29,7 +29,7 @@ %td = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => Conference} - cache(['table_of_pbx_features_hunt_groups_row', I18n.locale, tenant, tenant.hunt_groups.count, tenant.hunt_groups.reorder(:updated_at).last]) do - %tr{:class => 'odd'} + %tr %td = t("hunt_groups.name") %td @@ -40,7 +40,7 @@ %td = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => HuntGroup} - cache(['table_of_pbx_features_automatic_call_distributors_row', I18n.locale, tenant, tenant.automatic_call_distributors.count, tenant.automatic_call_distributors.reorder(:updated_at).last]) do - %tr{:class => 'even'} + %tr %td = t("automatic_call_distributors.name") %td diff --git a/app/views/tenants/edit.html.haml b/app/views/tenants/edit.html.haml index 159f4fd..d2e837d 100644 --- a/app/views/tenants/edit.html.haml +++ b/app/views/tenants/edit.html.haml @@ -1,3 +1,3 @@ -- title t("tenants.edit.page_title", :resource => @tenant ) +- content_for :title, t("tenants.edit.page_title", :resource => @tenant ) = render "form" diff --git a/app/views/tenants/index.html.haml b/app/views/tenants/index.html.haml index 1783825..9404f17 100644 --- a/app/views/tenants/index.html.haml +++ b/app/views/tenants/index.html.haml @@ -1,4 +1,4 @@ -- title t("tenants.index.page_title") +- content_for :title, t("tenants.index.page_title") - if @tenants.count > 0 = render "index_core", :tenants => @tenants diff --git a/app/views/tenants/new.html.haml b/app/views/tenants/new.html.haml index dca3809..d57ae36 100644 --- a/app/views/tenants/new.html.haml +++ b/app/views/tenants/new.html.haml @@ -1,3 +1,3 @@ -- title t("tenants.new.page_title") +- content_for :title, t("tenants.new.page_title") = render "form" diff --git a/app/views/tenants/show.html.haml b/app/views/tenants/show.html.haml index 9b9d4ec..53d3307 100644 --- a/app/views/tenants/show.html.haml +++ b/app/views/tenants/show.html.haml @@ -1,4 +1,4 @@ -- title @tenant.name +- content_for :title, @tenant.name - if !@tenant.description.blank? %p -- cgit v1.2.3 From d8fe3b636cab1504cb5d3cb5dc57ed818749ccf5 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Mon, 21 Jan 2013 21:30:48 +0100 Subject: Twitter Bootstrap stuff. --- app/views/tenants/_index_core.html.haml | 4 ++-- app/views/tenants/_table_of_functions.html.haml | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'app/views/tenants') diff --git a/app/views/tenants/_index_core.html.haml b/app/views/tenants/_index_core.html.haml index 59d7e6d..721d624 100644 --- a/app/views/tenants/_index_core.html.haml +++ b/app/views/tenants/_index_core.html.haml @@ -3,9 +3,9 @@ %th= t('tenants.index.name') %th= t('tenants.index.description') - - reset_cycle + - for tenant in tenants - %tr{:class => cycle('odd', 'even')} + %tr %td= tenant.name %td= tenant.description %td diff --git a/app/views/tenants/_table_of_functions.html.haml b/app/views/tenants/_table_of_functions.html.haml index 271bf1e..d7af224 100644 --- a/app/views/tenants/_table_of_functions.html.haml +++ b/app/views/tenants/_table_of_functions.html.haml @@ -12,7 +12,7 @@ = t("callthroughs.name") %td - if tenant.callthroughs.any? - = link_to tenant.callthroughs.count.to_s, tenant_callthroughs_path(tenant) + = link_to Haml::Engine.new("%i.icon-list").render + ' ' + tenant.callthroughs.count.to_s, tenant_callthroughs_path(tenant) - else = '-' %td @@ -23,7 +23,8 @@ = t("conferences.name") %td - if tenant.conferences.any? - = link_to tenant.conferences.count.to_s, tenant_conferences_path(tenant) + + = link_to Haml::Engine.new("%i.icon-list").render + ' ' + tenant.conferences.count.to_s, tenant_conferences_path(tenant) - else = '-' %td @@ -34,7 +35,7 @@ = t("hunt_groups.name") %td - if tenant.hunt_groups.any? - = link_to tenant.hunt_groups.count.to_s, tenant_hunt_groups_path(tenant) + = link_to Haml::Engine.new("%i.icon-list").render + ' ' + tenant.hunt_groups.count.to_s, tenant_hunt_groups_path(tenant) - else = '-' %td @@ -45,7 +46,7 @@ = t("automatic_call_distributors.name") %td - if tenant.automatic_call_distributors.any? - = link_to tenant.automatic_call_distributors.count.to_s, tenant_automatic_call_distributors_path(tenant) + = link_to Haml::Engine.new("%i.icon-list").render + ' ' + tenant.automatic_call_distributors.count.to_s, tenant_automatic_call_distributors_path(tenant) - else = '-' %td -- cgit v1.2.3 From c52babd4346b1a52c28bb7437d0434ecfb9ab70f Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Mon, 21 Jan 2013 22:25:32 +0100 Subject: Twitter Bootstrap stuff. --- app/views/tenants/_admin_area.html.haml | 6 +++--- app/views/tenants/_call_routes.html.haml | 2 +- app/views/tenants/_gs_parameter_table.html.haml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'app/views/tenants') diff --git a/app/views/tenants/_admin_area.html.haml b/app/views/tenants/_admin_area.html.haml index 7e7e46b..627f221 100644 --- a/app/views/tenants/_admin_area.html.haml +++ b/app/views/tenants/_admin_area.html.haml @@ -19,13 +19,13 @@ - Manufacturer.all.each do |manufacturer| - if manufacturer != Manufacturer.last && manufacturer != Manufacturer.limit(Manufacturer.count - 1).last = succeed ', ' do - =link_to manufacturer, manufacturer_path(manufacturer) + =link_to link_to Haml::Engine.new("%i.icon-list").render + ' ' + manufacturer, manufacturer_path(manufacturer) - elsif manufacturer == Manufacturer.limit(Manufacturer.count - 1).last = succeed ' und ' do - =link_to manufacturer, manufacturer_path(manufacturer) + =link_to link_to Haml::Engine.new("%i.icon-list").render + ' ' + manufacturer, manufacturer_path(manufacturer) - else = succeed '.' do - =link_to manufacturer, manufacturer_path(manufacturer) + =link_to link_to Haml::Engine.new("%i.icon-list").render + ' ' + manufacturer, manufacturer_path(manufacturer) = render :partial => 'call_routes', :locals => {:tenant => tenant} diff --git a/app/views/tenants/_call_routes.html.haml b/app/views/tenants/_call_routes.html.haml index 41066ae..28f84bf 100644 --- a/app/views/tenants/_call_routes.html.haml +++ b/app/views/tenants/_call_routes.html.haml @@ -5,4 +5,4 @@ = render :partial => 'shared/create_link', :locals => {:child_class => CallRoute} - else %p - = link_to t("call_routes.index.page_title"), call_routes_path \ No newline at end of file + = link_to link_to Haml::Engine.new("%i.icon-list").render + ' ' + t("call_routes.index.page_title"), call_routes_path \ No newline at end of file diff --git a/app/views/tenants/_gs_parameter_table.html.haml b/app/views/tenants/_gs_parameter_table.html.haml index 407f6e3..8afdb0e 100644 --- a/app/views/tenants/_gs_parameter_table.html.haml +++ b/app/views/tenants/_gs_parameter_table.html.haml @@ -12,13 +12,13 @@ %td = t("gui_functions.name") %td - = link_to GuiFunction.count.to_s, gui_functions_path + = link_to link_to Haml::Engine.new("%i.icon-list").render + ' ' + GuiFunction.count.to_s, gui_functions_path %td = l GuiFunction.reorder(:updated_at).last.updated_at, :format => :short %tr %td = t("gs_parameters.name") %td - = link_to GsParameter.count.to_s, gs_parameters_path + = link_to link_to Haml::Engine.new("%i.icon-list").render + ' ' + GsParameter.count.to_s, gs_parameters_path %td = l GsParameter.reorder(:updated_at).last.updated_at, :format => :short -- cgit v1.2.3 From ee6b680da282d9fe4d630ba27d9f9c646eed24dc Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 22 Jan 2013 12:16:29 +0100 Subject: Fix for #117 --- app/views/tenants/_user_groups_table.de.html.haml | 4 ---- app/views/tenants/_user_groups_table.html.haml | 4 ++++ app/views/tenants/_users_table.de.html.haml | 7 ------- app/views/tenants/_users_table.html.haml | 7 +++++++ 4 files changed, 11 insertions(+), 11 deletions(-) delete mode 100644 app/views/tenants/_user_groups_table.de.html.haml create mode 100644 app/views/tenants/_user_groups_table.html.haml delete mode 100644 app/views/tenants/_users_table.de.html.haml create mode 100644 app/views/tenants/_users_table.html.haml (limited to 'app/views/tenants') diff --git a/app/views/tenants/_user_groups_table.de.html.haml b/app/views/tenants/_user_groups_table.de.html.haml deleted file mode 100644 index 61b3e3d..0000000 --- a/app/views/tenants/_user_groups_table.de.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -- if @tenant.user_groups.any? - %h2= t("user_groups.index.page_title") - = render "user_groups/index_core", :user_groups => tenant.user_groups - = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => UserGroup} diff --git a/app/views/tenants/_user_groups_table.html.haml b/app/views/tenants/_user_groups_table.html.haml new file mode 100644 index 0000000..61b3e3d --- /dev/null +++ b/app/views/tenants/_user_groups_table.html.haml @@ -0,0 +1,4 @@ +- if @tenant.user_groups.any? + %h2= t("user_groups.index.page_title") + = render "user_groups/index_core", :user_groups => tenant.user_groups + = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => UserGroup} diff --git a/app/views/tenants/_users_table.de.html.haml b/app/views/tenants/_users_table.de.html.haml deleted file mode 100644 index 850ea5e..0000000 --- a/app/views/tenants/_users_table.de.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%h2= t("users.index.page_title") -- if @tenant.users.count <= GsParameter.get('NUMBER_OF_SHOWN_ITEMS') - = render "users/index_core", :users => tenant.users - = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => User} -- else - %p - = link_to "Liste aller User.", tenant_users_path(tenant) \ No newline at end of file diff --git a/app/views/tenants/_users_table.html.haml b/app/views/tenants/_users_table.html.haml new file mode 100644 index 0000000..850ea5e --- /dev/null +++ b/app/views/tenants/_users_table.html.haml @@ -0,0 +1,7 @@ +%h2= t("users.index.page_title") +- if @tenant.users.count <= GsParameter.get('NUMBER_OF_SHOWN_ITEMS') + = render "users/index_core", :users => tenant.users + = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => User} +- else + %p + = link_to "Liste aller User.", tenant_users_path(tenant) \ No newline at end of file -- cgit v1.2.3