Added config option to display email in result of user organization selector widget.

This commit is contained in:
Martin Edenhofer 2018-02-20 12:33:13 +01:00
parent 327749c29b
commit 077d631ef2
4 changed files with 77 additions and 1 deletions

View file

@ -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

View file

@ -3,7 +3,11 @@
<%- @Icon(@icon, 'recipientList-icon') %>
</div>
<div class="recipientList-name">
<%= @object.displayName() %>
<% if @realname: %>
<%= @realname %>
<% else: %>
<%= @object.displayName() %>
<% end %>
<% if @object.organization: %>
<span class="recipientList-detail">- <%= @object.organization.displayName() %></span>
<% end %>

View file

@ -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

View file

@ -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',