Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15377722
D15699.id37824.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D15699.id37824.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -8,7 +8,7 @@
return array(
'names' => array(
'core.pkg.css' => 'ce06b6f6',
- 'core.pkg.js' => '08b41036',
+ 'core.pkg.js' => '2013a734',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '7ba78475',
'differential.pkg.js' => 'd0cd0df6',
@@ -471,6 +471,7 @@
'rsrc/js/core/behavior-active-nav.js' => 'e379b58e',
'rsrc/js/core/behavior-audio-source.js' => '59b251eb',
'rsrc/js/core/behavior-autofocus.js' => '7319e029',
+ 'rsrc/js/core/behavior-badge-view.js' => '8ff5e24c',
'rsrc/js/core/behavior-choose-control.js' => '327a00d1',
'rsrc/js/core/behavior-crop.js' => 'fa0f4fc2',
'rsrc/js/core/behavior-dark-console.js' => 'f411b6ae',
@@ -503,7 +504,7 @@
'rsrc/js/core/behavior-search-typeahead.js' => '06c32383',
'rsrc/js/core/behavior-select-on-click.js' => '4e3e79a6',
'rsrc/js/core/behavior-time-typeahead.js' => 'f80d6bf0',
- 'rsrc/js/core/behavior-toggle-class.js' => '5d7c9f33',
+ 'rsrc/js/core/behavior-toggle-class.js' => '92b9ec77',
'rsrc/js/core/behavior-tokenizer.js' => 'b3a4b884',
'rsrc/js/core/behavior-tooltip.js' => '42fcb747',
'rsrc/js/core/behavior-watch-anchor.js' => '9f36c42d',
@@ -579,6 +580,7 @@
'javelin-behavior-aphront-more' => 'a80d0378',
'javelin-behavior-audio-source' => '59b251eb',
'javelin-behavior-audit-preview' => 'd835b03a',
+ 'javelin-behavior-badge-view' => '8ff5e24c',
'javelin-behavior-bulk-job-reload' => 'edf8a145',
'javelin-behavior-choose-control' => '327a00d1',
'javelin-behavior-comment-actions' => '06460e71',
@@ -685,7 +687,7 @@
'javelin-behavior-stripe-payment-form' => '3f5d6dbf',
'javelin-behavior-test-payment-form' => 'fc91ab6c',
'javelin-behavior-time-typeahead' => 'f80d6bf0',
- 'javelin-behavior-toggle-class' => '5d7c9f33',
+ 'javelin-behavior-toggle-class' => '92b9ec77',
'javelin-behavior-typeahead-browse' => '635de1ec',
'javelin-behavior-typeahead-search' => '93d0c9e3',
'javelin-behavior-view-placeholder' => '47830651',
@@ -1330,11 +1332,6 @@
'javelin-stratcom',
'javelin-dom',
),
- '5d7c9f33' => array(
- 'javelin-behavior',
- 'javelin-stratcom',
- 'javelin-dom',
- ),
'5e9f347c' => array(
'javelin-behavior',
'multirow-row-manager',
@@ -1570,6 +1567,11 @@
'javelin-stratcom',
'javelin-install',
),
+ '8ff5e24c' => array(
+ 'javelin-behavior',
+ 'javelin-stratcom',
+ 'javelin-dom',
+ ),
'901935ef' => array(
'javelin-behavior',
'javelin-dom',
@@ -1584,6 +1586,11 @@
92197373 => array(
'phui-workcard-view-css',
),
+ '92b9ec77' => array(
+ 'javelin-behavior',
+ 'javelin-stratcom',
+ 'javelin-dom',
+ ),
'93d0c9e3' => array(
'javelin-behavior',
'javelin-stratcom',
diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php
--- a/src/view/page/PhabricatorStandardPageView.php
+++ b/src/view/page/PhabricatorStandardPageView.php
@@ -248,7 +248,7 @@
}
Javelin::initBehavior('aphront-form-disable-on-submit');
- Javelin::initBehavior('toggle-class', array());
+ Javelin::initBehavior('badge-view', array());
Javelin::initBehavior('history-install');
Javelin::initBehavior('phabricator-gesture');
diff --git a/src/view/phui/PHUIBadgeView.php b/src/view/phui/PHUIBadgeView.php
--- a/src/view/phui/PHUIBadgeView.php
+++ b/src/view/phui/PHUIBadgeView.php
@@ -70,7 +70,7 @@
return array(
'class' => implode(' ', $classes),
- 'sigil' => 'jx-toggle-class',
+ 'sigil' => 'jx-badge-view',
'id' => $id,
'meta' => array(
'map' => array(
diff --git a/webroot/rsrc/js/core/behavior-badge-view.js b/webroot/rsrc/js/core/behavior-badge-view.js
new file mode 100644
--- /dev/null
+++ b/webroot/rsrc/js/core/behavior-badge-view.js
@@ -0,0 +1,41 @@
+/**
+ * @provides javelin-behavior-badge-view
+ * @requires javelin-behavior
+ * javelin-stratcom
+ * javelin-dom
+ */
+
+/**
+ * Toggle CSS classes when an element is clicked. This behavior is activated
+ * by adding the sigil `jx-badge-view` to an element, and a key `map` to its
+ * data. The `map` should be a map from element IDs to the classes that should
+ * be toggled on them.
+ *
+ * Optionally, you may provide a `state` key to set the default state of the
+ * element.
+ */
+JX.behavior('badge-view', function(config, statics) {
+ function install() {
+ JX.Stratcom.listen(
+ ['click'],
+ 'jx-badge-view',
+ function(e) {
+ if (e.getNode('tag:a')) {
+ // If the event has a 'tag:a' node on it, that means the user
+ // either clicked a link or some other node inside a link.
+ return;
+ }
+
+ var t = e.getNodeData('jx-badge-view');
+ t.state = !t.state;
+ for (var k in t.map) {
+ JX.DOM.alterClass(JX.$(k), t.map[k], t.state);
+ }
+ e.kill();
+ });
+
+ return true;
+ }
+
+ statics.install = statics.install || install();
+});
diff --git a/webroot/rsrc/js/core/behavior-toggle-class.js b/webroot/rsrc/js/core/behavior-toggle-class.js
--- a/webroot/rsrc/js/core/behavior-toggle-class.js
+++ b/webroot/rsrc/js/core/behavior-toggle-class.js
@@ -15,8 +15,6 @@
* element.
*/
JX.behavior('toggle-class', function(config, statics) {
- statics.install = statics.install || install();
-
function install() {
JX.Stratcom.listen(
['touchstart', 'mousedown'],
@@ -42,4 +40,6 @@
return true;
}
+
+ statics.install = statics.install || install();
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mar 14 2025, 10:25 AM (4 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7654197
Default Alt Text
D15699.id37824.diff (5 KB)
Attached To
Mode
D15699: Links on badge card should be accessible
Attached
Detach File
Event Timeline
Log In to Comment