Skip to content

Instantly share code, notes, and snippets.

@NickWoodhams
Created July 8, 2013 18:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NickWoodhams/5951235 to your computer and use it in GitHub Desktop.
Save NickWoodhams/5951235 to your computer and use it in GitHub Desktop.
Flask Toolip sample library for Bootstrap
$(document).ready(function(){
$('.close').click(function(){
$(this).closest('.popover').remove();
});
});
<!--templates file-->
{% from "tooltips.html" import tooltip %}
{{ tooltip(tooltips.contour_type) }}
{{ tooltip(tooltips.site) }}
{{ tooltip(tooltips.substance) }}
{%- macro tooltip(tip) -%}
<div class="popover {{ tip.pos }} {{ tip.state }} tt" id="{{ tip.id }}">
<button type="button" class="close close-{{ tip.id }}">×</button>
<div class="arrow"></div>
<h3 class="popover-title">{{ tip.title }}</h3>
<div class="popover-content">
<p>{{ tip.message }}</p>
</div>
</div>
{%- endmacro -%}
#my gorgeous tooltip classes
class Tooltip:
def __init__(self, pos, state, id, title, message):
self.pos = pos
self.state = state
self.id = id
self.title = title
self.message = message
class Tooltips():
contour_type = Tooltip(pos="right",
state="show",
id="select-type-pop",
title="Select countour type",
message="Choose the type of contour map you would like to create.")
site = Tooltip(pos="bottom",
state="show",
id="select-site-pop",
title="Select site",
message="Select one of your sites from this list and substance options will be filled.")
substance = Tooltip(pos="bottom",
state="show",
id="select-substance-pop",
title="Select substance",
message="Substances which have data for the selected site will be listed here.")
date = Tooltip(pos="bottom",
state="hide",
id="select-date-pop",
title="Select date",
message="Once site and substance are selected, choose a date with data you would like to contour.")
uniq_name = Tooltip(pos="bottom",
state="hide",
id="select-name-pop",
title="Choose name",
message="If you would like to add a unique name to the contour file, enter it here.")
contour_button = Tooltip(pos="bottom",
state="hide",
id="select-contour-pop",
title="Contour",
message="Generate a contour PDF. Your browser will begin downloading a contour file. It can take up to 30 seconds for large maps.")
flow_lines = Tooltip(pos="bottom",
state="hide",
id="select-flow-pop",
title="Toggle flow lines",
message="Flow lines are lines which show groundwater flow direction.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment