Commits

salvator  committed c81dd1f

#12 site link option, new screenshots

  • Participants
  • Parent commits 4418451

Comments (0)

Files changed (12)

  $ pip install -e hg+https://bitbucket.org/salvator/django-admintools-bootstrap#egg=admintools_bootstrap
 
 Insert `admintools_bootstrap` to your INSTALLED_APPS before `admin_tools` and `django.contrib.admin` apps.
+Make sure that `django.template.loaders.app_directories.Loader` are in the beginning of the `TEMPLATE_LOADERS` list.
 
 Enjoy.
 
  )
 
 
+Settings
+--------
+
+Site link::
+
+ ADMINTOOLS_BOOTSTRAP_SITE_LINK = '/'
+
+If not False, display link to site in the top panel
+
+
 Used software:
 --------------
 

File admintools_bootstrap/__init__.py

+__version__ = (0, 1, "alpha", 1)

File admintools_bootstrap/context_processors.py

-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-from django.contrib.sites.models import Site
-
-def site(request):
-    """
-        adds `site` template variable
-    """
-    return {'site': Site.objects.get_current()}

File admintools_bootstrap/models.py

 
 # addming icon argument to base MenuItem class
 items.MenuItem.icon = None
+
+
+import admintools_bootstrap.settings

File admintools_bootstrap/settings.py

+from appconf import AppConf
+
+
+class AdminToolsBootstrapConf(AppConf):
+    SITE_LINK = '/'
+
+    class Meta:
+        prefix = 'ADMINTOOLS_BOOTSTRAP'

File admintools_bootstrap/templates/admin/base.html

         {% block search %}{% endblock %}
         {% if user.is_active and user.is_staff %}
         <ul class="nav secondary-nav">
-            <li><a href="/"  class="top-icon" title="{% trans "Open site" %}" rel="popover" data-placement="below"><span class="ui-icon ui-icon-home ui-state-default"></span></a></li>
+            {% atb_site_link %}
             <li class="dropdown">
               <a class="dropdown-toggle" href="#">
                 <span class="ui-icon ui-icon-person ui-state-default"></span>

File admintools_bootstrap/templates/admin/base_site.html

 {% load i18n admin_tools_menu_tags admintools_bootstrap %}
 {% load url from future %}
 
-{% block title %}{{ title }} | {% site_name %} {% trans "admin" %}{% endblock %}
+{% block title %}{{ title }} | {% atb_site_name %} {% trans "admin" %}{% endblock %}
 
 {% block extrastyle %}
 {{ block.super }}
 {% endblock %}
 
 {% block branding %}
-<a class="brand" href="{% url 'admin:index' %}">{% site_name %} {% trans "admin" %}</a>
+<a class="brand" href="{% url 'admin:index' %}">{% atb_site_name %} {% trans "admin" %}</a>
 {% endblock %}
 
 {% block nav-global %}

File admintools_bootstrap/templatetags/admintools_bootstrap.py

 
 
 @register.simple_tag
-def site_name():
+def atb_site_link():
+    if settings.ADMINTOOLS_BOOTSTRAP_SITE_LINK:
+        return '''
+            <li><a href="%s"  class="top-icon" title="%s" rel="popover" data-placement="below"><span class="ui-icon ui-icon-home ui-state-default"></span></a></li>
+            ''' % (settings.ADMINTOOLS_BOOTSTRAP_SITE_LINK, _('Open site'))
+    else:
+        return ''
+
+@register.simple_tag
+def atb_site_name():
     if 'django.contrib.sites' in settings.INSTALLED_APPS:
         return Site.objects.get_current().name
     else:

File screenshot.png

Removed
Old image

File screenshot2.png

Removed
Old image
 install_requires = [
     'django-admin-tools>=0.4.1',
     'BeautifulSoup>=3.2.0',
+    'django-appconf>=0.4.1',
 ]
 
 setup(
     name='django-admintools-bootstrap',
-    version='0.1-pre-Alpha',
+    version=':versiontools:appconf:',
     author='Dmitry Belyaev',
     author_email='ssalvator@gmail.com',
     url='https://bitbucket.org/salvator/django-admintools-bootstrap',

File snapshot3.png

Added
New image