From 8cea5d1c88e2e13ed99a5c54a1e1b69a5d6a2d01 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 15 Jan 2013 19:05:01 +0100 Subject: Refactoring users#view and added caching. --- app/views/users/_conferences.html.haml | 7 ++ app/views/users/_fax_accounts.html.haml | 7 ++ app/views/users/_phone_books.html.haml | 7 ++ app/views/users/_phones.html.haml | 7 ++ app/views/users/_sip_accounts.html.haml | 7 ++ app/views/users/_tenants.html.haml | 5 ++ app/views/users/_user_groups.html.haml | 8 ++ app/views/users/show.html.haml | 128 ++++++++++++-------------------- 8 files changed, 94 insertions(+), 82 deletions(-) create mode 100644 app/views/users/_conferences.html.haml create mode 100644 app/views/users/_fax_accounts.html.haml create mode 100644 app/views/users/_phone_books.html.haml create mode 100644 app/views/users/_phones.html.haml create mode 100644 app/views/users/_sip_accounts.html.haml create mode 100644 app/views/users/_tenants.html.haml create mode 100644 app/views/users/_user_groups.html.haml (limited to 'app/views/users') 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} -- cgit v1.2.3 From 6b7cbac8a2a274c1839e8ea6aa293d0e6e49d370 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 15 Jan 2013 21:38:22 +0100 Subject: Fixes caching bugs. --- app/views/users/show.html.haml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'app/views/users') diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 5650b13..c3af173 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -2,7 +2,7 @@ #user-show %aside - - cache([I18n.locale, 'show_aside', @user, @user.sip_accounts, @user.conferences]) do + - 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') + ":" @@ -43,18 +43,18 @@ %section = render :partial => 'phone_books', :locals => {:user => @user, :phone_books => @phone_books} - - 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 + - cache(['user_show_overview', I18n.locale, @user, @user.user_groups, @user.sip_accounts, @user.phones, @user.fax_accounts, @user.conferences]) do + - cache(['user_show_user_groups_overview', I18n.locale, @user, @user.user_groups]) do = render :partial => 'user_groups', :locals => {:user => @user, :tenant => @tenant} - - cache([I18n.locale, @user, @user.sip_accounts]) do + - cache(['user_show_sip_accounts_overview', I18n.locale, @user, @user.sip_accounts]) do = render :partial => 'sip_accounts', :locals => {:user => @user} - - cache([I18n.locale, @user, @user.phones]) do + - cache(['user_show_phones_overview', I18n.locale, @user, @user.phones]) do = render :partial => 'phones', :locals => {:user => @user} - - cache([I18n.locale, @user, @user.fax_accounts]) do + - cache(['user_show_fax_accounts_overview', I18n.locale, @user, @user.fax_accounts]) do = render :partial => 'fax_accounts', :locals => {:user => @user} - - cache([I18n.locale, @user, @user.conferences]) do + - cache(['user_show_conferences_overview', I18n.locale, @user, @user.conferences]) do = render :partial => 'conferences', :locals => {:user => @user} -- cgit v1.2.3 From 6635621faeebbc8dd744e0ad71741f9e82aed1f8 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Wed, 16 Jan 2013 07:21:11 +0100 Subject: Show the user_groups in User#view only for Admins. --- app/views/users/show.html.haml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/views/users') diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index c3af173..f74d0a5 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -43,10 +43,12 @@ %section = render :partial => 'phone_books', :locals => {:user => @user, :phone_books => @phone_books} - - cache(['user_show_overview', I18n.locale, @user, @user.user_groups, @user.sip_accounts, @user.phones, @user.fax_accounts, @user.conferences]) do + - 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} + - 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 + - cache(['user_show_sip_accounts_overview', I18n.locale, @user, @user.sip_accounts]) do = render :partial => 'sip_accounts', :locals => {:user => @user} -- cgit v1.2.3 From 7cdcbdc4b851b348bb21e0f2ff437138e8b9884b Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Wed, 16 Jan 2013 21:00:41 +0100 Subject: Added page caching for the gemeinschaft_setup#new page. --- app/views/users/_form_core.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/views/users') diff --git a/app/views/users/_form_core.html.haml b/app/views/users/_form_core.html.haml index 8e18d12..24b15f5 100644 --- a/app/views/users/_form_core.html.haml +++ b/app/views/users/_form_core.html.haml @@ -1,6 +1,6 @@ .inputs - if GuiFunction.display?('name_data_fields_in_user_edit_form', current_user) - = f.input :male, :collection => [[true, t('users.form.gender.male')], [false, t('users.form.gender.female')]], :label_method => :last, :value_method => :first, :label => t('users.form.male.label'), :hint => conditional_hint('users.form.gender.hint'), :label => t('users.form.gender.label'), :as => :radio + = f.input :male, :collection => [[true, t('users.form.gender.male')], [false, t('users.form.gender.female')]], :label_method => :last, :value_method => :first, :label => t('users.form.male.label'), :hint => conditional_hint('users.form.gender.hint'), :label => t('users.form.gender.label'), :as => :radio_buttons = f.input :first_name, :label => t('users.form.first_name.label'), :hint => conditional_hint('users.form.first_name.hint'), :autofocus => true = f.input :middle_name, :label => t('users.form.middle_name.label'), :hint => conditional_hint('users.form.middle_name.hint') = f.input :last_name, :label => t('users.form.last_name.label'), :hint => conditional_hint('users.form.last_name.hint') -- 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/users/_listing.html.haml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/views/users') diff --git a/app/views/users/_listing.html.haml b/app/views/users/_listing.html.haml index 0a97ad1..9b7b653 100644 --- a/app/views/users/_listing.html.haml +++ b/app/views/users/_listing.html.haml @@ -1,8 +1,8 @@ - amount_of_users = users.count - if amount_of_users > 0 - - if amount_of_users < 30 + - if amount_of_users < GsParameter.get('NUMBER_OF_SHOWN_ITEMS') = users.map{|user| user}.join(', ') - else - = users.limit(15).map{|user| user}.join(', ') + ', ' + = users.limit((GsParameter.get('NUMBER_OF_SHOWN_ITEMS') / 2).floor).map{|user| user}.join(', ') + ', ' = '[...]' - = users.offset(amount_of_users - 15).map{|user| user}.join(', ') \ No newline at end of file + = users.offset(amount_of_users - (GsParameter.get('NUMBER_OF_SHOWN_ITEMS') / 2).floor).map{|user| user}.join(', ') \ No newline at end of file -- cgit v1.2.3 From 35b857cd917b2005aef993c40021253abe96e2d2 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Wed, 16 Jan 2013 22:08:19 +0100 Subject: It doesn't make sense to create a tenant.user_group here. #105 --- app/views/users/_user_groups.html.haml | 1 - 1 file changed, 1 deletion(-) (limited to 'app/views/users') diff --git a/app/views/users/_user_groups.html.haml b/app/views/users/_user_groups.html.haml index 7e206b6..81191ae 100644 --- a/app/views/users/_user_groups.html.haml +++ b/app/views/users/_user_groups.html.haml @@ -5,4 +5,3 @@ %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 -- cgit v1.2.3 From 416a9c563ed52b2b4f5350b8a069313f5843489c Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Thu, 17 Jan 2013 09:51:34 +0100 Subject: Cache bug fixed. --- app/views/users/show.html.haml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'app/views/users') diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index f74d0a5..9a0ae02 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -47,16 +47,14 @@ - cache(['user_show_user_groups_overview', I18n.locale, @user, @user.user_groups]) do = render :partial => 'user_groups', :locals => {:user => @user, :tenant => @tenant} - - 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 + - cache(['user_show_sip_accounts_overview', I18n.locale, @user, @user.sip_accounts]) do + = render :partial => 'sip_accounts', :locals => {:user => @user} - - cache(['user_show_sip_accounts_overview', I18n.locale, @user, @user.sip_accounts]) do - = render :partial => 'sip_accounts', :locals => {:user => @user} + - cache(['user_show_phones_overview', I18n.locale, @user, @user.phones]) do + = render :partial => 'phones', :locals => {:user => @user} - - cache(['user_show_phones_overview', I18n.locale, @user, @user.phones]) do - = render :partial => 'phones', :locals => {:user => @user} + - cache(['user_show_fax_accounts_overview', I18n.locale, @user, @user.fax_accounts]) do + = render :partial => 'fax_accounts', :locals => {:user => @user} - - cache(['user_show_fax_accounts_overview', I18n.locale, @user, @user.fax_accounts]) do - = render :partial => 'fax_accounts', :locals => {:user => @user} - - - cache(['user_show_conferences_overview', I18n.locale, @user, @user.conferences]) do - = render :partial => 'conferences', :locals => {:user => @user} + - cache(['user_show_conferences_overview', I18n.locale, @user, @user.conferences]) do + = render :partial => 'conferences', :locals => {:user => @user} -- cgit v1.2.3 From ba4d32db18a7e6dd701dcfb210ec6af062ee2446 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Fri, 18 Jan 2013 11:07:08 +0100 Subject: Added caching for users table. --- app/views/users/_index_core.html.haml | 36 ++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'app/views/users') diff --git a/app/views/users/_index_core.html.haml b/app/views/users/_index_core.html.haml index 51c15de..5d0fd16 100644 --- a/app/views/users/_index_core.html.haml +++ b/app/views/users/_index_core.html.haml @@ -1,18 +1,20 @@ -%table - %tr - %th - %th= t('users.index.user_name') - %th= t('users.index.email') - %th= t('users.index.first_name') - %th= t('users.index.last_name') +- cache(['user_table_row_inner_td', I18n.locale, current_user, users.order(:updated_at).last, users.count]) do + %table + %tr + %th + %th= t('users.index.user_name') + %th= t('users.index.email') + %th= t('users.index.first_name') + %th= t('users.index.last_name') - - reset_cycle - - for user in users - %tr{:class => cycle('odd', 'even')} - %td - = image_tag user.image_url(:mini).to_s if user.image_url(:mini) - %td= user.user_name - %td= user.email - %td= user.first_name - %td= user.last_name - =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => @tenant, :child => user} \ No newline at end of file + - reset_cycle + - for user in users + %tr{:class => cycle('odd', 'even')} + - cache(['user_table_row_inner_td', I18n.locale, current_user, user]) do + %td + = image_tag user.image_url(:mini).to_s if user.image_url(:mini) + %td= user.user_name + %td= user.email + %td= user.first_name + %td= user.last_name + =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => @tenant, :child => user} \ No newline at end of file -- cgit v1.2.3 From d4e7d4a5d5bdb63fbda279dbc8dd2ec495b90907 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Fri, 18 Jan 2013 11:08:34 +0100 Subject: Added GsParameter.get('NUMBER_OF_SHOWN_ITEMS') to the cache key. --- app/views/users/_index_core.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/views/users') diff --git a/app/views/users/_index_core.html.haml b/app/views/users/_index_core.html.haml index 5d0fd16..9376826 100644 --- a/app/views/users/_index_core.html.haml +++ b/app/views/users/_index_core.html.haml @@ -1,4 +1,4 @@ -- cache(['user_table_row_inner_td', I18n.locale, current_user, users.order(:updated_at).last, users.count]) do +- cache(['user_table_row_inner_td', I18n.locale, current_user, users.order(:updated_at).last, users.count, GsParameter.get('NUMBER_OF_SHOWN_ITEMS')]) do %table %tr %th -- 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/users/_index_core.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/views/users') diff --git a/app/views/users/_index_core.html.haml b/app/views/users/_index_core.html.haml index 9376826..5f0cb41 100644 --- a/app/views/users/_index_core.html.haml +++ b/app/views/users/_index_core.html.haml @@ -1,4 +1,4 @@ -- cache(['user_table_row_inner_td', I18n.locale, current_user, users.order(:updated_at).last, users.count, GsParameter.get('NUMBER_OF_SHOWN_ITEMS')]) do +- cache(['user_table_row_inner_td', I18n.locale, current_user, users.reorder(:updated_at).last, users.count, GsParameter.get('NUMBER_OF_SHOWN_ITEMS')]) do %table %tr %th -- 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/users/_index_core.html.haml | 2 +- app/views/users/edit.html.haml | 2 +- app/views/users/index.html.haml | 2 +- app/views/users/new.html.haml | 2 +- app/views/users/show.html.haml | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'app/views/users') diff --git a/app/views/users/_index_core.html.haml b/app/views/users/_index_core.html.haml index 5f0cb41..b364bd2 100644 --- a/app/views/users/_index_core.html.haml +++ b/app/views/users/_index_core.html.haml @@ -1,5 +1,5 @@ - cache(['user_table_row_inner_td', I18n.locale, current_user, users.reorder(:updated_at).last, users.count, GsParameter.get('NUMBER_OF_SHOWN_ITEMS')]) do - %table + %table{:class => 'table table-striped'} %tr %th %th= t('users.index.user_name') diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml index 96272f5..ed79b2c 100644 --- a/app/views/users/edit.html.haml +++ b/app/views/users/edit.html.haml @@ -1,3 +1,3 @@ -- title t("users.edit.page_title", :resource => @user) +- content_for :title, t("users.edit.page_title", :resource => @user) = render "form" diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml index 892e035..8a3d1fc 100644 --- a/app/views/users/index.html.haml +++ b/app/views/users/index.html.haml @@ -1,4 +1,4 @@ -- title t("users.index.page_title") +- content_for :title, t("users.index.page_title") - if @users.count > 0 = render "index_core", :users => @users diff --git a/app/views/users/new.html.haml b/app/views/users/new.html.haml index a014611..64fe55f 100644 --- a/app/views/users/new.html.haml +++ b/app/views/users/new.html.haml @@ -1,3 +1,3 @@ -- title t("users.new.page_title") +- content_for :title, t("users.new.page_title") = render "form" diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 9a0ae02..75eaf54 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -1,7 +1,7 @@ -- title "User: #{@user}" +- content_for :title, "User: #{@user}" -#user-show - %aside +.row + .span3 - 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 @@ -40,7 +40,7 @@ =link_to conference, edit_user_conference_path(@user, conference) - %section + .span9 = render :partial => 'phone_books', :locals => {:user => @user, :phone_books => @phone_books} - if current_user.user_groups.where(:name => 'Admins').any? -- 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/users/_index_core.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/views/users') diff --git a/app/views/users/_index_core.html.haml b/app/views/users/_index_core.html.haml index b364bd2..b492a1d 100644 --- a/app/views/users/_index_core.html.haml +++ b/app/views/users/_index_core.html.haml @@ -7,9 +7,9 @@ %th= t('users.index.first_name') %th= t('users.index.last_name') - - reset_cycle + - for user in users - %tr{:class => cycle('odd', 'even')} + %tr - cache(['user_table_row_inner_td', I18n.locale, current_user, user]) do %td = image_tag user.image_url(:mini).to_s if user.image_url(:mini) -- 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/users/_index_core.html.haml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app/views/users') diff --git a/app/views/users/_index_core.html.haml b/app/views/users/_index_core.html.haml index b492a1d..b0efaef 100644 --- a/app/views/users/_index_core.html.haml +++ b/app/views/users/_index_core.html.haml @@ -6,11 +6,11 @@ %th= t('users.index.email') %th= t('users.index.first_name') %th= t('users.index.last_name') - - + %th{:colspan => '3'} + - for user in users - %tr - - cache(['user_table_row_inner_td', I18n.locale, current_user, user]) do + - cache(['user_table_row', I18n.locale, current_user, user]) do + %tr %td = image_tag user.image_url(:mini).to_s if user.image_url(:mini) %td= user.user_name -- cgit v1.2.3 From 25f7eec8c93630650c2b5f980712261a14b00def Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Mon, 21 Jan 2013 23:44:19 +0100 Subject: Avatar --- app/views/users/_index_core.html.haml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'app/views/users') diff --git a/app/views/users/_index_core.html.haml b/app/views/users/_index_core.html.haml index b0efaef..7f2251a 100644 --- a/app/views/users/_index_core.html.haml +++ b/app/views/users/_index_core.html.haml @@ -11,10 +11,18 @@ - for user in users - cache(['user_table_row', I18n.locale, current_user, user]) do %tr - %td - = image_tag user.image_url(:mini).to_s if user.image_url(:mini) + %td + - if user.image? + =image_tag(user.image_url(:mini).to_s, :class => 'img-rounded') + - else + - if user.male? + = image_tag 'icons/user-male-16x.png', :class => 'img-rounded' + - else + = image_tag 'icons/user-female-16x.png', :class => 'img-rounded' %td= user.user_name - %td= user.email + %td + - if !user.email.blank? + = mail_to user.email, (Haml::Engine.new("%i.icon-envelope").render + ' ' + user.email) %td= user.first_name %td= user.last_name =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => @tenant, :child => user} \ No newline at end of file -- cgit v1.2.3 From f8bc860750f06ab95f9ced8e919e846d3e589819 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 22 Jan 2013 00:02:03 +0100 Subject: Icons --- app/views/users/show.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/views/users') diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 75eaf54..4c39fd1 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -3,7 +3,7 @@ .row .span3 - 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) + = image_tag @user.image_url(:small).to_s, :class => 'img-rounded' if @user.image? && @user.image_url(:small) %p %strong= t('users.show.user_name') + ":" = @user.user_name -- cgit v1.2.3