diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-09-12 11:40:42 +0200 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-09-12 11:40:42 +0200 |
| commit | 77fbbf70b33300d573c0ee660b4a42cdbed460c0 (patch) | |
| tree | 77596412098e7a41fb03ff31956a25cad06e2f2a | |
| parent | 13cc1e8f4a03cc433349a8add14c081903af502e (diff) | |
| download | Chimère-77fbbf70b33300d573c0ee660b4a42cdbed460c0.tar.bz2 Chimère-77fbbf70b33300d573c0ee660b4a42cdbed460c0.zip | |
Bootstrap: templatetag for modal window
| -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 |
