]> git.parisson.com Git - diggersdigest.git/commitdiff
Collecttemplates for mezzanine.pages
authorThomas Fillon <thomas@parisson.com>
Thu, 10 Sep 2015 09:47:55 +0000 (11:47 +0200)
committerThomas Fillon <thomas@parisson.com>
Thu, 10 Sep 2015 09:47:55 +0000 (11:47 +0200)
diggersdigest/templates/pages/index.html [new file with mode: 0644]
diggersdigest/templates/pages/menus/admin.html [new file with mode: 0644]
diggersdigest/templates/pages/menus/breadcrumb.html [new file with mode: 0644]
diggersdigest/templates/pages/menus/dropdown.html [new file with mode: 0644]
diggersdigest/templates/pages/menus/footer.html [new file with mode: 0644]
diggersdigest/templates/pages/menus/footer_tree.html [new file with mode: 0644]
diggersdigest/templates/pages/menus/mobile.html [new file with mode: 0644]
diggersdigest/templates/pages/menus/primary.html [new file with mode: 0644]
diggersdigest/templates/pages/menus/tree.html [new file with mode: 0644]
diggersdigest/templates/pages/page.html [new file with mode: 0644]
diggersdigest/templates/pages/richtextpage.html [new file with mode: 0644]

diff --git a/diggersdigest/templates/pages/index.html b/diggersdigest/templates/pages/index.html
new file mode 100644 (file)
index 0000000..48803c4
--- /dev/null
@@ -0,0 +1,10 @@
+{% extends "pages/richtextpage.html" %}
+
+{% block main %}
+<!--
+This template is provided as a custom template for the homepage, for
+when it is configured as an editable page in the navigation tree. Feel
+free to modify it.
+-->
+{{ block.super }}
+{% endblock %}
diff --git a/diggersdigest/templates/pages/menus/admin.html b/diggersdigest/templates/pages/menus/admin.html
new file mode 100644 (file)
index 0000000..22b66e5
--- /dev/null
@@ -0,0 +1,46 @@
+{% load pages_tags i18n staticfiles %}
+
+<ol>
+    {% for page in page_branch %}
+    <li id="ordering_{{ page.id }}">
+        <div class="{% cycle 'row1' 'row2' %}">
+            <a href="#" class="tree-toggle" id="page-{{ page.id }}"
+                {% if not page.has_children %}style="visibility:hidden;"{% endif %}>
+                <span class="icon open">+</span>
+                <span class="icon close">-</span>
+            </a>
+            {% set_page_permissions page %}
+            {% if page.perms.delete %}
+            <a href="{% url "admin:pages_page_delete" page.id %}?fromtree" class="delete"></a>
+            {% else %}
+            <span class="delete" style="background:none;"></span>
+            {% endif %}
+            {% if page.perms.change %}
+            <a href="{% url "admin:pages_page_change" page.id %}{% if not page.is_primary %}?parent={{ page.parent_id }}{% endif %}"
+                class="changelink">{{ page.title.strip|default:"&nbsp;" }}</a>
+            {% else %}
+            <span class="uneditable">{{ page.title }}</span>
+            {% endif %}
+            <span class="ordering"{% if not page.perms.change %}
+                style="visibility:hidden;"{% endif %}>
+                <img src="{% static settings.MEZZANINE_ADMIN_PREFIX|add:"img/admin/arrow-up.gif" %}">
+                <img src="{% static settings.MEZZANINE_ADMIN_PREFIX|add:"img/admin/arrow-down.gif" %}">
+            </span>
+            {% if page.perms.add %}
+            <select class="addlist" id="addlink-{{ page.id }}">
+                <option value="">{% trans "Add" %} ...</option>
+                {% for model in page_models %}
+                    {% if model.perms.add %}
+                    <option value="{{ model.add_url }}?parent={{ page.id }}"
+                        >{{ model.meta_verbose_name|capfirst }}</option>
+                    {% endif %}
+                {% endfor %}
+            </select>
+            {% endif %}
+
+        </div>
+        <br style="clear:both;">
+        {% if page.has_children %}{% page_menu page %}{% endif %}
+    </li>
+    {% endfor %}
+</ol>
diff --git a/diggersdigest/templates/pages/menus/breadcrumb.html b/diggersdigest/templates/pages/menus/breadcrumb.html
new file mode 100644 (file)
index 0000000..5bd1a7f
--- /dev/null
@@ -0,0 +1,27 @@
+{% load i18n pages_tags %}
+
+{% if on_home %}
+<li>{% trans "Home" %}</li>
+{% else %}
+{% for page in page_branch %}
+
+    {% if not has_home and page.is_primary and forloop.first %}
+    <li id="breadcrumb-menu-home">
+        <a href="{% url "home" %}">{% trans "Home" %}</a>
+    </li>
+    {% endif %}
+
+    {% if page.is_current_or_ascendant %}
+    {% if page.is_current %}
+    <li id="breadcrumb-menu-{{ page.html_id }}"
+        class="active">{{ page.title }}</li>
+    {% else %}
+    <li id="breadcrumb-menu-{{ page.html_id }}">
+        <a href="{{ page.get_absolute_url }}">{{ page.title }}</a>
+    </li>
+    {% endif %}
+    {% if page.has_children %}{% page_menu page %}{% endif %}
+    {% endif %}
+
+{% endfor %}
+{% endif %}
diff --git a/diggersdigest/templates/pages/menus/dropdown.html b/diggersdigest/templates/pages/menus/dropdown.html
new file mode 100644 (file)
index 0000000..1d4594a
--- /dev/null
@@ -0,0 +1,46 @@
+{% load i18n pages_tags %}
+{% spaceless %}
+{% if page_branch_in_menu %}
+
+{% if branch_level == 0 %}
+<ul class="nav navbar-nav">
+    {% for page in page_branch %}
+    {% if not has_home and page.is_primary and forloop.first %}
+    <li{% if on_home %} class="active"{% endif %} id="dropdown-menu-home">
+        <a href="{% url "home" %}">{% trans "Home" %}</a>
+    </li>
+    {% endif %}
+    {% if page.in_menu %}
+    <li class="{% if page.has_children_in_menu %}dropdown{% endif %}
+               {% if page.is_current_or_ascendant %}active{% endif %}"
+        id="{{ page.html_id }}">
+        <a href="{{ page.get_absolute_url }}"
+        {% if page.has_children_in_menu %}
+        class="dropdown-toggle disabled" data-toggle="dropdown"
+        {% endif %}>
+            {{ page.title }}
+            {% if page.has_children_in_menu %}<b class="caret"></b>{% endif %}
+        </a>
+        {% if page.has_children_in_menu %}{% page_menu page %}{% endif %}
+    </li>
+    {% endif %}
+    {% endfor %}
+</ul>
+
+{% else %}
+<ul class="dropdown-menu">
+    {% for page in page_branch %}
+    {% if page.in_menu %}
+    <li class="{% if page.has_children_in_menu %}dropdown-submenu{% endif %}
+               {% if page.is_current_or_ascendant %}active{% endif %}"
+        id="{{ page.html_id }}">
+        <a href="{{ page.get_absolute_url }}">{{ page.title }}</a>
+        {% if page.has_children_in_menu %}{% page_menu page %}{% endif %}
+    </li>
+    {% endif %}
+    {% endfor %}
+</ul>
+{% endif %}
+
+{% endif %}
+{% endspaceless %}
diff --git a/diggersdigest/templates/pages/menus/footer.html b/diggersdigest/templates/pages/menus/footer.html
new file mode 100644 (file)
index 0000000..4e06131
--- /dev/null
@@ -0,0 +1,45 @@
+{% load i18n pages_tags %}
+
+{% spaceless %}
+{% if page_branch_in_menu %}
+
+{% for page in page_branch %}
+    {% if page.is_primary %}
+        {% if forloop.first %}
+            <div class="nav-footer">
+        {% endif %}
+        {% if page.in_menu %}
+            <ul class="list-unstyled">
+        {% endif %}
+    {% endif %}
+
+    {% if page.in_menu %}
+        {% if forloop.first and not page.parent.in_menu and not page.is_primary %}
+            <ul class="list-unstyled">
+        {% endif %}
+        <li {% if page.is_current_or_ascendant %}class="active"{% endif %}
+            id="footer-menu-{{ page.html_id }}">
+            <a href="{{ page.get_absolute_url }}">{{ page.title }}</a></li>
+    {% endif %}
+
+    {% if page.in_menu and page.has_children_in_menu %}{% page_menu page %}{% endif %}
+
+    {% if page.in_menu %}
+        {% if forloop.first and not page.parent.in_menu and not page.is_primary %}
+            </li></ul>
+        {% endif %}
+    {% endif %}
+
+    {% if page.is_primary %}
+        {% if page.in_menu %}
+            </ul>
+        {% endif %}
+        {% if forloop.last %}
+            </div>
+        {% endif %}
+    {% endif %}
+
+{% endfor %}
+
+{% endif %}
+{% endspaceless %}
diff --git a/diggersdigest/templates/pages/menus/footer_tree.html b/diggersdigest/templates/pages/menus/footer_tree.html
new file mode 100644 (file)
index 0000000..a1c8c99
--- /dev/null
@@ -0,0 +1,31 @@
+{% load i18n pages_tags %}
+
+{% spaceless %}
+{% if page_branch_in_menu %}
+<ul class="footer-tree-menu-level-{{ branch_level }}">
+       {% for page in page_branch %}
+
+    {% if not has_home and page.is_primary and forloop.first %}
+       <li class="first{% if on_home %} active{% endif %}"
+        id="footer-tree-menu-home">
+           <a href="{% url "home" %}">{% trans "Home" %}</a>
+       </li>
+       {% endif %}
+
+       {% if page.in_menu %}
+       <li class="{% if page.is_current_or_ascendant %}active{% endif %}
+        {% if not top_level and forloop.first %} first{% endif %}
+        {% if forloop.last %} last{% endif %}"
+        id="footer-tree-menu-{{ page.html_id }}">
+               <a href="{{ page.get_absolute_url }}">{{ page.title }}</a>
+               {# remove this if tag to always show all nav items #}
+               {% if page.is_current_or_ascendant and page.has_children_in_menu %}
+               {% page_menu page %}
+               {% endif %}
+       </li>
+    {% endif %}
+
+       {% endfor %}
+</ul>
+{% endif %}
+{% endspaceless %}
diff --git a/diggersdigest/templates/pages/menus/mobile.html b/diggersdigest/templates/pages/menus/mobile.html
new file mode 100644 (file)
index 0000000..07ce06c
--- /dev/null
@@ -0,0 +1,32 @@
+{% load i18n pages_tags %}
+
+{% spaceless %}
+{% if page_branch %}
+{% for page in page_branch %}
+
+       {% if not has_home and page.is_primary and forloop.first %}
+       <ul class="mobile-menu">
+               <li><a class="home" href="{% url "home" %}"
+                          id="tree-menu-home">{% trans "Home" %}</a></li>
+    {% endif %}
+
+               {% if page.is_current_or_ascendant and not page.is_current_child %}
+        {% if page.has_children_in_menu %}{% page_menu page %}{% endif %}
+               {% endif %}
+
+               {% if page.is_current_child %}
+               <li class="
+                       {% if forloop.first %} first{% endif %}
+                       {% if forloop.last %} last{% endif %}"
+                       id="mobile-menu-{{ page.html_id }}">
+                       <a href="{{ page.get_absolute_url }}">{{ page.title }}</a>
+               </li>
+               {% endif %}
+
+       {% if page.is_primary and forloop.last %}
+       </ul>
+       {% endif %}
+
+{% endfor %}
+{% endif %}
+{% endspaceless %}
diff --git a/diggersdigest/templates/pages/menus/primary.html b/diggersdigest/templates/pages/menus/primary.html
new file mode 100644 (file)
index 0000000..e0be319
--- /dev/null
@@ -0,0 +1,20 @@
+{% load pages_tags i18n %}
+
+{% spaceless %}
+<ul id="primary-menu" class="nav pull-right">
+    {% for page in page_branch %}
+    {% if not has_home and page.is_primary and forloop.first %}
+    <li id="primary-menu-home" class="first{% if on_home %} active{% endif %}">
+        <a href="{% url "home" %}">{% trans "Home" %}</a>
+    </li>
+    {% endif %}
+    {% if page.in_menu %}
+    <li id="primary-menu-{{ page.html_id }}"
+        class="{% if page.is_current_or_ascendant %}active{% endif %}{% if forloop.last %} last{% endif %}">
+        <a href="{{ page.get_absolute_url }}">{{ page.title }}</a>
+    </li>
+    {% endif %}
+    {% endfor %}
+    <li class="divider-vertical"></li>
+</ul>
+{% endspaceless %}
diff --git a/diggersdigest/templates/pages/menus/tree.html b/diggersdigest/templates/pages/menus/tree.html
new file mode 100644 (file)
index 0000000..3610808
--- /dev/null
@@ -0,0 +1,26 @@
+{% load i18n pages_tags %}
+
+{% spaceless %}
+{% if page_branch_in_menu %}
+<ul class="nav nav-list navlist-menu-level-{{ branch_level }}">
+  {% for page in page_branch %}
+  {% if not has_home and page.is_primary and forloop.first %}
+  <li{% if on_home %} class="active"{% endif %} id="tree-menu-home">
+    <a href="{% url "home" %}">{% trans "Home" %}</a>
+  </li>
+  {% endif %}
+  {% if page.in_menu %}
+  <li class="
+    {% if page.is_current %} active{% endif %}
+    {% if page.is_current_or_ascendant %} active-branch{% endif %}
+    " id="tree-menu-{{ page.html_id }}">
+    <a href="{{ page.get_absolute_url }}">{{ page.title }}</a>
+    {# wrap the next line with 'if page.is_current_or_ascendant' #}
+    {# to only show child pages in the menu for the current page #}
+    {% if page.has_children_in_menu %}{% page_menu page %}{% endif %}
+  </li>
+  {% endif %}
+  {% endfor %}
+</ul>
+{% endif %}
+{% endspaceless %}
diff --git a/diggersdigest/templates/pages/page.html b/diggersdigest/templates/pages/page.html
new file mode 100644 (file)
index 0000000..cf6a335
--- /dev/null
@@ -0,0 +1,23 @@
+{% extends "base.html" %}
+{% load mezzanine_tags keyword_tags %}
+
+{% block meta_title %}{{ page.meta_title }}{% endblock %}
+
+{% block meta_keywords %}{% metablock %}
+{% keywords_for page as keywords %}
+{% for keyword in keywords %}
+    {% if not forloop.first %}, {% endif %}
+    {{ keyword }}
+{% endfor %}
+{% endmetablock %}{% endblock %}
+
+{% block meta_description %}{% metablock %}
+{{ page.description }}
+{% endmetablock %}{% endblock %}
+
+{% block title %}
+{% editable page.title %}{{ page.title }}{% endeditable %}
+{% endblock %}
+
+{% block main %}
+{% endblock %}
diff --git a/diggersdigest/templates/pages/richtextpage.html b/diggersdigest/templates/pages/richtextpage.html
new file mode 100644 (file)
index 0000000..d61e95f
--- /dev/null
@@ -0,0 +1,11 @@
+{% extends "pages/page.html" %}
+
+{% load mezzanine_tags %}
+
+{% block main %}{{ block.super }}
+
+{% editable page.richtextpage.content %}
+{{ page.richtextpage.content|richtext_filters|safe }}
+{% endeditable %}
+
+{% endblock %}