Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# CREATED : February 25, 2014 

2 

3 

4def popover( 

5 tooltip=False, 

6 placement=False, 

7 trigger=False, 

8 title=False, 

9 content=False, 

10 delay=200, 

11 after=False): 

12 """ 

13 *popover to provide helper text or some secondary info about an element* 

14 

15 **Key Arguments** 

16 

17 - ``tooltip`` -- use tooltip instead of popover 

18 - ``placement`` -- direction popover expands into [ top | bottom | left | right ] 

19 - ``trigger`` -- the trigger for the popover [ False | click | hover | focus | manual ] 

20 - ``title`` -- the popover title 

21 - ``content`` -- the popover content 

22 - ``delay`` -- delay in ms 

23 - ``after`` -- place the div required by the  

24 

25 

26 **Return** 

27 

28 - ``popover`` - the popover helper text to be added to an element 

29 

30 ```eval_rst 

31 .. todo:: 

32 

33 - [ ] when complete, clean popover function 

34 - [ ] when complete add logging 

35 - [ ] when complete, decide whether to abstract function to another module 

36 ``` 

37 """ 

38 

39 if tooltip is False: 

40 tooltip = "popover" 

41 # title = """data-original-title="%(title)s" """ % locals() 

42 else: 

43 tooltip = "tooltip" 

44 content = False 

45 

46 if title: 

47 title = title.replace('"', "'") 

48 if content: 

49 content = content.replace('"', "'") 

50 

51 popover = """rel="%(tooltip)s" data-container="body" data-placement="%(placement)s" """ % locals() 

52 if trigger is not False: 

53 popover = """%(popover)s data-trigger="%(trigger)s" """ % locals() 

54 if title is not False: 

55 popover = """%(popover)s data-original-title="%(title)s" """ % locals() 

56 if content is not False: 

57 popover = """%(popover)s data-content="%(content)s" """ % locals() 

58 if delay is not False: 

59 popover = """%(popover)s data-delay="%(delay)s" """ % locals() 

60 

61 if (title and "<" in title and ">" in title) or (content and "<" in content and ">" in content): 

62 popover = """%(popover)s data-html=true """ % locals() 

63 

64 return popover