X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=devel%2Fdjango-insert-above-1.0.4%2FPKG-INFO;fp=devel%2Fdjango-insert-above-1.0.4%2FPKG-INFO;h=b3686a686d8ad80794851ed62332906a7ac3afb5;hb=65d84452c2b58dd76f97e4c28e5ec401aff890c4;hp=0000000000000000000000000000000000000000;hpb=484b16eca194516c6a14ad1e000eeef24aa41fd6;p=myslice.git diff --git a/devel/django-insert-above-1.0.4/PKG-INFO b/devel/django-insert-above-1.0.4/PKG-INFO new file mode 100644 index 00000000..b3686a68 --- /dev/null +++ b/devel/django-insert-above-1.0.4/PKG-INFO @@ -0,0 +1,235 @@ +Metadata-Version: 1.0 +Name: django-insert-above +Version: 1.0.4 +Summary: These django templatetags is a hack making possible to insert "content" in some (maybe above the current or parent template) places. +Home-page: https://github.com/yunmanger1/django-insert-above/ +Author: German Ilyin +Author-email: germanilyin@gmail.com +License: WTFPL +Description: WHAT IS IT? + ----------- + + These templatetags is a hack making possible to insert 'content' in + some (maybe above the current or parent template) places. + + More specifically, when we use these tags, there are some Nodes called + 'containers' that are rendered after all other nodes are rendered, but placed + in it's right posistion. Using this hack, 'containers' may render + depending on variables in context that were generated by nodes placed anywhere in + template (maybe after it). + + It's very useful in cases when you are reusing some template parts + very often. For example displaying comment list and comment submit form. + We write some template and put it into comments.html. Then every time + we need comments we just {% include "comments.html" %}. + But what if this part needs some js or css? Then we need to create + some comments-jscss.html and override some {% block head %}. IMHO this + is quite inconvenient. + + Using this tool we can insert js and css into head + directly from comments.html + + MOTIVATION + ---------- + + 1. Create convenient way to include media resources in head of HTML page. + 2. Handle repetition of resource includes. + 3. Make it possible to require resources from included templates. + 4. Keep the order of resource includes from different places. + + INSTALL + ------- + + 1. (required) add 'insert_above' in INSTALLED_APPS in your settings.py + + 2. (optional) add these two lines of code somewhere in your project where + they will run for sure. For example in urls.py + + ~~~~ + from django.template.loader import add_to_builtins + add_to_builtins('insert_above.templatetags.insert_tags') + ~~~~ + + TAGS & FILTERS + -------------- + + 1. {% insert_handler %} + 2. {% container name %} + 3. {% media_container name %} + 4. {% insert_str container str %} + 5. {% insert container %}{% endinsert %} + 6. media_tag filter simply converts `ga.js` into `` + + RESTRICTIONS + ------------ + + 1. `{% container %}` or `{% media_container %}` tags must NOT be in other `{% block %}`. + 2. `{% insert_handler %}` ought to be at ther very beginning of base template. + + VARIABLES + --------- + + 1. `IA_USE_MEDIA_PREFIX`, by default True + 2. `IA_MEDIA_PREFIX`, if not set `STATIC_URL` is used, if not set `MEDIA_URL` is used, if not set '/media/' is used + 3. `DEBUG`, if True logs how much time spent on rendering + 4. `IA_JS_FORMAT`, by default `` + 5. `IA_CSS_FORMAT`, by default `` + 6. `IA_MEDIA_EXTENSION_FORMAT_MAP`, by default `{'css' : CSS_FORMAT, '.js' : JS_FORMAT}` + + EXAMPLE + ------- + + Let's analyze an example. + + base.html + + ~~~~{.html} + {% insert_handler %} + +
+ + {% media_container media %} + + $(document).ready(function(){ + {% container ready %} + }); + + + + {% block content %} + {% endblock %} + + + ~~~~ + + Base template creating blocks and containers.. + + blog/base.html + + ~~~~{.html} + {% extends "base.html" %} + + {% block content %} + {% insert_str media "js/mathjax.js" %} + {% block header %}{% endblock %} + {% block menu %}{% include "blog/menu.html" %}{% endblock %} + {% block text %}{% endblock %} + {% block footer %}{% endblock %} + {% endblock %} + ~~~~ + + Extending content block. Requiring js/mathjax.js resource into 'media' container. + + blog/menu.html + + ~~~~{.html} + {% insert_str media "js/animated.menu.js" %} + {% insert_str media "css/animated.menu.css" %} + {% insert ready %} + $('ul.menu').each(function(){ + $(this).superanimation(); + }); + {% endinsert %} + + ~~~~ + + Requiring js/animated.menu.js and css/animated.menu.css into "media" container. + Inserting javascript code into "ready" container. + + blog/post_detail.html + + ~~~~{.html} + {% extends "blog/base.html" %} + + {% block header %}{{ title }}{% endblock %} + + {% block text %} + {% insert_str media "js/mathjax.js" %} + {{ text }} + {% endblock %} + + {% block footer %} +