Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace ugettext_lazy by gettext_lazy, ugettext by gettext, ungettext… #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 29 additions & 19 deletions shuup_boilerplate_theme/plugins/store_info_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from shuup.xtheme import TemplatedPlugin
from shuup.xtheme.plugins.forms import TranslatableField
Expand All @@ -16,30 +16,40 @@ class StoreInfoPlugin(TemplatedPlugin):
"""
A simple plugin to show store info in front
"""

identifier = "boilerplate_store_information"
name = _("Store information")
template_name = "boilerplate/plugins/store_info.jinja"
# editor_form_class = PageLinksConfigForm

fields = [
("title", TranslatableField(label=_("Title"), required=False, initial="")),
("show_logo", forms.BooleanField(
label=_("Show Logo"),
required=False,
initial=True,
help_text=_("Show logo of the shop inside information box."),
)),
("show_contact_address", forms.BooleanField(
label=_("Show Contact Address information"),
required=False,
initial=True,
help_text=_("Show store contact address information"),
)),
("show_name", forms.BooleanField(
label=_("Show public name"),
initial=True,
required=False,
)),
(
"show_logo",
forms.BooleanField(
label=_("Show Logo"),
required=False,
initial=True,
help_text=_("Show logo of the shop inside information box."),
),
),
(
"show_contact_address",
forms.BooleanField(
label=_("Show Contact Address information"),
required=False,
initial=True,
help_text=_("Show store contact address information"),
),
),
(
"show_name",
forms.BooleanField(
label=_("Show public name"),
initial=True,
required=False,
),
),
]

def get_context_data(self, context):
Expand All @@ -53,5 +63,5 @@ def get_context_data(self, context):
"show_logo": show_logo,
"show_contact_address": show_contact_address,
"show_name": show_name,
"shop": request.shop
"shop": request.shop,
}
27 changes: 19 additions & 8 deletions shuup_boilerplate_theme/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from shuup.themes.classic_gray.theme import ClassicGrayTheme

Expand All @@ -17,6 +17,7 @@ class ShuupBoilerplateTheme(ClassicGrayTheme):

This is a simple theme that shows the inheritance from one of the Shuup base themes
"""

identifier = "shuup_boilerplate_theme" # internal identifier for theme, used system wide to differentiate themes
name = _("Shuup Boilerplate Theme") # Template name, shown in admin
author = "Shoop Commerce Ltd" # The author of the theme, shown in admin
Expand All @@ -29,9 +30,7 @@ class ShuupBoilerplateTheme(ClassicGrayTheme):

Boilerplate offers one plugin that shows store information for visiting customer.
"""
plugins = [
"shuup_boilerplate_theme.plugins:StoreInfoPlugin"
]
plugins = ["shuup_boilerplate_theme.plugins:StoreInfoPlugin"]

"""
Configurable fields
Expand All @@ -45,10 +44,22 @@ class ShuupBoilerplateTheme(ClassicGrayTheme):
Example usage of this can be found below.
"""
fields = [
("show_boilerplate", forms.BooleanField(
required=False, initial=True, label=_("Show the boilerplate information on frontpage"))),
("boilerplate_text", forms.CharField(required=False, label=_("Boilerplate text"))),
("boilerplate_date", forms.DateField(required=False, label=_("Boilerplate date")))
(
"show_boilerplate",
forms.BooleanField(
required=False,
initial=True,
label=_("Show the boilerplate information on frontpage"),
),
),
(
"boilerplate_text",
forms.CharField(required=False, label=_("Boilerplate text")),
),
(
"boilerplate_date",
forms.DateField(required=False, label=_("Boilerplate date")),
),
]

def should_show_boilerplate(self):
Expand Down