From 1a8d503a4ea5dcdf80ccaa696456361000c544c9 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sun, 24 Aug 2014 00:34:38 +0200 Subject: [PATCH] Moved object lookup to generic model. --- .../app/controllers/navigation.js.coffee | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/app/controllers/navigation.js.coffee b/app/assets/javascripts/app/controllers/navigation.js.coffee index 62c30caf4..9e9fe250e 100644 --- a/app/assets/javascripts/app/controllers/navigation.js.coffee +++ b/app/assets/javascripts/app/controllers/navigation.js.coffee @@ -316,13 +316,28 @@ class App.Navigation extends App.Controller if prio is 8000 divider = true navheader = 'Recent Viewed' - ticket = App.Ticket.find( item.o_id ) + + item.link = '' + item.title = '???' + + # convert backend name space to local name space + item.object = item.object.replace("::", '') + + # lookup real data + if App[item.object] + object = App[item.object].find( item.o_id ) + item.link = object.uiUrl() + item.title = object.displayName() + item.object_name = object.objectDisplayName() + + item.created_by = App.User.find( item.created_by_id ) + prio++ - NavBarRight['RecendViewed::' + ticket.id + '-' + prio ] = { + NavBarRight['RecendViewed::' + item.o_id + item.object + '-' + prio ] = { prio: prio parent: '#current_user' - name: item.recent_view_object + ' (' + ticket.title + ')' - target: ticket.uiUrl() + name: item.object + ' (' + item.title + ')' + target: item.link divider: divider navheader: navheader }