]> git.openstreetmap.org Git - osqa.git/commitdiff
Adds a head content injection spot for modules, and a new ui object for template...
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Tue, 29 Jun 2010 10:46:20 +0000 (10:46 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Tue, 29 Jun 2010 10:46:20 +0000 (10:46 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@471 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/modules/ui.py
forum/modules/ui_objects.py
forum/skins/default/templates/base_content.html

index e21527f9ecb890ff6b19807d9ffcda561e364b9c..49ce249b1c2b282a5d4ee619035dd9e1a934e1cc 100644 (file)
@@ -10,6 +10,7 @@ class Registry(list):
         self.append(register)
 
 
+HEAD_CONTENT = 'HEAD_CONTENT'
 HEADER_LINKS = 'HEADER_LINKS'
 PAGE_TOP_TABS = 'PAGE_TOP_TABS'
 FOOTER_LINKS = 'FOOTER_LINKS'
@@ -17,6 +18,7 @@ PROFILE_TABS = 'PROFILE_TABS'
 
 
 __CONTAINER = {
+    HEAD_CONTENT: Registry(),
     HEADER_LINKS: Registry(),
     PAGE_TOP_TABS: Registry(),
     FOOTER_LINKS: Registry(),
index 70bee93a1b695d69aa9325a93ad1668a127c29e9..caa221fcd7c0d9c555d80c98341e1ddd621cc036 100644 (file)
@@ -1,5 +1,6 @@
 from django.core.urlresolvers import reverse
 from django.template.defaultfilters import slugify
+from django import template
 from forum.utils import html
 
 class Visibility(object):
@@ -82,6 +83,14 @@ class Link(ObjectBase):
             html.hyperlink(self.url(context), self.text(context), **self.attrs(context)),
             self.post_code(context))
 
+class Include(ObjectBase):
+    def __init__(self, tpl, visibility=None, weight=500):
+        super(Include, self).__init__(visibility, weight)
+        self.template = template.loader.get_template(tpl)
+
+    def render(self, context):
+        return self.template.render(context)
+        
 
 class LoopContext(LoopBase):
     def __init__(self, loop_context, visibility=None, weight=500):
index 4f0aa301524da663875aa67bf236c8f0ac814dfa..62d2176f7434729bfc08e4135954ddcdace6f1ee 100644 (file)
@@ -1,6 +1,6 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <!-- base_content.html -->
-{% load i18n extra_tags extra_filters markup %}
+{% load i18n extra_tags extra_filters markup ui_registry %}
 <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
         <title>{% block fulltitle %}{% block title %}{% endblock %} - {{ settings.APP_SHORT_NAME }}{% endblock %}</title>
@@ -55,6 +55,7 @@
         {% endif %}
         {% block forejs %}{% endblock %}
         <link rel="search" type="application/opensearchdescription+xml" href="{% url opensearch %}" title="{{ settings.APP_SHORT_NAME }} Search" />
+        {% loadregistry head_content %}{% endloadregistry %}
     </head>
     <body>
         <div class="notify" style="display:none">