diff options
-rw-r--r-- | chimere/templates/blocks/bootstrap-modal.html | 14 | ||||
-rw-r--r-- | chimere/templatetags/bootstrap.py | 23 |
2 files changed, 37 insertions, 0 deletions
diff --git a/chimere/templates/blocks/bootstrap-modal.html b/chimere/templates/blocks/bootstrap-modal.html new file mode 100644 index 0000000..d476d5b --- /dev/null +++ b/chimere/templates/blocks/bootstrap-modal.html @@ -0,0 +1,14 @@ +<div class="modal fade" id="{{id}}" tabindex="-1" role="dialog" + aria-labelledby="{{id}}-label" aria-hidden="true"> + <div class="modal-dialog{% ifequal size 'large'%} modal-lg{% endifequal %}"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + {% if title %}<h4 class="modal-title" id="{{id}}-label">{{title}}</h4>{% endif %} + </div> + <div class="modal-body"> + {{content}} + </div> + </div> + </div> +</div> diff --git a/chimere/templatetags/bootstrap.py b/chimere/templatetags/bootstrap.py new file mode 100644 index 0000000..ea1cb6d --- /dev/null +++ b/chimere/templatetags/bootstrap.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from logging import getLogger + +from django import template + +log = getLogger(__name__) + +register = template.Library() + + +@register.inclusion_tag('blocks/bootstrap-modal.html') +def bootstrap_modal(context, winid, title="", content="", size=""): + if size not in ['large']: + size = "" + context_data = { + "id": winid, + "title": title, + "content": content, + "size": size + } + return context_data |