diff --git a/app/assets/javascripts/app/controllers/_application_controller.js.coffee b/app/assets/javascripts/app/controllers/_application_controller.js.coffee index ba98ea5a1..19edb08df 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.js.coffee @@ -263,35 +263,33 @@ class App.Controller extends Spine.Controller placement: position title: -> user_id = $(@).data('id') - user = App.User.fullLocal( user_id ) + user = App.User.fullLocal( user_id ) HTMLEscape( user.displayName() ) content: -> user_id = $(@).data('id') - user = App.User.fullLocal( user_id ) + user = App.User.fullLocal( user_id ) # get display data - data = [] - for item2 in App.User.configure_attributes - item = _.clone( item2 ) + userData = [] + for attributeName, attributeConfig of App.User.attributesGet('view') # check if value for _id exists - itemNameValue = item.name - itemNameValueNew = itemNameValue.substr( 0, itemNameValue.length - 3 ) - if itemNameValueNew of user - item.name = itemNameValueNew + name = attributeName + nameNew = name.substr( 0, name.length - 3 ) + if nameNew of user + name = nameNew # add to show if value exists - if user[item.name] + if user[name] && attributeConfig.shown # do not show firstname and lastname / already show via diplayName() - if item.name isnt 'firstname' && item.name isnt 'lastname' && item.name isnt 'organization' - if item.info #&& ( @user[item.name] || item.name isnt 'note' ) - data.push item + if name isnt 'firstname' && name isnt 'lastname' && name isnt 'organization' + userData.push attributeConfig # insert data App.view('popover/user')( - user: user, - data: data, + user: user + userData: userData ) ) @@ -312,14 +310,33 @@ class App.Controller extends Spine.Controller placement: position title: -> organization_id = $(@).data('id') - organization = App.Organization.fullLocal( organization_id ) + organization = App.Organization.fullLocal( organization_id ) HTMLEscape( organization.name ) content: -> organization_id = $(@).data('id') - organization = App.Organization.fullLocal( organization_id ) + organization = App.Organization.fullLocal( organization_id ) + + # get display data + organizationData = [] + for attributeName, attributeConfig of App.Organization.attributesGet('view') + + # check if value for _id exists + name = attributeName + nameNew = name.substr( 0, name.length - 3 ) + if nameNew of organization + name = nameNew + + # add to show if value exists + if organization[name] && attributeConfig.shown + + # do not show firstname and lastname / already show via diplayName() + if name isnt 'name' + organizationData.push attributeConfig + # insert data App.view('popover/organization')( - organization: organization, + organization: organization, + organizationData: organizationData, ) ) diff --git a/app/assets/javascripts/app/controllers/ticket_overview.js.coffee b/app/assets/javascripts/app/controllers/ticket_overview.js.coffee index 111ee5c0a..939026500 100644 --- a/app/assets/javascripts/app/controllers/ticket_overview.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_overview.js.coffee @@ -202,6 +202,11 @@ class Table extends App.ControllerContent attribute.data = id: refObject.id value + callbackOrganizationPopover = (value, object, attribute, attributes, refObject) => + attribute.class = 'organization-popover' + attribute.data = + id: refObject.id + value callbackCheckbox = (id, checked, e) => if @el.find('table').find('input[name="bulk"]:checked').length == 0 @el.find('.bulkAction').addClass('hide') @@ -243,6 +248,8 @@ class Table extends App.ControllerContent [ callbackIcon ] customer_id: [ callbackUserPopover ] + organization_id: + [ callbackOrganizationPopover ] owner_id: [ callbackUserPopover ] title: @@ -259,6 +266,9 @@ class Table extends App.ControllerContent # start user popups @userPopups() + # start organization popups + @organizationPopups() + # show frontend times @frontendTimeUpdate() diff --git a/app/assets/javascripts/app/views/popover/organization.jst.eco b/app/assets/javascripts/app/views/popover/organization.jst.eco index 25b38eb0f..98fc357ed 100644 --- a/app/assets/javascripts/app/views/popover/organization.jst.eco +++ b/app/assets/javascripts/app/views/popover/organization.jst.eco @@ -1,18 +1,18 @@ - - - - - - - - - -
<%- @T( 'Shared' ) %><%- @P( @organization.shared ) %>
<%- @T( 'Note' ) %><%- @P( @organization.note ) %>
-<% if @organization.users: %> -<%- @T('Users') %> - <% end %> +<% if @organization.members: %> +
+ <%- @T('Members') %> + +<% end %> \ No newline at end of file diff --git a/app/assets/javascripts/app/views/popover/user.jst.eco b/app/assets/javascripts/app/views/popover/user.jst.eco index 006a5553a..99e8336dd 100644 --- a/app/assets/javascripts/app/views/popover/user.jst.eco +++ b/app/assets/javascripts/app/views/popover/user.jst.eco @@ -1,13 +1,16 @@ -<% for row in @data: %> - <% if @user[row.name]: %> -
<%- @L( @P( @user[row.name] ) ) %>
- <% end %> -<% end %> <% if @user['organization']: %> -
- <%- @T( 'Organization' ) %>
- <%- @P( @user['organization'] ) %> -
+
+ <%- @P( @user['organization'] ) %> +
+<% end %> +<% for row in @userData: %> + <% if @user[row.name]: %> + <% if row.tag is 'richtext': %> +
<%- @user[row.name] %>
+ <% else: %> +
<%- @L( @P( @user[row.name] ) ) %>
+ <% end %> + <% end %> <% end %> <% if !_.isEmpty(@user['accounts']): %>
@@ -24,7 +27,7 @@ <% for item in link['items']: %> <% if item['url']: %> target="_blank"<% end %>> - <% else: %> + <% else: %> <% end %> <%- @T( item['name'] ) %> <% if item['count'] isnt undefined: %>(<%= item['count'] %>)<% end %>