Source code for shoop.themes.classic_gray

# This file is part of Shoop.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.

import django.conf
from django import forms
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _

from shoop.apps import AppConfig
from shoop.xtheme import Theme


[docs]class ClassicGrayTheme(Theme): identifier = "shoop.themes.classic_gray" name = "Shoop Classic Gray Theme" author = "Juha Kujala" template_dir = "classic_gray/" fields = [ ("show_welcome_text", forms.BooleanField(required=False, initial=True, label=_("Show Frontpage Welcome Text"))), ]
[docs] def get_configuration_form(self, form_kwargs): from shoop.xtheme.forms import GenericThemeForm return GenericThemeForm(theme=self, **form_kwargs)
[docs] def get_view(self, view_name): import shoop.themes.classic_gray.views as views return getattr(views, view_name, None)
def _format_cms_links(self, **query_kwargs): if "shoop.simple_cms" not in django.conf.settings.INSTALLED_APPS: return from shoop.simple_cms.models import Page for page in Page.objects.visible().filter(**query_kwargs): yield {"url": "/%s" % page.url, "text": force_text(page)}
[docs]class ClassicGrayThemeAppConfig(AppConfig): name = "shoop.themes.classic_gray" verbose_name = ClassicGrayTheme.name label = "shoop.themes.classic_gray" provides = { "xtheme": "shoop.themes.classic_gray:ClassicGrayTheme", "xtheme_plugin": [ "shoop.themes.classic_gray.plugins:ProductHighlightPlugin", "shoop.themes.classic_gray.plugins:ProductCrossSellsPlugin", ], }
default_app_config = "shoop.themes.classic_gray.ClassicGrayThemeAppConfig"