Improved tools menu using horizontal button widget just like the project_setup app
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from navigation.api import register_top_menu
|
||||
|
||||
|
||||
#TODO: FIXME dynamic children_path_regext on api register_setup
|
||||
#register_top_menu('setup_menu', link={'text': _(u'setup'), 'view': 'setup_list', 'famfam': 'cog'}, children_path_regex=[r'^settings/', r'^user_management/', r'^permissions', r'^documents/type', r'^metadata/setup', r'sources/setup'], position=-2)
|
||||
|
||||
|
||||
register_top_menu('tools', link={'text': _(u'tools'), 'view': 'tools_list', 'famfam': 'wrench'}, children_views=['statistics', 'history_list', 'formats_list'], position=-3)
|
||||
#register_links(['tools_menu', 'statistics', 'history_list', 'history_view', 'formats_list'], [tools_menu, statistics, history_list, formats_list, sentry], menu_name='secondary_menu')
|
||||
@@ -0,0 +1,5 @@
|
||||
tool_items = []
|
||||
|
||||
|
||||
def register_tool(link):
|
||||
tool_items.append(link)
|
||||
@@ -0,0 +1,3 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
@@ -0,0 +1,23 @@
|
||||
"""
|
||||
This file demonstrates two different styles of tests (one doctest and one
|
||||
unittest). These will both pass when you run "manage.py test".
|
||||
|
||||
Replace these with more appropriate tests for your application.
|
||||
"""
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
class SimpleTest(TestCase):
|
||||
def test_basic_addition(self):
|
||||
"""
|
||||
Tests that 1 + 1 always equals 2.
|
||||
"""
|
||||
self.failUnlessEqual(1 + 1, 2)
|
||||
|
||||
__test__ = {"doctest": """
|
||||
Another way to test that 1 + 1 is equal to 2.
|
||||
|
||||
>>> 1 + 1 == 2
|
||||
True
|
||||
"""}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
from django.conf.urls.defaults import patterns, url
|
||||
|
||||
urlpatterns = patterns('project_tools.views',
|
||||
url(r'^list/$', 'tools_list', (), 'tools_list'),
|
||||
)
|
||||
@@ -0,0 +1,16 @@
|
||||
from django.shortcuts import render_to_response, get_object_or_404
|
||||
from django.template import RequestContext
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from project_tools.api import tool_items
|
||||
from project_setup.widgets import setup_button_widget
|
||||
|
||||
|
||||
def tools_list(request):
|
||||
context = {
|
||||
'object_list': [setup_button_widget(request, item) for item in tool_items],
|
||||
'title': _(u'tools'),
|
||||
}
|
||||
|
||||
return render_to_response('generic_list_horizontal.html', context,
|
||||
context_instance=RequestContext(request))
|
||||
Reference in New Issue
Block a user