From 232361bd4547338b7eba6a643ead500bf1d3f746 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Fri, 7 Sep 2012 02:05:40 -0400 Subject: [PATCH] Main app updates --- apps/main/__init__.py | 14 +++--- apps/main/settings.py | 45 +++++++++----------- apps/main/templates/base.html | 6 +-- apps/main/templatetags/main_settings_tags.py | 4 +- apps/main/views.py | 7 +-- 5 files changed, 35 insertions(+), 41 deletions(-) diff --git a/apps/main/__init__.py b/apps/main/__init__.py index 64ba9ea61a..30a005e767 100644 --- a/apps/main/__init__.py +++ b/apps/main/__init__.py @@ -4,7 +4,7 @@ from django.utils.translation import ugettext_lazy as _ from navigation.api import Link, register_top_menu -from .conf.settings import SIDE_BAR_SEARCH, DISABLE_HOME_VIEW +#from .conf.settings import SIDE_BAR_SEARCH, DISABLE_HOME_VIEW __author__ = 'Roberto Rosario' __copyright__ = 'Copyright 2011 Roberto Rosario' @@ -16,7 +16,7 @@ __status__ = 'Production' __version_info__ = { 'major': 0, - 'minor': 13, + 'minor': 1, 'micro': 0, 'releaselevel': 'alpha', 'serial': 0 @@ -37,7 +37,9 @@ def get_version(): __version__ = get_version() -if not DISABLE_HOME_VIEW: - register_top_menu('home', link=Link(text=_(u'home'), view='home', sprite='house'), position=0) -if not SIDE_BAR_SEARCH: - register_top_menu('search', link=Link(text=_(u'search'), view='search', sprite='zoom', children_url_regex=[r'^search/'])) + +# TODO: fix these settings +#if not DISABLE_HOME_VIEW: +register_top_menu('home', link=Link(text=_(u'home'), view='home', sprite='house'), position=0) +#if not SIDE_BAR_SEARCH: +# register_top_menu('search', link=Link(text=_(u'search'), view='search', sprite='zoom', children_url_regex=[r'^search/'])) diff --git a/apps/main/settings.py b/apps/main/settings.py index 0fb71dbc58..bce6a18351 100644 --- a/apps/main/settings.py +++ b/apps/main/settings.py @@ -1,28 +1,25 @@ """Configuration options for the main app""" from django.utils.translation import ugettext_lazy as _ -from smart_settings.api import Setting, SettingNamespace -namespace = SettingNamespace('main', _(u'Main'), module='main.conf.settings') - -Setting( - namespace=namespace, - name=u'SIDE_BAR_SEARCH', - global_name=u'MAIN_SIDE_BAR_SEARCH', - default=False, - description=_(u'Controls whether the search functionality is provided by a sidebar widget or by a menu entry.') -) - -Setting( - namespace=namespace, - name=u'DISABLE_HOME_VIEW', - global_name=u'MAIN_DISABLE_HOME_VIEW', - default=False, -) - -Setting( - namespace=namespace, - name=u'DISABLE_ICONS', - global_name=u'MAIN_DISABLE_ICONS', - default=False, -) +#Setting( +# namespace=namespace, +# name=u'SIDE_BAR_SEARCH', +# global_name=u'MAIN_SIDE_BAR_SEARCH', +# default=False, +# description=_(u'Controls whether the search functionality is provided by a sidebar widget or by a menu entry.') +#) +# +#Setting( +# namespace=namespace, +# name=u'DISABLE_HOME_VIEW', +# global_name=u'MAIN_DISABLE_HOME_VIEW', +# default=False, +#) +# +#Setting( +# namespace=namespace, +# name=u'DISABLE_ICONS', +# global_name=u'MAIN_DISABLE_ICONS', +# default=False, +#) diff --git a/apps/main/templates/base.html b/apps/main/templates/base.html index 0ea57c55af..9115124dcf 100644 --- a/apps/main/templates/base.html +++ b/apps/main/templates/base.html @@ -3,7 +3,6 @@ {% load project_tags %} {% load navigation_tags %} {% load settings %} -{% load search_tags %} {% load main_settings_tags %} {% load variable_tags %} @@ -24,7 +23,7 @@ {% block html_title %}{% project_name %}{{ request.new_window_url }}{% block title %}{% endblock %}{% endblock %} -{% get_main_setting "SIDE_BAR_SEARCH" as debug %} +{#{% get_main_setting "SIDE_BAR_SEARCH" as debug %}#} {% block web_theme_project_name %}{% project_name %}{% if debug %} {% trans "(DEBUG)" %} {% endif %}{% endblock %} {% block web_theme_stylesheets %} @@ -264,6 +263,7 @@ {% endblock %} {% block web_theme_sidebar %} +{% comment %} {% get_main_setting "SIDE_BAR_SEARCH" as side_bar_search %} {% if side_bar_search and not web_theme_hide_menus %} {% with "true" as side_bar %} @@ -276,7 +276,7 @@ {% endwith %} {% endwith %} {% endif %} - +{% endcomment %} {% get_object_navigation_links "secondary_menu" as secondary_menu_navigation_links %} {% if secondary_menu_navigation_links %}
diff --git a/apps/main/templatetags/main_settings_tags.py b/apps/main/templatetags/main_settings_tags.py index 54c6b290c3..586e48280b 100644 --- a/apps/main/templatetags/main_settings_tags.py +++ b/apps/main/templatetags/main_settings_tags.py @@ -2,7 +2,7 @@ import re from django.template import Node from django.template import TemplateSyntaxError, Library -from main.conf import settings +#from main.conf import settings register = Library() @@ -13,7 +13,7 @@ class SettingsNode(Node): self.var_name = var_name def render(self, context): - context[self.var_name] = getattr(settings, self.format_string, '') + context[self.var_name] = ''#getattr(settings, self.format_string, '') return '' diff --git a/apps/main/views.py b/apps/main/views.py index ffdb348087..13fe4a45f3 100644 --- a/apps/main/views.py +++ b/apps/main/views.py @@ -5,12 +5,7 @@ from django.template import RequestContext from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse -from .conf.settings import DISABLE_HOME_VIEW - def home(request): - if DISABLE_HOME_VIEW: - return HttpResponseRedirect(reverse('document_list_recent')) - else: - return render_to_response('home.html', {}, + return render_to_response('home.html', {}, context_instance=RequestContext(request))