summaryrefslogtreecommitdiff
path: root/lib/grappelli/templates/admin_tools/menu
diff options
context:
space:
mode:
Diffstat (limited to 'lib/grappelli/templates/admin_tools/menu')
-rw-r--r--lib/grappelli/templates/admin_tools/menu/add_bookmark_form.html9
-rw-r--r--lib/grappelli/templates/admin_tools/menu/css.html1
-rw-r--r--lib/grappelli/templates/admin_tools/menu/delete_confirm.html13
-rw-r--r--lib/grappelli/templates/admin_tools/menu/dummy.html1
-rw-r--r--lib/grappelli/templates/admin_tools/menu/form.html10
-rw-r--r--lib/grappelli/templates/admin_tools/menu/item.html15
-rw-r--r--lib/grappelli/templates/admin_tools/menu/menu.html64
-rw-r--r--lib/grappelli/templates/admin_tools/menu/menu.txt32
-rw-r--r--lib/grappelli/templates/admin_tools/menu/remove_bookmark_form.html7
9 files changed, 152 insertions, 0 deletions
diff --git a/lib/grappelli/templates/admin_tools/menu/add_bookmark_form.html b/lib/grappelli/templates/admin_tools/menu/add_bookmark_form.html
new file mode 100644
index 0000000..e0fcf2a
--- /dev/null
+++ b/lib/grappelli/templates/admin_tools/menu/add_bookmark_form.html
@@ -0,0 +1,9 @@
+{% url admin-tools-menu-add-bookmark as form_url %}
+{% if form_url %}
+ <form id="bookmark-form" action="{{ form_url }}" method="POST">
+ <input type="hidden" name="next" value="{% firstof url request.get_full_path|urlencode %}" />
+ <input type="hidden" name="url" value="{% firstof url request.get_full_path|urlencode %}" />
+ <input type="hidden" name="title" value="{{ title }}" />
+ <button id="bookmark-button" type="submit"></button>
+ </form>
+{% endif %}
diff --git a/lib/grappelli/templates/admin_tools/menu/css.html b/lib/grappelli/templates/admin_tools/menu/css.html
new file mode 100644
index 0000000..71aefdb
--- /dev/null
+++ b/lib/grappelli/templates/admin_tools/menu/css.html
@@ -0,0 +1 @@
+<!-- admin_tools/menu/css.html --> \ No newline at end of file
diff --git a/lib/grappelli/templates/admin_tools/menu/delete_confirm.html b/lib/grappelli/templates/admin_tools/menu/delete_confirm.html
new file mode 100644
index 0000000..e32a678
--- /dev/null
+++ b/lib/grappelli/templates/admin_tools/menu/delete_confirm.html
@@ -0,0 +1,13 @@
+{% extends "admin/base_site.html" %}
+
+{% block content %}
+
+<p>Are you sure you want to delete this bookmark?</p>
+
+<p>{{ bookmark.name }} - {{ bookmark.url }}</p>
+
+<form action="." method="POST">
+ <p><input type="submit" value="Delete" /></p>
+</form>
+
+{% endblock %}
diff --git a/lib/grappelli/templates/admin_tools/menu/dummy.html b/lib/grappelli/templates/admin_tools/menu/dummy.html
new file mode 100644
index 0000000..f04fcf5
--- /dev/null
+++ b/lib/grappelli/templates/admin_tools/menu/dummy.html
@@ -0,0 +1 @@
+{% extends template %}
diff --git a/lib/grappelli/templates/admin_tools/menu/form.html b/lib/grappelli/templates/admin_tools/menu/form.html
new file mode 100644
index 0000000..7da463a
--- /dev/null
+++ b/lib/grappelli/templates/admin_tools/menu/form.html
@@ -0,0 +1,10 @@
+{% extends "admin/base_site.html" %}
+
+{% block content %}
+
+<form action="." method="POST">
+ {{ form.as_p }}
+ <p><input type="submit" value="Save" /></p>
+</form>
+
+{% endblock %}
diff --git a/lib/grappelli/templates/admin_tools/menu/item.html b/lib/grappelli/templates/admin_tools/menu/item.html
new file mode 100644
index 0000000..9bf8bbd
--- /dev/null
+++ b/lib/grappelli/templates/admin_tools/menu/item.html
@@ -0,0 +1,15 @@
+{% load admin_tools_menu_tags %}
+{% spaceless %}
+{% if not item.is_empty %}
+ <li class="menu-item{% if item.children %} parent{% if index %} collapse closed{% else %} item-collapse item-closed{% endif %}{% endif %}{% if not item.enabled %} disabled{% endif %}{% if selected %} selected{% endif %}{% if forloop.last %} last{% endif %}{% if item.css_classes %} {{ item.css_classes|join:' ' }}{% endif %}">
+ <a href="{% if item.url and item.enabled %}{{ item.url }}{% else %}#{% endif %}" class="{% if item.children %}parent{% if index %} collapse-handler{% else %} item-collapse-handler-container{% endif %}{% endif %}" {% if item.description %} title="{{ item.description }}"{% endif %}{% if item.accesskey %} accesskey="{{ item.accesskey }}"{% endif %}>{{ item.title }}</a>{% if item.children %}{% if not index %}<a href="javascript://" class="icon item-collapse-handler"></a>{% endif %}{% endif %}
+ {% if item.children %}
+ <ul>
+ {% for child_item in item.children %}
+ {% admin_tools_render_menu_item child_item %}
+ {% endfor %}
+ </ul>
+ {% endif %}
+ </li>
+{% endif %}
+{% endspaceless %}
diff --git a/lib/grappelli/templates/admin_tools/menu/menu.html b/lib/grappelli/templates/admin_tools/menu/menu.html
new file mode 100644
index 0000000..f43dc23
--- /dev/null
+++ b/lib/grappelli/templates/admin_tools/menu/menu.html
@@ -0,0 +1,64 @@
+{% load i18n admin_tools_menu_tags %}
+{% if menu.children %}
+ <script type="text/javascript" src="{{ media_url }}/admin_tools/js/utils.js"></script>
+ <script type="text/javascript" charset="utf-8">
+ // Load js files syncronously and conditionally
+ var js_files = [
+ {
+ src : '{{ media_url }}/admin_tools/js/jquery/jquery.min.js',
+ test: function() { return typeof(jQuery) == 'undefined'; }
+ },
+ {
+ src : '{{ media_url }}/admin_tools/js/json.min.js',
+ test: function() { return typeof(JSON.stringify) == 'undefined'; }
+ },
+ {
+ src : '{{ media_url }}/admin_tools/js/menu.js',
+ test: function() { return true; }
+ }{% for js in menu.Media.js %},
+ {
+ src : '{{ media_url }}/{{ js }}',
+ test: function() { return true; }
+ }{% endfor %}
+ ];
+ loadScripts(js_files, function(){
+ jQuery(function($) {
+ {% if has_bookmark_item %}
+ process_bookmarks(
+ "{{ request.get_full_path }}",
+ "{{ title }}",
+ "{% trans 'Please enter a name for the bookmark' %}"
+ );
+ {% endif %}
+ });
+ });
+ </script>
+ {% comment %}
+ {% for item in menu.children %}
+ <ul class="navigation-menu">
+ {% admin_tools_render_menu_item item forloop.counter %}
+ {% ifequal item.css_classes|join:' ' "bookmark" %}
+ <li class="actions">
+ {% if bookmark %}
+ {% include "admin_tools/menu/remove_bookmark_form.html" %}
+ {% else %}
+ {% include "admin_tools/menu/add_bookmark_form.html" %}
+ {% endif %}
+ </li>
+ {% endifequal %}
+ </ul>
+ {% endfor %}
+ {% endcomment %}
+ {% for item in menu.children %}
+ <ul class="navigation-menu">
+ {% admin_tools_render_menu_item item forloop.counter %}
+ </ul>
+ {% ifequal item.css_classes|join:' ' "bookmark" %}
+ {% if bookmark %}
+ {% include "admin_tools/menu/remove_bookmark_form.html" %}
+ {% else %}
+ {% include "admin_tools/menu/add_bookmark_form.html" %}
+ {% endif %}
+ {% endifequal %}
+ {% endfor %}
+{% endif %}
diff --git a/lib/grappelli/templates/admin_tools/menu/menu.txt b/lib/grappelli/templates/admin_tools/menu/menu.txt
new file mode 100644
index 0000000..72d20da
--- /dev/null
+++ b/lib/grappelli/templates/admin_tools/menu/menu.txt
@@ -0,0 +1,32 @@
+from django.core.urlresolvers import reverse
+from django.utils.translation import ugettext_lazy as _
+from admin_tools.menu import items, Menu
+
+# to activate your custom menu add the following to your settings.py:
+#
+# ADMIN_TOOLS_MENU = '{{ project }}.{{ file }}.CustomMenu'
+
+class CustomMenu(Menu):
+ """
+ Custom Menu for {{ project }} admin site.
+ """
+ def __init__(self, **kwargs):
+ Menu.__init__(self, **kwargs)
+ self.children.append(items.MenuItem(
+ title=_('Dashboard'),
+ url=reverse('admin:index')
+ ))
+ self.children.append(items.AppList(
+ title=_('Applications'),
+ models=('add.your.app.models.here',)
+ ))
+ self.children.append(items.AppList(
+ title=_('Administration'),
+ models=('django.contrib',)
+ ))
+
+ def init_with_context(self, context):
+ """
+ Use this method if you need to access the request context.
+ """
+ pass
diff --git a/lib/grappelli/templates/admin_tools/menu/remove_bookmark_form.html b/lib/grappelli/templates/admin_tools/menu/remove_bookmark_form.html
new file mode 100644
index 0000000..7d9567f
--- /dev/null
+++ b/lib/grappelli/templates/admin_tools/menu/remove_bookmark_form.html
@@ -0,0 +1,7 @@
+{% url admin-tools-menu-remove-bookmark bookmark.id as form_url %}
+{% if form_url %}
+<form id="bookmark-form" action="{{ form_url }}" method="POST">
+ <input type="hidden" name="next" value="{% firstof url request.get_full_path|urlencode %}" />
+ <button id="bookmark-button" class="bookmarked" type="submit"></button>
+</form>
+{% endif %}