Page MenuHomePhabricator

D15719.id37880.diff
No OneTemporary

D15719.id37880.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -393,6 +393,7 @@
'rsrc/js/application/diffusion/behavior-audit-preview.js' => 'd835b03a',
'rsrc/js/application/diffusion/behavior-commit-branches.js' => 'bdaf4d04',
'rsrc/js/application/diffusion/behavior-commit-graph.js' => '5a0b1a64',
+ 'rsrc/js/application/diffusion/behavior-diffusion-browse-file.js' => '054a0f0b',
'rsrc/js/application/diffusion/behavior-jump-to.js' => '73d09eef',
'rsrc/js/application/diffusion/behavior-load-blame.js' => '42126667',
'rsrc/js/application/diffusion/behavior-locate-file.js' => '6d3e1947',
@@ -606,6 +607,7 @@
'javelin-behavior-differential-populate' => '8694b1df',
'javelin-behavior-differential-toggle-files' => 'ca3f91eb',
'javelin-behavior-differential-user-select' => 'a8d8459d',
+ 'javelin-behavior-diffusion-browse-file' => '054a0f0b',
'javelin-behavior-diffusion-commit-branches' => 'bdaf4d04',
'javelin-behavior-diffusion-commit-graph' => '5a0b1a64',
'javelin-behavior-diffusion-jump-to' => '73d09eef',
@@ -918,6 +920,12 @@
'javelin-util',
'javelin-magical-init',
),
+ '054a0f0b' => array(
+ 'javelin-behavior',
+ 'javelin-dom',
+ 'javelin-util',
+ 'phabricator-tooltip',
+ ),
'056da01b' => array(
'aphront-typeahead-control-css',
'phui-tag-view-css',
diff --git a/src/applications/diffusion/controller/DiffusionBrowseController.php b/src/applications/diffusion/controller/DiffusionBrowseController.php
--- a/src/applications/diffusion/controller/DiffusionBrowseController.php
+++ b/src/applications/diffusion/controller/DiffusionBrowseController.php
@@ -1187,6 +1187,19 @@
$commit_links = $this->renderCommitLinks($blame_commits, $handles);
$revision_links = $this->renderRevisionLinks($revisions, $handles);
+ if ($this->coverage) {
+ require_celerity_resource('differential-changeset-view-css');
+ Javelin::initBehavior(
+ 'diffusion-browse-file',
+ array(
+ 'labels' => array(
+ 'cov-C' => pht('Covered'),
+ 'cov-N' => pht('Not Covered'),
+ 'cov-U' => pht('Not Executable'),
+ ),
+ ));
+ }
+
$skip_text = pht('Skip Past This Commit');
foreach ($display as $line_index => $line) {
$row = array();
@@ -1304,7 +1317,6 @@
));
if ($this->coverage) {
- require_celerity_resource('differential-changeset-view-css');
$cov_index = $line_index;
if (isset($this->coverage[$cov_index])) {
diff --git a/webroot/rsrc/js/application/diffusion/behavior-diffusion-browse-file.js b/webroot/rsrc/js/application/diffusion/behavior-diffusion-browse-file.js
new file mode 100644
--- /dev/null
+++ b/webroot/rsrc/js/application/diffusion/behavior-diffusion-browse-file.js
@@ -0,0 +1,47 @@
+/**
+ * @provides javelin-behavior-diffusion-browse-file
+ * @requires javelin-behavior
+ * javelin-dom
+ * javelin-util
+ * phabricator-tooltip
+ */
+
+JX.behavior('diffusion-browse-file', function(config, statics) {
+ if (statics.installed) {
+ return;
+ }
+ statics.installed = true;
+
+ var map = config.labels;
+
+ JX.Stratcom.listen(
+ ['mouseover', 'mouseout'],
+ ['phabricator-source', 'tag:td'],
+ function(e) {
+ var target = e.getTarget();
+
+ // NOTE: We're using raw classnames instead of sigils and metadata here
+ // because these elements are unusual: there are a lot of them on the
+ // page, and rendering all the extra metadata to do this in a normal way
+ // would be needlessly expensive. This is an unusual case.
+
+ if (!target.className.match(/cov-/)) {
+ return;
+ }
+
+ if (e.getType() == 'mouseout') {
+ JX.Tooltip.hide();
+ return;
+ }
+
+ for (var k in map) {
+ if (!target.className.match(k)) {
+ continue;
+ }
+
+ var label = map[k];
+ JX.Tooltip.show(target, 300, 'E', label);
+ break;
+ }
+ });
+});

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 22, 4:28 PM (2 h, 54 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6915340
Default Alt Text
D15719.id37880.diff (4 KB)

Event Timeline