diff options
Diffstat (limited to 'app/views')
22 files changed, 332 insertions, 279 deletions
diff --git a/app/views/gs_parameters/_index_core.html.haml b/app/views/gs_parameters/_index_core.html.haml index 0c36560..a3f8e1c 100644 --- a/app/views/gs_parameters/_index_core.html.haml +++ b/app/views/gs_parameters/_index_core.html.haml @@ -1,4 +1,4 @@ -- cache([gs_parameters.first.section, gs_parameters.reorder(:updated_at).last, gs_parameters.pluck(:id)]) do +- cache(['gs_parameters_table_section', gs_parameters.first.section, gs_parameters.reorder(:updated_at).last, gs_parameters.pluck(:id)]) do %tr %th= t('gs_parameters.index.name') - if !@sections @@ -7,10 +7,10 @@ - reset_cycle - for gs_parameter in gs_parameters - - cache(gs_parameter) do + - cache(['gs_parameters_table_single_row', gs_parameter]) do %tr{:class => cycle('odd', 'even')} %td= gs_parameter.name - if !@sections %td= gs_parameter.section - %td= gs_parameter.value + %td= truncate(gs_parameter.value, :length => 50) =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => gs_parameter}
\ No newline at end of file diff --git a/app/views/gs_parameters/index.html.haml b/app/views/gs_parameters/index.html.haml index b4a53e8..37fe825 100644 --- a/app/views/gs_parameters/index.html.haml +++ b/app/views/gs_parameters/index.html.haml @@ -1,7 +1,7 @@ - title t("gs_parameters.index.page_title") - if @gs_parameters && @gs_parameters.count > 0 - - cache([@ps_parameters_unordered.order(:updated_at).last, @ps_parameters_unordered.count]) do + - cache(['gs_parameters_table', I18n.locale, @gs_parameters_unordered.order(:updated_at).last, @gs_parameters_unordered.count]) do - if @sections %table - @sections.each do |section| diff --git a/app/views/gui_functions/_index_core.html.haml b/app/views/gui_functions/_index_core.html.haml index 093a0d7..815b9c3 100644 --- a/app/views/gui_functions/_index_core.html.haml +++ b/app/views/gui_functions/_index_core.html.haml @@ -8,19 +8,20 @@ - reset_cycle - for gui_function in gui_functions %tr{:class => cycle('odd', 'even')} - %td= gui_function.category - %td - = gui_function.name - - if !gui_function.description.blank? - %br - %i= gui_function.description - - @user_groups.each do |user_group| - - if gui_function.gui_function_memberships.find_by_user_group_id(user_group.id) - - if gui_function.gui_function_memberships.find_by_user_group_id(user_group.id).activated == true - %td= 'x' + - cache(['gui_functions_table_row', I18n.locale, gui_function]) do + %td= gui_function.category + %td + = gui_function.name + - if !gui_function.description.blank? + %br + %i= gui_function.description + - @user_groups.each do |user_group| + - if gui_function.gui_function_memberships.find_by_user_group_id(user_group.id) + - if gui_function.gui_function_memberships.find_by_user_group_id(user_group.id).activated == true + %td= 'x' + - else + %td= '' - else - %td= '' - - else - %td= 'x' + %td= 'x' - =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => gui_function}
\ No newline at end of file + =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => gui_function}
\ No newline at end of file diff --git a/app/views/gui_functions/index.html.haml b/app/views/gui_functions/index.html.haml index ef909f0..9b53918 100644 --- a/app/views/gui_functions/index.html.haml +++ b/app/views/gui_functions/index.html.haml @@ -1,6 +1,7 @@ - title t("gui_functions.index.page_title") - if @gui_functions && @gui_functions.count > 0 - = render "index_core", :gui_functions => @gui_functions + - cache(['gui_functions_table', I18n.locale, @gui_functions.reorder(:updated_at).last, @gui_functions.count]) do + = render "index_core", :gui_functions => @gui_functions = render :partial => 'shared/create_link', :locals => {:child_class => GuiFunction}
\ No newline at end of file diff --git a/app/views/gui_functions/show.html.haml b/app/views/gui_functions/show.html.haml index 0fc2dd9..8af329a 100644 --- a/app/views/gui_functions/show.html.haml +++ b/app/views/gui_functions/show.html.haml @@ -1,18 +1,19 @@ - title t("gui_functions.show.page_title") -%p - %strong= t('gui_functions.show.name') + ":" - = @gui_function.name -%p - %strong= t('gui_functions.show.description') + ":" - = @gui_function.description - -- @user_groups.each do |user_group| +- cache(['gui_function_show', I18n.locale, @gui_function]) do + %p + %strong= t('gui_functions.show.name') + ":" + = @gui_function.name %p - %strong= "#{user_group}:" - - if @gui_function.gui_function_memberships.where(:user_group_id => user_group.id, :activated => true).count > 0 - = 'x' - - else - = 'not activated' + %strong= t('gui_functions.show.description') + ":" + = @gui_function.description + + - @user_groups.each do |user_group| + %p + %strong= "#{user_group}:" + - if @gui_function.gui_function_memberships.where(:user_group_id => user_group.id, :activated => true).count > 0 + = 'x' + - else + = 'not activated' -= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @gui_function }
\ No newline at end of file + = render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @gui_function }
\ No newline at end of file diff --git a/app/views/phone_book_entries/_index_core.de.html.haml b/app/views/phone_book_entries/_index_core.de.html.haml index 0c6e74b..43d62f6 100644 --- a/app/views/phone_book_entries/_index_core.de.html.haml +++ b/app/views/phone_book_entries/_index_core.de.html.haml @@ -2,39 +2,41 @@ %section.phone-book-entries %header.entries-nav= render :partial => "phone_book_entries/navigation" .content - - reset_cycle - %table - - for entry in phone_book_entries - ~# Dear IE7, - ~# Because of you we have to do this with a table. - ~# With Love, - ~# Mario. - %tr.phone-book-entry{:class => cycle('odd', 'even'), :"itemscope itemtype" => "http://schema.org/Person"} - %td.thumbnail - = image_tag(entry.image_url(:small).to_s, :itemprop => 'image') - %td.user - - if entry.is_organization == true - %a.name{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => "name"}= entry - - else - %a.name{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => "name"}= entry - %a.company{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => 'memberOf'}= entry.organization - %td.contact - - if @found_phone_numbers and @found_phone_numbers.where(:phone_numberable_id => entry.id) - %a.phone{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => 'telephone'}= @found_phone_numbers.where(:phone_numberable_id => entry.id).first - - elsif entry.phone_numbers.first - %a.phone{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => 'telephone'}= entry.phone_numbers.first - - if entry.phone_numbers.count > 1 - %a.more{:href => phone_book_phone_book_entry_path(entry.phone_book, entry)}= t('phone_book_entries.index.more_numbers', :numbers => (entry.phone_numbers.count-1)) - %td.extra - - if !entry.description.blank? - %strong Beschreibung: - %div - = entry.description - - if !entry.homepage_organization.blank? - %br - =link_to entry.homepage_organization, entry.homepage_organization - - if can? :edit, entry - %td= link_to t('phone_book_entries.index.actions.edit'), edit_phone_book_phone_book_entry_path( entry.phone_book, entry ) - - if can? :destroy, entry - %td= link_to t('phone_book_entries.index.actions.destroy'), [entry.phone_book, entry], :confirm => t('phone_book_entries.index.actions.confirm'), :method => :delete + - cache(['phone_book_entries_table', I18n.locale, current_user, phone_book_entries]) do + - reset_cycle + %table + - for entry in phone_book_entries + - cache(['phone_book_entries_table_tr', I18n.locale, current_user, entry]) do + ~# Dear IE7, + ~# Because of you we have to do this with a table. + ~# With Love, + ~# Mario. + %tr.phone-book-entry{:class => cycle('odd', 'even'), :"itemscope itemtype" => "http://schema.org/Person"} + %td.thumbnail + = image_tag(entry.image_url(:small).to_s, :itemprop => 'image') + %td.user + - if entry.is_organization == true + %a.name{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => "name"}= entry + - else + %a.name{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => "name"}= entry + %a.company{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => 'memberOf'}= entry.organization + %td.contact + - if @found_phone_numbers and @found_phone_numbers.where(:phone_numberable_id => entry.id) + %a.phone{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => 'telephone'}= @found_phone_numbers.where(:phone_numberable_id => entry.id).first + - elsif entry.phone_numbers.first + %a.phone{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => 'telephone'}= entry.phone_numbers.first + - if entry.phone_numbers.count > 1 + %a.more{:href => phone_book_phone_book_entry_path(entry.phone_book, entry)}= t('phone_book_entries.index.more_numbers', :numbers => (entry.phone_numbers.count-1)) + %td.extra + - if !entry.description.blank? + %strong Beschreibung: + %div + = entry.description + - if !entry.homepage_organization.blank? + %br + =link_to entry.homepage_organization, entry.homepage_organization + - if can? :edit, entry + %td= link_to t('phone_book_entries.index.actions.edit'), edit_phone_book_phone_book_entry_path( entry.phone_book, entry ) + - if can? :destroy, entry + %td= link_to t('phone_book_entries.index.actions.destroy'), [entry.phone_book, entry], :confirm => t('phone_book_entries.index.actions.confirm'), :method => :delete %footer.entries-nav= render :partial => "phone_book_entries/navigation" diff --git a/app/views/phone_book_entries/_index_core.html.haml b/app/views/phone_book_entries/_index_core.html.haml index 9054833..e98e8d5 100644 --- a/app/views/phone_book_entries/_index_core.html.haml +++ b/app/views/phone_book_entries/_index_core.html.haml @@ -2,39 +2,42 @@ %section.phone-book-entries %header.entries-nav= render :partial => "phone_book_entries/navigation" .content - - reset_cycle - %table - - for entry in phone_book_entries - ~# Dear IE7, - ~# Because of you we have to do this with a table. - ~# With Love, - ~# Mario. - %tr.phone-book-entry{:class => cycle('odd', 'even'), :"itemscope itemtype" => "http://schema.org/Person"} - %td.thumbnail - = image_tag(entry.image_url(:small).to_s, :itemprop => 'image') - %td.user - - if entry.is_organization == true - %a.name{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => "name"}= entry - - else - %a.name{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => "name"}= entry - %a.company{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => 'memberOf'}= entry.organization - %td.contact - - if @found_phone_numbers and @found_phone_numbers.where(:phone_numberable_id => entry.id) - %a.phone{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => 'telephone'}= @found_phone_numbers.where(:phone_numberable_id => entry.id).first - - elsif entry.phone_numbers.first - %a.phone{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => 'telephone'}= entry.phone_numbers.first - - if entry.phone_numbers.count > 1 - %a.more{:href => phone_book_phone_book_entry_path(entry.phone_book, entry)}= t('phone_book_entries.index.more_numbers', :numbers => (entry.phone_numbers.count-1)) - %td.extra - - if !entry.description.blank? - %strong Description: - %div - = entry.description - - if !entry.homepage_organization.blank? - %br - =link_to entry.homepage_organization, entry.homepage_organization - - if can? :edit, entry - %td= link_to t('phone_book_entries.index.actions.edit'), edit_phone_book_phone_book_entry_path( entry.phone_book, entry ) - - if can? :destroy, entry - %td= link_to t('phone_book_entries.index.actions.destroy'), [entry.phone_book, entry], :confirm => t('phone_book_entries.index.actions.confirm'), :method => :delete + - cache(['phone_book_entries_table', I18n.locale, current_user, phone_book_entries]) do + - reset_cycle + - reset_cycle + %table + - for entry in phone_book_entries + - cache(['phone_book_entries_table_tr', I18n.locale, current_user, entry]) do + ~# Dear IE7, + ~# Because of you we have to do this with a table. + ~# With Love, + ~# Mario. + %tr.phone-book-entry{:class => cycle('odd', 'even'), :"itemscope itemtype" => "http://schema.org/Person"} + %td.thumbnail + = image_tag(entry.image_url(:small).to_s, :itemprop => 'image') + %td.user + - if entry.is_organization == true + %a.name{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => "name"}= entry + - else + %a.name{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => "name"}= entry + %a.company{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => 'memberOf'}= entry.organization + %td.contact + - if @found_phone_numbers and @found_phone_numbers.where(:phone_numberable_id => entry.id) + %a.phone{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => 'telephone'}= @found_phone_numbers.where(:phone_numberable_id => entry.id).first + - elsif entry.phone_numbers.first + %a.phone{:href=> phone_book_phone_book_entry_path(entry.phone_book, entry), :itemprop => 'telephone'}= entry.phone_numbers.first + - if entry.phone_numbers.count > 1 + %a.more{:href => phone_book_phone_book_entry_path(entry.phone_book, entry)}= t('phone_book_entries.index.more_numbers', :numbers => (entry.phone_numbers.count-1)) + %td.extra + - if !entry.description.blank? + %strong Description: + %div + = entry.description + - if !entry.homepage_organization.blank? + %br + =link_to entry.homepage_organization, entry.homepage_organization + - if can? :edit, entry + %td= link_to t('phone_book_entries.index.actions.edit'), edit_phone_book_phone_book_entry_path( entry.phone_book, entry ) + - if can? :destroy, entry + %td= link_to t('phone_book_entries.index.actions.destroy'), [entry.phone_book, entry], :confirm => t('phone_book_entries.index.actions.confirm'), :method => :delete %footer.entries-nav= render :partial => "phone_book_entries/navigation" diff --git a/app/views/tenants/_admin_area.de.html.haml b/app/views/tenants/_admin_area.de.html.haml index d111c9d..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')) @@ -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..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')) @@ -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..3af06cf --- /dev/null +++ b/app/views/tenants/_gs_parameter_table.html.haml @@ -0,0 +1,24 @@ +- 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 + 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/_sip_accounts_and_phones.html.haml b/app/views/tenants/_sip_accounts_and_phones.html.haml index f9d26f9..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([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([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/_table_of_functions.html.haml b/app/views/tenants/_table_of_functions.html.haml index 79ea2b1..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, GuiFunction.count, GuiFunction.order(:updated_at).last, GsParameter.count, GsParameter.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,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(['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") + %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(['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") + %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(['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") + %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(['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") + %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..6baca58 100644 --- a/app/views/tenants/_table_of_phone_books.html.haml +++ b/app/views/tenants/_table_of_phone_books.html.haml @@ -1,8 +1,7 @@ -- 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) - 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 diff --git a/app/views/tenants/show.html.haml b/app/views/tenants/show.html.haml index cb2b895..10845cf 100644 --- a/app/views/tenants/show.html.haml +++ b/app/views/tenants/show.html.haml @@ -1,14 +1,15 @@ - title t("tenants.show.page_title") -%p - %strong= t('tenants.show.name') + ":" - = @tenant.name -- if !@tenant.description.blank? +- cache(['tenant_show_name_and_description', I18n.locale, @tenant, current_user]) do %p - %strong= t('tenants.show.description') + ":" - = @tenant.description + %strong= t('tenants.show.name') + ":" + = @tenant.name + - if !@tenant.description.blank? + %p + %strong= t('tenants.show.description') + ":" + = @tenant.description -= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @tenant } + = render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @tenant } - if @tenant.user_groups.where(:name => 'Admins').count > 0 && @tenant.user_groups.where(:name => 'Admins').first.users.include?(current_user) = render 'admin_area'
\ No newline at end of file diff --git a/app/views/users/_conferences.html.haml b/app/views/users/_conferences.html.haml new file mode 100644 index 0000000..b9592b6 --- /dev/null +++ b/app/views/users/_conferences.html.haml @@ -0,0 +1,7 @@ +-# Conferences +-# +- if (can?( :index, Conference ) && user.conferences.count > 0 ) || can?( :create, Conference ) + %h2= t('conferences.index.page_title') + - if can?( :index, Conference ) && user.conferences.count > 0 + = render "conferences/index_core", :conferences => user.conferences + = render :partial => 'shared/create_link', :locals => {:parent => user, :child_class => Conference}
\ No newline at end of file diff --git a/app/views/users/_fax_accounts.html.haml b/app/views/users/_fax_accounts.html.haml new file mode 100644 index 0000000..044b8f9 --- /dev/null +++ b/app/views/users/_fax_accounts.html.haml @@ -0,0 +1,7 @@ +-# FaxAccount +-# +- if (can?( :index, FaxAccount ) && user.fax_accounts.count > 0 ) || can?( :create, FaxAccount ) + %h2= t('fax_accounts.index.page_title') + - if can?( :index, FaxAccount ) && user.fax_accounts.count > 0 + = render "fax_accounts/index_core", {:fax_accounts => user.fax_accounts, :fax_accountable => user} + = render :partial => 'shared/create_link', :locals => {:parent => user, :child_class => FaxAccount}
\ No newline at end of file diff --git a/app/views/users/_phone_books.html.haml b/app/views/users/_phone_books.html.haml new file mode 100644 index 0000000..4943bc6 --- /dev/null +++ b/app/views/users/_phone_books.html.haml @@ -0,0 +1,7 @@ +-# 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 => phone_books + = render :partial => 'shared/create_link', :locals => {:parent => user, :child_class => PhoneBook}
\ No newline at end of file diff --git a/app/views/users/_phones.html.haml b/app/views/users/_phones.html.haml new file mode 100644 index 0000000..e001eae --- /dev/null +++ b/app/views/users/_phones.html.haml @@ -0,0 +1,7 @@ +-# Phones +-# +- if (can?( :index, Phone, :phoneable => user ) && user.phones.count > 0 ) || can?( :create, Phone, :phoneable => user ) + %h2= t('phones.index.page_title') + - if can?( :index, Phone, :phoneable => user ) && user.phones.count > 0 + = render "phones/index_core", :phones => user.phones + = render :partial => 'shared/create_link', :locals => {:parent => user, :child_class => Phone}
\ No newline at end of file diff --git a/app/views/users/_sip_accounts.html.haml b/app/views/users/_sip_accounts.html.haml new file mode 100644 index 0000000..1861105 --- /dev/null +++ b/app/views/users/_sip_accounts.html.haml @@ -0,0 +1,7 @@ +-# SIP accounts +-# +- if (can?( :index, SipAccount ) && user.sip_accounts.count > 0 ) || can?( :create, SipAccount ) + %h2= t('sip_accounts.index.page_title') + - if can?( :index, SipAccount ) && user.sip_accounts.count > 0 + = render "sip_accounts/index_core", :sip_accounts => user.sip_accounts + = render :partial => 'shared/create_link', :locals => {:parent => user, :child_class => SipAccount}
\ No newline at end of file diff --git a/app/views/users/_tenants.html.haml b/app/views/users/_tenants.html.haml new file mode 100644 index 0000000..49a2d9b --- /dev/null +++ b/app/views/users/_tenants.html.haml @@ -0,0 +1,5 @@ +-# Tenants +-# +- if can?( :index, Tenant ) && user.tenants.count > 1 + %h2=t("tenants.index.page_title") + = render "tenants/index_core", :tenants => user.tenants
\ No newline at end of file diff --git a/app/views/users/_user_groups.html.haml b/app/views/users/_user_groups.html.haml new file mode 100644 index 0000000..7e206b6 --- /dev/null +++ b/app/views/users/_user_groups.html.haml @@ -0,0 +1,8 @@ +-# User groups (only if the current user can edit or destroy them) +-# +- if user.user_groups.map{ |x| can?( :edit, x ) || can?( :destroy, x ) }.include?(true) + - if can?( :index, UserGroup ) + %h2=t("user_groups.index.page_title") + - if user.user_groups.count > 0 + = render "user_groups/index_core", :user_groups => user.user_groups.where(:tenant_id => tenant.id).order(:name) + = render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => UserGroup}
\ No newline at end of file diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 7730447..f74d0a5 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -2,95 +2,61 @@ #user-show %aside - = image_tag @user.image_url(:small).to_s, class: 'display' if @user.image? && @user.image_url(:small) - %p - %strong= t('users.show.user_name') + ":" - = @user.user_name - %p - %strong= t('users.show.email') + ":" - = @user.email - - %p.controls - = render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @tenant, :child => @user } - - - @user.sip_accounts.each do |sip_account| - - phone_number = sip_account.phone_numbers.order(:number).last - - if phone_number && !phone_number.number.blank? && phone_number.number[0] != '+' - %p - %strong= sip_account.phone_numbers.order(:number).last.number - %p - =link_to t("call_histories.index.page_title"), sip_account_call_histories_path(sip_account) - %br - =link_to t("voicemail_messages.index.page_title"), sip_account_voicemail_messages_path(sip_account) - %br - =link_to t("call_forwards.index.page_title"), phone_number_call_forwards_path(phone_number) - %br - =link_to t("voicemail_settings.index.page_title"), sip_account_voicemail_settings_path(sip_account) - %br - =link_to t("softkeys.index.page_title"), sip_account_softkeys_path(sip_account) - %br - =link_to t("ringtones.show.page_title"), phone_number_ringtones_path(phone_number) - - - if @user.conferences.any? + - cache(['user_show_aside', I18n.locale, @user, @user.sip_accounts, @user.conferences]) do + = image_tag @user.image_url(:small).to_s, class: 'display' if @user.image? && @user.image_url(:small) + %p + %strong= t('users.show.user_name') + ":" + = @user.user_name %p - %strong= t("conferences.index.page_title") - - @user.conferences.each do |conference| + %strong= t('users.show.email') + ":" + = @user.email + + %p.controls + = render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @tenant, :child => @user } + + - @user.sip_accounts.each do |sip_account| + - phone_number = sip_account.phone_numbers.order(:number).last + - if phone_number && !phone_number.number.blank? && phone_number.number[0] != '+' + %p + %strong= sip_account.phone_numbers.order(:number).last.number + %p + =link_to t("call_histories.index.page_title"), sip_account_call_histories_path(sip_account) + %br + =link_to t("voicemail_messages.index.page_title"), sip_account_voicemail_messages_path(sip_account) + %br + =link_to t("call_forwards.index.page_title"), phone_number_call_forwards_path(phone_number) + %br + =link_to t("voicemail_settings.index.page_title"), sip_account_voicemail_settings_path(sip_account) + %br + =link_to t("softkeys.index.page_title"), sip_account_softkeys_path(sip_account) + %br + =link_to t("ringtones.show.page_title"), phone_number_ringtones_path(phone_number) + + - if @user.conferences.any? %p - =link_to conference, edit_user_conference_path(@user, conference) + %strong= t("conferences.index.page_title") + - @user.conferences.each do |conference| + %p + =link_to conference, edit_user_conference_path(@user, conference) %section - -# 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 => @phone_books - = render :partial => 'shared/create_link', :locals => {:parent => @user, :child_class => PhoneBook} + = render :partial => 'phone_books', :locals => {:user => @user, :phone_books => @phone_books} - -# User groups (only if the current user can edit or destroy them) - -# - - if @user.user_groups.map{ |x| can?( :edit, x ) || can?( :destroy, x ) }.include?(true) - - if can?( :index, UserGroup ) - %h2=t("user_groups.index.page_title") - - if @user.user_groups.count > 0 - = render "user_groups/index_core", :user_groups => @user.user_groups.where(:tenant_id => @tenant.id).order(:name) - = render :partial => 'shared/create_link', :locals => {:parent => @tenant, :child_class => UserGroup} + - if current_user.user_groups.where(:name => 'Admins').any? + - cache(['user_show_user_groups_overview', I18n.locale, @user, @user.user_groups]) do + = render :partial => 'user_groups', :locals => {:user => @user, :tenant => @tenant} - -# SIP accounts - -# - - if (can?( :index, SipAccount ) && @user.sip_accounts.count > 0 ) || can?( :create, SipAccount ) - %h2= t('sip_accounts.index.page_title') - - if can?( :index, SipAccount ) && @user.sip_accounts.count > 0 - = render "sip_accounts/index_core", :sip_accounts => @user.sip_accounts - = render :partial => 'shared/create_link', :locals => {:parent => @user, :child_class => SipAccount} + - cache(['user_show_overview_for_sip_account_phones_fax_accounts_and_conferences', I18n.locale, @user, @user.sip_accounts, @user.phones, @user.fax_accounts, @user.conferences]) do - -# Phones - -# - - if (can?( :index, Phone, :phoneable => @user ) && @user.phones.count > 0 ) || can?( :create, Phone, :phoneable => @user ) - %h2= t('phones.index.page_title') - - if can?( :index, Phone, :phoneable => @user ) && @user.phones.count > 0 - = render "phones/index_core", :phones => @user.phones - = render :partial => 'shared/create_link', :locals => {:parent => @user, :child_class => Phone} + - cache(['user_show_sip_accounts_overview', I18n.locale, @user, @user.sip_accounts]) do + = render :partial => 'sip_accounts', :locals => {:user => @user} - -# FaxAccount - -# - - if (can?( :index, FaxAccount ) && @user.fax_accounts.count > 0 ) || can?( :create, FaxAccount ) - %h2= t('fax_accounts.index.page_title') - - if can?( :index, FaxAccount ) && @user.fax_accounts.count > 0 - = render "fax_accounts/index_core", {:fax_accounts => @user.fax_accounts, :fax_accountable => @user} - = render :partial => 'shared/create_link', :locals => {:parent => @user, :child_class => FaxAccount} + - cache(['user_show_phones_overview', I18n.locale, @user, @user.phones]) do + = render :partial => 'phones', :locals => {:user => @user} - -# Conferences - -# - - if (can?( :index, Conference ) && @user.conferences.count > 0 ) || can?( :create, Conference ) - %h2= t('conferences.index.page_title') - - if can?( :index, Conference ) && @user.conferences.count > 0 - = render "conferences/index_core", :conferences => @user.conferences - = render :partial => 'shared/create_link', :locals => {:parent => @user, :child_class => Conference} + - cache(['user_show_fax_accounts_overview', I18n.locale, @user, @user.fax_accounts]) do + = render :partial => 'fax_accounts', :locals => {:user => @user} - -# Tenants - -# - - if can?( :index, Tenant ) && @user.tenants.count > 1 - %h2=t("tenants.index.page_title") - = render "tenants/index_core", :tenants => @user.tenants
\ No newline at end of file + - cache(['user_show_conferences_overview', I18n.locale, @user, @user.conferences]) do + = render :partial => 'conferences', :locals => {:user => @user} |