From f673c7028a6bf6cf719868f6d391794a3e2d1992 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 28 Sep 2016 20:06:28 +0200 Subject: [PATCH] Fixed not shown history. --- .../controllers/organization_profile.coffee | 19 ++++++++++-- .../app/controllers/user_profile.coffee | 30 ++++++++++++++----- app/assets/javascripts/app/models/user.coffee | 2 +- .../views/organization_profile/index.jst.eco | 2 +- .../app/views/user_profile/index.jst.eco | 2 +- 5 files changed, 41 insertions(+), 14 deletions(-) diff --git a/app/assets/javascripts/app/controllers/organization_profile.coffee b/app/assets/javascripts/app/controllers/organization_profile.coffee index 069191cf9..f8363e745 100644 --- a/app/assets/javascripts/app/controllers/organization_profile.coffee +++ b/app/assets/javascripts/app/controllers/organization_profile.coffee @@ -40,9 +40,9 @@ class App.OrganizationProfile extends App.Controller organization: organization )) - new ActionRow( - el: elLocal.find('.js-action') + new Organization( object_id: organization.id + el: elLocal.find('.js-name') ) new Object( @@ -51,6 +51,11 @@ class App.OrganizationProfile extends App.Controller task_key: @task_key ) + new ActionRow( + el: elLocal.find('.js-action') + object_id: organization.id + ) + new App.TicketStats( el: elLocal.find('.js-ticket-stats') organization: organization @@ -76,7 +81,7 @@ class ActionRow extends App.ObserverController render: (organization) => # start action controller - showHistory = -> + showHistory = => new App.OrganizationHistory( organization_id: organization.id container: @el.closest('.content') @@ -182,6 +187,14 @@ class Object extends App.ObserverController org.updateAttributes(data) @log 'debug', 'update', name, value, org +class Organization extends App.ObserverController + model: 'Organization' + observe: + name: true + + render: (organization) => + @html App.Utils.htmlEscape(organization.displayName()) + class Member extends App.ObserverController model: 'User' observe: diff --git a/app/assets/javascripts/app/controllers/user_profile.coffee b/app/assets/javascripts/app/controllers/user_profile.coffee index 9bf0326d8..c30340e2c 100644 --- a/app/assets/javascripts/app/controllers/user_profile.coffee +++ b/app/assets/javascripts/app/controllers/user_profile.coffee @@ -41,17 +41,28 @@ class App.UserProfile extends App.Controller user: user )) - new ActionRow( - el: elLocal.find('.js-action') + new User( object_id: user.id + el: elLocal.find('.js-name') ) + if user.organization_id + new Organization( + object_id: user.organization_id + el: elLocal.find('.js-organization') + ) + new Object( el: elLocal.find('.js-object-container') object_id: user.id task_key: @task_key ) + new ActionRow( + el: elLocal.find('.js-action') + object_id: user.id + ) + new App.TicketStats( el: elLocal.find('.js-ticket-stats') user: user @@ -164,12 +175,6 @@ class Object extends App.ObserverController maxlength: 250 }) - if user.organization_id - new Organization( - object_id: user.organization_id - el: @$('.js-organization') - ) - update: (e) => name = $(e.target).attr('data-name') value = $(e.target).html() @@ -191,6 +196,15 @@ class Organization extends App.ObserverController organization: organization ) +class User extends App.ObserverController + model: 'User' + observe: + firstname: true + lastname: true + + render: (user) => + @html App.Utils.htmlEscape(user.displayName()) + class Router extends App.ControllerPermanent requiredPermission: 'ticket.agent' constructor: (params) -> diff --git a/app/assets/javascripts/app/models/user.coffee b/app/assets/javascripts/app/models/user.coffee index b5237eaa9..c1d0350a5 100644 --- a/app/assets/javascripts/app/models/user.coffee +++ b/app/assets/javascripts/app/models/user.coffee @@ -115,7 +115,7 @@ class App.User extends App.Model if data['accounts'] for account of data['accounts'] if account == 'twitter' - data['accounts'][account]['link'] = 'http://twitter.com/' + data['accounts'][account]['username'] + data['accounts'][account]['link'] = 'https://twitter.com/' + data['accounts'][account]['username'] if account == 'facebook' data['accounts'][account]['link'] = 'https://www.facebook.com/profile.php?id=' + data['accounts'][account]['uid'] diff --git a/app/assets/javascripts/app/views/organization_profile/index.jst.eco b/app/assets/javascripts/app/views/organization_profile/index.jst.eco index 53c9f63c1..f8bb2fda5 100644 --- a/app/assets/javascripts/app/views/organization_profile/index.jst.eco +++ b/app/assets/javascripts/app/views/organization_profile/index.jst.eco @@ -5,7 +5,7 @@
<%- @Icon('organization') %>
-

<%= @organization.displayName() %>

+

diff --git a/app/assets/javascripts/app/views/user_profile/index.jst.eco b/app/assets/javascripts/app/views/user_profile/index.jst.eco index 5d79bf444..7b7c8d101 100644 --- a/app/assets/javascripts/app/views/user_profile/index.jst.eco +++ b/app/assets/javascripts/app/views/user_profile/index.jst.eco @@ -3,7 +3,7 @@
<%- @user.avatar("80") %> -

<%= @user.displayName() %>

+

<% if @user.organization: %>
<% end %>