From 660119915c9307c89f72a9ec2027deeef3c22c6a Mon Sep 17 00:00:00 2001 From: Alan Huang Date: Thu, 9 Aug 2012 11:47:41 -0700 Subject: [PATCH] Link scoped symbols Summary: Elements with class na are now linked to symbol lookup. The context is passed if we got one. See D3214. Test Plan: Load Diffusion. Examine DOM and click on things. Reviewers: epriestley Reviewed By: epriestley CC: nh, aran, Korvin Maniphest Tasks: T1602 Differential Revision: https://secure.phabricator.com/D3215 --- webroot/rsrc/css/core/syntax.css | 1 + .../repository/repository-crossreference.js | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/webroot/rsrc/css/core/syntax.css b/webroot/rsrc/css/core/syntax.css index fc251e11e0..e51b6a1f3a 100644 --- a/webroot/rsrc/css/core/syntax.css +++ b/webroot/rsrc/css/core/syntax.css @@ -131,6 +131,7 @@ .remarkup-code .rbw_v { color: violet; } .repository-crossreference .remarkup-code .nc, +.repository-crossreference .remarkup-code .na, .repository-crossreference .remarkup-code .nf { cursor: help; border-bottom: 1px dotted #bbddbb; diff --git a/webroot/rsrc/js/application/repository/repository-crossreference.js b/webroot/rsrc/js/application/repository/repository-crossreference.js index 8184ad6ba3..6a8c4c6078 100644 --- a/webroot/rsrc/js/application/repository/repository-crossreference.js +++ b/webroot/rsrc/js/application/repository/repository-crossreference.js @@ -21,17 +21,23 @@ JX.behavior('repository-crossreference', function(config) { return; } var target = e.getTarget(); - var map = {nc : 'class', nf : 'function'}; + var map = {nc : 'class', nf : 'function', na : null}; while (target !== document.body) { if (JX.DOM.isNode(target, 'span') && (target.className in map)) { var symbol = target.textContent || target.innerText; var uri = JX.$U('/diffusion/symbol/' + symbol + '/'); - uri.addQueryParams({ - type : map[target.className], + var query = { lang : config.lang, projects : config.projects.join(','), jump : true - }); + }; + if (map[target.className]) { + query.type = map[target.className]; + } + if (target.hasAttribute('data-symbol-context')) { + query.context = target.getAttribute('data-symbol-context'); + } + uri.addQueryParams(query); window.open(uri); e.kill(); break;