allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [02/50] [abbrv] allura git commit: [#7919] Add react tooltipster wrapper
Date Thu, 17 Dec 2015 19:21:49 GMT
[#7919]  Add react tooltipster wrapper


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/2fe68097
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/2fe68097
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/2fe68097

Branch: refs/heads/db/8034
Commit: 2fe68097fb0fa64059bdf7c2a05f4568cf0a14b4
Parents: 6d9fbb2
Author: Heith Seewald <heiths@gmail.com>
Authored: Thu Dec 3 10:52:35 2015 -0500
Committer: Heith Seewald <heiths@gmail.com>
Committed: Wed Dec 16 13:54:29 2015 -0600

----------------------------------------------------------------------
 Allura/allura/public/nf/js/tooltip.es6.js | 70 +++++++++++++-------------
 1 file changed, 34 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/2fe68097/Allura/allura/public/nf/js/tooltip.es6.js
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/js/tooltip.es6.js b/Allura/allura/public/nf/js/tooltip.es6.js
index a86eac6..92ebb3c 100644
--- a/Allura/allura/public/nf/js/tooltip.es6.js
+++ b/Allura/allura/public/nf/js/tooltip.es6.js
@@ -18,7 +18,6 @@
 */
 'use strict';
 
-
 /**
  * React Tooltip (tooltipster) Base class
 
@@ -29,9 +28,39 @@ class ToolTip extends React.Component {
         super(props);
     }
 
+    static propTypes = {
+        animation: React.PropTypes.string,
+        speed: React.PropTypes.number,
+        position: React.PropTypes.string,
+        contentAsHTML: React.PropTypes.bool,
+        delay: React.PropTypes.number,
+        theme: React.PropTypes.string,
+        maxWidth: React.PropTypes.number,
+        trigger: React.PropTypes.string,
+        multiple: React.PropTypes.bool,
+        classes: React.PropTypes.array,
+        text: React.PropTypes.string.isRequired,
+        href: React.PropTypes.string.isRequired,
+        toolTip: React.PropTypes.string
+    };
+
+    static defaultProps = {
+        animation: 'fade',
+        speed: 150,
+        delay: 0,
+        maxWidth: 300,
+        multiple: true,
+        contentAsHTML: false,
+        position: 'left',
+        trigger: 'hover',
+        classes: [],
+        theme: 'tooltipster-light'
+    };
+
+
     componentDidMount() {
         var _this = this;
-        $(".tooltip-link").tooltipster({
+        $(".react-tooltip").tooltipster({
             animation: _this.props.animation,
             speed: _this.props.speed,
             delay: _this.props.delay,
@@ -41,42 +70,11 @@ class ToolTip extends React.Component {
             position: _this.props.position,
             multiple: _this.props.multiple,
             iconCloning: false,
-            maxWidth: this.props.maxWidth
-        }).focus(function () {
-            $(this).tooltipster('show');
-        }).blur(function () {
-            $(this).tooltipster('hide');
-        });
+            maxWidth: _this.props.maxWidth
+        })
     }
 
 }
-ToolTip.propTypes = {
-    animation: React.PropTypes.string,
-    speed: React.PropTypes.number,
-    position: React.PropTypes.string,
-    contentAsHTML: React.PropTypes.bool,
-    delay: React.PropTypes.number,
-    theme: React.PropTypes.string,
-    maxWidth: React.PropTypes.number,
-    trigger: React.PropTypes.string,
-    multiple: React.PropTypes.bool,
-    classes: React.PropTypes.array,
-    text: React.PropTypes.string.isRequired,
-    href: React.PropTypes.string.isRequired,
-    toolTip: React.PropTypes.string
-};
-
-ToolTip.defaultProps = {
-    animation: 'fade',
-    speed: 150,
-    delay: 0,
-    maxWidth: 300,
-    multiple: false,
-    contentAsHTML: false,
-    position: 'left',
-    trigger: 'hover',
-    theme: 'tooltipster-light'
-};
 
 /**
  * Tooltip Link
@@ -89,7 +87,7 @@ class ToolTipLink extends ToolTip {
     }
 
     render() {
-        var classes = this.props.classes.join(' ') + " tooltip-link";
+        var classes = this.props.classes.join(' ') + " react-tooltip";
         return <a href={this.props.href} className={classes} title={this.props.toolTip}>{this.props.text}</a>
     }
 }
\ No newline at end of file


Mime
View raw message