diff --git a/ckan/public/base/javascript/modules/popover-context.js b/ckan/public/base/javascript/modules/popover-context.js index b3fdb188656..e4b12733420 100644 --- a/ckan/public/base/javascript/modules/popover-context.js +++ b/ckan/public/base/javascript/modules/popover-context.js @@ -1,7 +1,7 @@ /* Popover context * These appear when someone hovers over a context item in a activity stream to - * give the user more context into that particular item. It also allows for people to - * follow and unfollow quickly from within the popover + * give the user more context into that particular item. It also allows for + * people to follow and unfollow quickly from within the popover * * id - The user_id of user * context - The type of this popover: currently supports user & package @@ -100,7 +100,8 @@ this.ckan.module('popover-context', function($, _) { } }, - /* Handles the showing of the popover on hover (also hides other active popovers) + /* Handles the showing of the popover on hover (also hides other active + * popovers) * * Returns nothing. */ @@ -154,48 +155,13 @@ this.ckan.module('popover-context', function($, _) { // has this been rendered before? if (typeof window.popover_context.render[type][id] == 'undefined') { - var params = this.sanitiseParams(json.result); - client.getTemplate('popover-context-' + type + '.html', params, this._onRenderPopover); + client.getTemplate('popover-context-' + type + '.html', json.result, this._onRenderPopover); } else { this._onRenderPopover(window.popover_context.render[type][id]); } } }, - /* Used to break down a raw object into something a little more passable into a GET request - * - * Returns object. - */ - sanitiseParams: function(raw) { - var type = this.options.type; - var params = {}; - if (type == 'user') { - params.id = raw.id; - params.name = raw.name; - params.about = raw.about; - params.display_name = raw.display_name; - params.num_followers = raw.num_followers; - params.number_administered_packages = raw.number_administered_packages; - params.number_of_edits = raw.number_of_edits; - params.is_me = ( raw.id == this.options.authed ); - } else if (type == 'dataset') { - params.id = raw.id; - params.title = raw.title; - params.name = raw.name; - params.notes = raw.notes; - params.num_resources = raw.resources.length; - params.num_tags = raw.tags.length; - } else if (type == 'group') { - params.id = raw.id; - params.title = raw.title; - params.name = raw.name; - params.description = raw.description; - params.num_datasets = raw.packages.length; - params.num_followers = raw.num_followers; - } - return params; - }, - /* Renders the contents of the popover * * Returns nothing. @@ -244,8 +210,8 @@ this.ckan.module('popover-context', function($, _) { return false; }, - /* Callback from when you follow/unfollow a specified item... this is used to ensure - * all popovers associated to that user get re-populated + /* Callback from when you follow/unfollow a specified item... this is + * used to ensure all popovers associated to that user get re-populated * * Returns nothing. */