Extended the fix for issue #2233 to cover User objects as well. Also added hiding of empty string attribute fields.
This commit is contained in:
parent
9c02d2e02b
commit
280ab7471f
4 changed files with 94 additions and 5 deletions
|
@ -32,7 +32,7 @@ class App.WidgetOrganization extends App.Controller
|
||||||
if ( organization[name]? || attributeConfig.tag is 'richtext' ) && attributeConfig.shown
|
if ( organization[name]? || attributeConfig.tag is 'richtext' ) && attributeConfig.shown
|
||||||
|
|
||||||
# do not show firstname and lastname / already show via diplayName()
|
# do not show firstname and lastname / already show via diplayName()
|
||||||
if name isnt 'name'
|
if name isnt 'name' && organization[name] isnt ''
|
||||||
organizationData.push attributeConfig
|
organizationData.push attributeConfig
|
||||||
|
|
||||||
# insert userData
|
# insert userData
|
||||||
|
|
|
@ -31,10 +31,10 @@ class App.WidgetUser extends App.Controller
|
||||||
name = nameNew
|
name = nameNew
|
||||||
|
|
||||||
# add to show if value exists
|
# add to show if value exists
|
||||||
if ( user[name] || attributeConfig.tag is 'richtext' ) && attributeConfig.shown
|
if ( user[name]? || attributeConfig.tag is 'richtext' ) && attributeConfig.shown
|
||||||
|
|
||||||
# do not show firstname and lastname / already show via displayName()
|
# do not show firstname and lastname / already show via displayName()
|
||||||
if name isnt 'firstname' && name isnt 'lastname' && name isnt 'organization'
|
if name isnt 'firstname' && name isnt 'lastname' && name isnt 'organization' && user[name] isnt ''
|
||||||
userData.push attributeConfig
|
userData.push attributeConfig
|
||||||
|
|
||||||
if user.preferences
|
if user.preferences
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<h3 title="<%- @Ti('Name') %>"><%= @user.displayName() %></h3>
|
<h3 title="<%- @Ti('Name') %>"><%= @user.displayName() %></h3>
|
||||||
</div>
|
</div>
|
||||||
<% for row in @userData: %>
|
<% for row in @userData: %>
|
||||||
<% if @user[row.name] || row.name is 'note': %>
|
<% if @user[row.name]? || row.name is 'note': %>
|
||||||
<div class="sidebar-block">
|
<div class="sidebar-block">
|
||||||
<label><%- @T(row.display) %></label>
|
<label><%- @T(row.display) %></label>
|
||||||
<% if row.tag isnt 'richtext': %>
|
<% if row.tag isnt 'richtext': %>
|
||||||
|
|
|
@ -775,7 +775,7 @@ class AdminObjectManagerTest < TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
# verify fix for issue #2233 - Boolean object set to false is not visible
|
# verify fix for issue #2233 - Boolean object set to false is not visible
|
||||||
def test_false_boolean_attributes_gets_displayed
|
def test_false_boolean_attributes_gets_displayed_for_organizations
|
||||||
@browser = browser_instance
|
@browser = browser_instance
|
||||||
login(
|
login(
|
||||||
username: 'master@example.com',
|
username: 'master@example.com',
|
||||||
|
@ -800,6 +800,14 @@ class AdminObjectManagerTest < TestCase
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
object_manager_attribute_create(
|
||||||
|
data: {
|
||||||
|
object: 'Organization',
|
||||||
|
name: 'text_test',
|
||||||
|
display: 'text_test',
|
||||||
|
data_type: 'Text',
|
||||||
|
},
|
||||||
|
)
|
||||||
object_manager_attribute_migrate
|
object_manager_attribute_migrate
|
||||||
|
|
||||||
ticket_open_by_title(title: 'select')
|
ticket_open_by_title(title: 'select')
|
||||||
|
@ -817,6 +825,10 @@ class AdminObjectManagerTest < TestCase
|
||||||
css: '.content.active .sidebar[data-tab="organization"] .sidebar-content',
|
css: '.content.active .sidebar[data-tab="organization"] .sidebar-content',
|
||||||
value: 'bool_test',
|
value: 'bool_test',
|
||||||
)
|
)
|
||||||
|
match_not(
|
||||||
|
css: '.content.active .sidebar[data-tab="organization"] .sidebar-content',
|
||||||
|
value: 'text_test',
|
||||||
|
)
|
||||||
|
|
||||||
object_manager_attribute_delete(
|
object_manager_attribute_delete(
|
||||||
data: {
|
data: {
|
||||||
|
@ -824,6 +836,83 @@ class AdminObjectManagerTest < TestCase
|
||||||
name: 'bool_test',
|
name: 'bool_test',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
object_manager_attribute_delete(
|
||||||
|
data: {
|
||||||
|
object: 'Organization',
|
||||||
|
name: 'text_test',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
object_manager_attribute_migrate
|
||||||
|
end
|
||||||
|
|
||||||
|
# verify fix for issue #2233 - Boolean object set to false is not visible
|
||||||
|
def test_false_boolean_attributes_gets_displayed_for_users
|
||||||
|
@browser = browser_instance
|
||||||
|
login(
|
||||||
|
username: 'master@example.com',
|
||||||
|
password: 'test',
|
||||||
|
url: browser_url,
|
||||||
|
)
|
||||||
|
tasks_close_all()
|
||||||
|
|
||||||
|
object_manager_attribute_create(
|
||||||
|
data: {
|
||||||
|
object: 'User',
|
||||||
|
name: 'bool_test',
|
||||||
|
display: 'bool_test',
|
||||||
|
data_type: 'Boolean',
|
||||||
|
data_option: {
|
||||||
|
options: {
|
||||||
|
# rubocop:disable Lint/BooleanSymbol
|
||||||
|
true: 'YES',
|
||||||
|
false: 'NO',
|
||||||
|
# rubocop:enable Lint/BooleanSymbol
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
object_manager_attribute_create(
|
||||||
|
data: {
|
||||||
|
object: 'User',
|
||||||
|
name: 'text_test',
|
||||||
|
display: 'text_test',
|
||||||
|
data_type: 'Text',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
object_manager_attribute_migrate
|
||||||
|
|
||||||
|
ticket_open_by_title(title: 'select')
|
||||||
|
|
||||||
|
click( css: '.content.active .tabsSidebar-tab[data-tab="customer"]' )
|
||||||
|
click( css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle' )
|
||||||
|
click( css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]' )
|
||||||
|
|
||||||
|
modal_ready
|
||||||
|
select(css: '.content.active .modal select[name="bool_test"]', value: 'NO')
|
||||||
|
click( css: '.content.active .modal .js-submit' )
|
||||||
|
modal_disappear
|
||||||
|
|
||||||
|
watch_for(
|
||||||
|
css: '.content.active .sidebar[data-tab="customer"] .sidebar-content',
|
||||||
|
value: 'bool_test',
|
||||||
|
)
|
||||||
|
match_not(
|
||||||
|
css: '.content.active .sidebar[data-tab="customer"] .sidebar-content',
|
||||||
|
value: 'text_test',
|
||||||
|
)
|
||||||
|
|
||||||
|
object_manager_attribute_delete(
|
||||||
|
data: {
|
||||||
|
object: 'User',
|
||||||
|
name: 'bool_test',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
object_manager_attribute_delete(
|
||||||
|
data: {
|
||||||
|
object: 'User',
|
||||||
|
name: 'text_test',
|
||||||
|
},
|
||||||
|
)
|
||||||
object_manager_attribute_migrate
|
object_manager_attribute_migrate
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue