diff --git a/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.coffee b/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.coffee index ca9578fba..3a8f1e997 100644 --- a/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.coffee +++ b/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.coffee @@ -13,6 +13,17 @@ class App.UserOrganizationAutocompletion extends App.ObjectOrganizationAutocompl container: @el.closest('.content') ) + buildObjectItem: (object) => + realname = object.displayName() + if @Config.get('ui_user_organization_selector_with_email') && !_.isEmpty(object.email) + realname += " <#{object.email}>" + + App.view(@templateObjectItem)( + realname: realname + object: object + icon: @objectIcon + ) + class UserNew extends App.ControllerModal buttonClose: true buttonCancel: true diff --git a/app/assets/javascripts/app/views/generic/object_search/item_object.jst.eco b/app/assets/javascripts/app/views/generic/object_search/item_object.jst.eco index 62c3f1055..dc5747319 100644 --- a/app/assets/javascripts/app/views/generic/object_search/item_object.jst.eco +++ b/app/assets/javascripts/app/views/generic/object_search/item_object.jst.eco @@ -3,7 +3,11 @@ <%- @Icon(@icon, 'recipientList-icon') %>
- <%= @object.displayName() %> + <% if @realname: %> + <%= @realname %> + <% else: %> + <%= @object.displayName() %> + <% end %> <% if @object.organization: %> - <%= @object.organization.displayName() %> <% end %> diff --git a/db/migrate/20180220000002_setting_user_organization_selector_with_email.rb b/db/migrate/20180220000002_setting_user_organization_selector_with_email.rb new file mode 100644 index 000000000..a55edcd63 --- /dev/null +++ b/db/migrate/20180220000002_setting_user_organization_selector_with_email.rb @@ -0,0 +1,34 @@ +class SettingUserOrganizationSelectorWithEmail < ActiveRecord::Migration[5.1] + def up + + # return if it's a new setup + return if !Setting.find_by(name: 'system_init_done') + Setting.create_if_not_exists( + title: 'User Organization Selector - email', + name: 'ui_user_organization_selector_with_email', + area: 'UI::UserOrganizatiomSelector', + description: 'Display of the e-mail in the result of the user/organization widget.', + options: { + form: [ + { + display: '', + null: true, + name: 'ui_user_organization_selector_with_email', + tag: 'boolean', + translate: true, + options: { + true => 'yes', + false => 'no', + }, + }, + ], + }, + state: false, + preferences: { + prio: 100, + permission: ['admin.ui'], + }, + frontend: true + ) + end +end diff --git a/db/seeds/settings.rb b/db/seeds/settings.rb index e7d504abc..c0c8458e2 100644 --- a/db/seeds/settings.rb +++ b/db/seeds/settings.rb @@ -590,6 +590,33 @@ Setting.create_if_not_exists( }, frontend: true ) +Setting.create_if_not_exists( + title: 'User Organization Selector - email', + name: 'ui_user_organization_selector_with_email', + area: 'UI::UserOrganizatiomSelector', + description: 'Display of the e-mail in the result of the user/organization widget.', + options: { + form: [ + { + display: '', + null: true, + name: 'ui_user_organization_selector_with_email', + tag: 'boolean', + translate: true, + options: { + true => 'yes', + false => 'no', + }, + }, + ], + }, + state: false, + preferences: { + prio: 100, + permission: ['admin.ui'], + }, + frontend: true +) Setting.create_if_not_exists( title: 'Note - default visibility', name: 'ui_ticket_zoom_article_note_new_internal',