Revision c79079a8

View differences:

src/sunstone/public/app/utils/tips.js
1
define(function(require) {
2
  require('foundation.tooltip');
3
  //Replaces all class"tip" divs with an information icon that
4
  //displays the tip information on mouseover.
5
  var _setup = function(context, position) {
6
    //For each tip in this context
7
    $('.tip', context).each(function() {
8
      var obj = $(this);
9
      obj.removeClass('tip');
10
      var tip = obj.html();
11

  
12
      var tip_classes = ['has-tip']
13
      if (position) {
14
        tip_classes.push(position)
15
      }
16
      //replace the text with an icon and spans
17
      obj.html('<span data-tooltip class="' + tip_classes.join(' ') + '" data-width="210" title="' + tip + '"><i class="fa fa-question-circle"></i></span>');
18
    });
19
    $(document).foundation('reflow', 'tooltip');
20
  }
21

  
22
  return {
23
    'setup': _setup
24
  }
25
})

Also available in: Unified diff