summaryrefslogtreecommitdiff
path: root/app/views/users
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/users')
-rw-r--r--app/views/users/_conferences.html.haml7
-rw-r--r--app/views/users/_fax_accounts.html.haml7
-rw-r--r--app/views/users/_phone_books.html.haml7
-rw-r--r--app/views/users/_phones.html.haml7
-rw-r--r--app/views/users/_sip_accounts.html.haml7
-rw-r--r--app/views/users/_tenants.html.haml5
-rw-r--r--app/views/users/_user_groups.html.haml8
-rw-r--r--app/views/users/show.html.haml128
8 files changed, 94 insertions, 82 deletions
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..5650b13 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -2,95 +2,59 @@
#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([I18n.locale, 'show_aside', @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}
-
- -# 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}
+ = render :partial => 'phone_books', :locals => {:user => @user, :phone_books => @phone_books}
- -# 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([I18n.locale, @user, @user.user_groups, @user.sip_accounts, @user.phones, @user.fax_accounts, @user.conferences]) do
+ - cache([I18n.locale, @user, @user.user_groups]) do
+ = render :partial => 'user_groups', :locals => {:user => @user, :tenant => @tenant}
- -# 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([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([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([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([I18n.locale, @user, @user.conferences]) do
+ = render :partial => 'conferences', :locals => {:user => @user}