1. mickt
  2. django-lfs

Commits

Kai Diefenbach  committed a8475a7

Added metadata to shop.

  • Participants
  • Parent commits f19db52
  • Branches default

Comments (0)

Files changed (13)

File lfs/core/management/commands/lfs_migrate.py

View file
 
         Page.objects.create(id=1, title="Root", slug="", active=1, exclude_from_navigation=1)
 
+        # Shop
+        db.add_column("core_shop", "meta_title", models.CharField(_(u"Meta title"), blank=True, default="<name>", max_length=80))
+        db.add_column("core_shop", "meta_keywords", models.TextField(_(u"Meta keywords"), null=True, blank=True))
+        db.add_column("core_shop", "meta_description", models.TextField(_(u"Meta description"), null=True, blank=True))
+
         application.version = "0.7"
         application.save()
 
-
     def migrate_to_06(self, application, version):
         from lfs.core.utils import get_default_shop
 

File lfs/core/models.py

View file
     checkout_type = models.PositiveSmallIntegerField(_(u"Checkout type"), choices=CHECKOUT_TYPES, default=CHECKOUT_TYPE_SELECT)
     confirm_toc = models.BooleanField(_(u"Confirm TOC"), default=False)
 
+    meta_title = models.CharField(_(u"Meta title"), blank=True, default="<name>", max_length=80)
+    meta_keywords = models.TextField(_(u"Meta keywords"), blank=True)
+    meta_description = models.TextField(_(u"Meta description"), blank=True)
+
     class Meta:
         permissions = (("manage_shop", "Manage shop"),)
 
         return self.name
 
     def get_format_info(self):
-        """
+        """Returns the global format info.
         """
         return {
             "product_cols": self.product_cols,
         """
         return None
 
+    def get_meta_title(self):
+        """Returns the meta title of the shop.
+        """
+        return self.meta_title.replace("<name>", self.name)
+
+    def get_meta_keywords(self):
+        """Returns the meta keywords of the shop.
+        """
+        return self.meta_keywords.replace("<name>", self.name)
+
+    def get_meta_description(self):
+        """Returns the meta description of the shop.
+        """
+        return self.meta_description.replace("<name>", self.name)
+
 
 class Application(models.Model):
     version = models.CharField(_("Version"), blank=True, max_length=10)
 
+
 from monkeys import *

File lfs/core/tests.py

View file
         self.assertEqual(shop.ga_ecommerce_tracking, False)
         self.assertEqual(shop.default_country.name, u"Deutschland")
         self.assertEqual(shop.get_default_country().name, u"Deutschland")
+        self.assertEqual(shop.meta_title, u"<name>")
+        self.assertEqual(shop.meta_keywords, u"")
+        self.assertEqual(shop.meta_description, u"")
 
     def test_from_email(self):
         """
             shop.get_notification_emails(),
             ["john@doe.com", "jane@doe.com"])
 
+    def test_get_meta_title(self):
+        shop = lfs.core.utils.get_default_shop()
+        self.assertEqual("LFS", shop.get_meta_title())
+
+        shop.meta_title = "John Doe"
+        shop.save()
+
+        self.assertEqual("John Doe", shop.get_meta_title())
+
+        shop.meta_title = "<name> - John Doe"
+        shop.save()
+
+        self.assertEqual("LFS - John Doe", shop.get_meta_title())
+
+        shop.meta_title = "John Doe - <name>"
+        shop.save()
+
+        self.assertEqual("John Doe - LFS", shop.get_meta_title())
+
+    def test_get_meta_keywords(self):
+        shop = lfs.core.utils.get_default_shop()
+        self.assertEqual("", shop.get_meta_keywords())
+
+        shop.meta_keywords = "John Doe"
+        shop.save()
+
+        self.assertEqual("John Doe", shop.get_meta_keywords())
+
+        shop.meta_keywords = "<name> - John Doe"
+        shop.save()
+
+        self.assertEqual("LFS - John Doe", shop.get_meta_keywords())
+
+        shop.meta_keywords = "<name> - John Doe"
+        shop.save()
+
+        self.assertEqual("LFS - John Doe", shop.get_meta_keywords())
+
+        shop.meta_keywords = "<name> - John Doe - <name>"
+        shop.save()
+
+        self.assertEqual("LFS - John Doe - LFS", shop.get_meta_keywords())
+
+    def test_get_meta_description(self):
+        shop = lfs.core.utils.get_default_shop()
+        self.assertEqual("", shop.get_meta_description())
+
+        shop.meta_description = "John Doe"
+        shop.save()
+
+        self.assertEqual("John Doe", shop.get_meta_description())
+
+        shop.meta_description = "<name> - John Doe"
+        shop.save()
+
+        self.assertEqual("LFS - John Doe", shop.get_meta_description())
+
+        shop.meta_description = "<name> - John Doe"
+        shop.save()
+
+        self.assertEqual("LFS - John Doe", shop.get_meta_description())
+
+        shop.meta_description = "<name> - John Doe - <name>"
+        shop.save()
+
+        self.assertEqual("LFS - John Doe - LFS", shop.get_meta_description())
+
 
 class TagsTestCase(TestCase):
     """

File lfs/manage/urls.py

View file
 # Shop
 urlpatterns += patterns('lfs.manage.views.shop',
     url(r'^shop$', "manage_shop", name="lfs_manage_shop"),
-    url(r'^save-shop-default-values$', "save_default_values", name="lfs_save_shop_default_values"),
+    url(r'^save-shop-data-tab$', "save_data_tab", name="lfs_save_shop_data_tab"),
+    url(r'^save-shop-default-values-tab$', "save_default_values_tab", name="lfs_save_shop_default_values_tab"),
+    url(r'^save-shop-seo-tab$', "save_seo_tab", name="lfs_save_shop_seo_tab"),
 )
 
 # Shop action

File lfs/manage/views/shop.py

View file
 from django.template.loader import render_to_string
 from django.utils import simplejson
 from django.utils.translation import ugettext_lazy as _
+from django.views.decorators.http import require_POST
 
 # lfs imports
 import lfs.core.utils
 from lfs.manage.views.lfs_portlets import portlets_inline
 
 
-class ShopForm(ModelForm):
+class ShopDataForm(ModelForm):
     """Form to edit shop data.
     """
     def __init__(self, *args, **kwargs):
-        super(ShopForm, self).__init__(*args, **kwargs)
+        super(ShopDataForm, self).__init__(*args, **kwargs)
         self.fields["image"].widget = LFSImageInput()
 
     class Meta:
             "google_analytics_id", "ga_site_tracking", "ga_ecommerce_tracking")
 
 
+class ShopSEOForm(ModelForm):
+    """Form to edit shop SEO data.
+    """
+    class Meta:
+        model = Shop
+        fields = ("meta_title", "meta_keywords", "meta_description")
+
+
 class ShopDefaultValuesForm(ModelForm):
-    """
+    """Form to edit shop default values.
     """
     class Meta:
         model = Shop
 def manage_shop(request, template_name="manage/shop/shop.html"):
     """Displays the form to manage shop data.
     """
-    shop = lfs_get_object_or_404(Shop, pk=1)
-    if request.method == "POST":
-        form = ShopForm(instance=shop, data=request.POST, files=request.FILES)
-        if form.is_valid():
-            form.save()
-            return lfs.core.utils.set_message_cookie(
-                url=reverse("lfs_manage_shop"),
-                msg=_(u"Shop data has been saved."),
-            )
-    else:
-        form = ShopForm(instance=shop)
+    shop = lfs.core.utils.get_default_shop()
+    data_form = ShopDataForm(instance=shop)
+    seo_form = ShopSEOForm(instance=shop)
+    default_values_form = ShopDefaultValuesForm(instance=shop)
 
     return render_to_response(template_name, RequestContext(request, {
         "shop": shop,
-        "form": form,
-        "default_values": default_values_part(request),
+        "data": data_tab(request, shop, data_form),
+        "default_values": default_values_tab(request, shop, default_values_form),
+        "seo": seo_tab(request, shop, seo_form),
         "portlets": portlets_inline(request, shop),
     }))
 
 
-@permission_required("core.manage_shop", login_url="/login/")
-def default_values_part(request, template_name="manage/shop/default_values.html"):
-    """Displays the default value part of the shop form.
+# Parts
+def data_tab(request, shop, form, template_name="manage/shop/data_tab.html"):
+    """Renders the data tab of the shop.
     """
-    shop = lfs_get_object_or_404(Shop, pk=1)
-
-    if request.method == "POST":
-        form = ShopDefaultValuesForm(instance=shop, data=request.POST)
-    else:
-        form = ShopDefaultValuesForm(instance=shop)
-
     return render_to_string(template_name, RequestContext(request, {
         "shop": shop,
         "form": form,
     }))
 
 
-def save_default_values(request):
+def default_values_tab(request, shop, form, template_name="manage/shop/default_values_tab.html"):
+    """Renders the default value tab of the shop.
+    """
+    return render_to_string(template_name, RequestContext(request, {
+        "shop": shop,
+        "form": form,
+    }))
+
+
+def seo_tab(request, shop, form, template_name="manage/shop/seo_tab.html"):
+    """Renders the SEO tab of the shop.
+    """
+    return render_to_string(template_name, RequestContext(request, {
+        "shop": shop,
+        "form": form,
+    }))
+
+
+# Actions
+@require_POST
+@permission_required("core.manage_shop", login_url="/login/")
+def save_data_tab(request):
+    """Saves the data tab of the default shop.
+    """
+    shop = lfs.core.utils.get_default_shop()
+
+    form = ShopDataForm(instance=shop, data=request.POST)
+    if form.is_valid():
+        form.save()
+        shop_changed.send(shop)
+        message = _(u"Shop data has been saved.")
+    else:
+        message = _(u"Please correct the indicated errors.")
+
+    result = simplejson.dumps({
+        "html": [["#data", data_tab(request, shop, form)]],
+        "message": message,
+    }, cls=LazyEncoder)
+
+    return HttpResponse(result)
+
+
+@require_POST
+@permission_required("core.manage_shop", login_url="/login/")
+def save_seo_tab(request):
+    """Saves the seo tab of the default shop.
+    """
+    shop = lfs.core.utils.get_default_shop()
+
+    form = ShopSEOForm(instance=shop, data=request.POST)
+    if form.is_valid():
+        form.save()
+        shop_changed.send(shop)
+        message = _(u"Shop SEO data has been saved.")
+    else:
+        message = _(u"Please correct the indicated errors.")
+
+    result = simplejson.dumps({
+        "html": [["#seo", seo_tab(request, shop, form)]],
+        "message": message,
+    }, cls=LazyEncoder)
+
+    return HttpResponse(result)
+
+
+@require_POST
+@permission_required("core.manage_shop", login_url="/login/")
+def save_default_values_tab(request):
     """Saves the default value part
     """
     shop = lfs_get_object_or_404(Shop, pk=1)
     else:
         message = _(u"Please correct the indicated errors.")
 
-    html = [["#default-values", default_values_part(request)]]
-
     result = simplejson.dumps({
-        "html": html,
+        "html": [["#default-values", default_values_tab(request, shop, form)]],
         "message": message
     }, cls=LazyEncoder)
 

File lfs/page/tests.py

View file
     def test_add_page(self):
         """Tests to add a page.
         """
+        self.assertEqual(self.page.id, 2)
         self.assertEqual(self.page.title, "Page Title")
         self.assertEqual(self.page.slug, "page-title")
         self.assertEqual(self.page.body, "<p>This is a body</p>")

File lfs/page/views.py

View file
 
     return render_to_response(template_name, RequestContext(request, {
         "pages": pages,
-        "page" : Page.objects.get(pk=1),
+        "page": Page.objects.get(pk=1),
     }))
 
 

File lfs/templates/manage/page/seo_tab.html

View file
       method="POST">
     {% csrf_token %}
     {% include "manage/lfs_form.html" %}
-
     <div class="buttons">
         <input type="submit"
                class="button ajax-save-button"
                value="{% trans 'Save SEO' %}">
     </div>
-
 </form>

File lfs/templates/manage/shop/data_tab.html

View file
+{% load i18n %}
+
+<h2>{% trans 'Data' %}</h2>
+<form action="{% url lfs_save_shop_data_tab %}"
+      method="post">
+    {% csrf_token %}
+    <fieldset>
+        <legend>{% trans "General" %}</legend>
+        <div class="field">
+            <div class="label">
+                {{ form.name.label_tag }}:
+            </div>
+
+            {% if form.name.errors %}
+                <div class="error">
+                    {{ form.name }}
+                    {{ form.name.errors }}
+                </div>
+            {% else %}
+                <div>
+                    {{ form.name }}
+                </div>
+            {% endif %}
+        </div>
+        <div class="field">
+            <div class="label">
+                {{ form.shop_owner.label_tag }}:
+            </div>
+
+            {% if form.shop_owner.errors %}
+                <div class="error">
+                    {{ form.shop_owner }}
+                    {{ form.shop_owner.errors }}
+                </div>
+            {% else %}
+                <div>
+                    {{ form.shop_owner }}
+                </div>
+            {% endif %}
+        </div>
+    </fieldset>
+    <fieldset>
+        <legend>{% trans "E-Mails" %}</legend>
+
+        <div class="field">
+            <div class="label">
+                {{ form.from_email.label_tag }}:
+            </div>
+
+            {% if form.from_email.errors %}
+                <div class="error">
+                    {{ form.from_email }}
+                    {{ form.from_email.errors }}
+                </div>
+            {% else %}
+                <div>
+                    {{ form.from_email }}
+                </div>
+            {% endif %}
+        </div>
+
+        <div class="field">
+            <div class="label">
+                {{ form.notification_emails.label_tag }}:
+            </div>
+
+            {% if form.notification_emails.errors %}
+                <div class="error">
+                    {{ form.notification_emails }}
+                    {{ form.notification_emails.errors }}
+                </div>
+            {% else %}
+                <div>
+                    {{ form.notification_emails }}
+                </div>
+            {% endif %}
+        </div>
+    </fieldset>
+
+    <fieldset>
+        <legend>{% trans "Google" %}</legend>
+        <div class="field">
+            <div class="label">
+                {{ form.google_analytics_id.label_tag }}:
+            </div>
+            {% if form.google_analytics_id.errors %}
+                <div class="error">
+                    {{ form.google_analytics_id }}
+                    {{ form.google_analytics_id.errors }}
+                </div>
+            {% else %}
+                <div>
+                    {{ form.google_analytics_id }}
+                </div>
+            {% endif %}
+        </div>
+        <div class="field">
+            <div class="label">
+                {{ form.ga_site_tracking.label_tag }}:
+            </div>
+            <div>
+                {{ form.ga_site_tracking }}
+            </div>
+        </div>
+        <div class="field">
+            <div class="label">
+                {{ form.ga_ecommerce_tracking.label_tag }}:
+            </div>
+            <div>
+                {{ form.ga_ecommerce_tracking }}
+            </div>
+        </div>
+    </fieldset>
+
+    <fieldset>
+        <legend>{% trans "Checkout" %}</legend>
+            <div class="field">
+                <div class="label">
+                    {{ form.checkout_type.label_tag }}:
+                </div>
+                {% if form.checkout_type.errors %}
+                    <div class="error">
+                        {{ form.checkout_type }}
+                        {{ form.checkout_type.errors }}
+                    </div>
+                {% else %}
+                    <div>
+                        {{ form.checkout_type }}
+                    </div>
+                {% endif %}
+            </div>
+            <div class="field">
+                <div class="label">
+                    {{ form.confirm_toc.label_tag }}:
+                </div>
+                <div>
+                    {{ form.confirm_toc }}
+                </div>
+            </div>
+    </fieldset>
+
+    <fieldset>
+        <legend>{% trans "Content" %}</legend>
+            <div class="field">
+                <div class="label">
+                    {{ form.description.label_tag }}:
+                </div>
+                {% if form.description.errors %}
+                    <div class="error">
+                        {{ form.description }}
+                        {{ form.description.errors }}
+                    </div>
+                {% else %}
+                    <div>
+                        {{ form.description }}
+                    </div>
+                {% endif %}
+            </div>
+            <div class="field">
+                <div class="label">
+                    {{ form.image.label_tag }}:
+                </div>
+                {% if form.image.errors %}
+                    <div class="error">
+                        {{ form.image }}
+                        {{ form.image.errors }}
+                    </div>
+                {% else %}
+                    <div>
+                        {{ form.image }}
+                    </div>
+                {% endif %}
+            </div>
+            <div class="field">
+                <div class="label">
+                    {{ form.static_block.label_tag }}:
+                </div>
+                {% if form.static_block.errors %}
+                    <div class="error">
+                        {{ form.static_block }}
+                        {{ form.static_block.errors }}
+                    </div>
+                {% else %}
+                    <div>
+                        {{ form.static_block }}
+                    </div>
+                {% endif %}
+            </div>
+    </fieldset>
+    <div class="buttons">
+        <input type="submit"
+               class="button ajax-save-button"
+               value="{% trans 'Save shop' %}" />
+    </div>
+</form>

File lfs/templates/manage/shop/default_values.html

-{% load i18n %}
-<h2>
-    {% trans 'Default Values' %}
-</h2>
-
-<form action="{% url lfs_save_shop_default_values %}"
-      method="post">
-    <fieldset>
-        <legend>{% trans "Price Calculator" %}</legend>
-        <div class="field">
-            <div class="label">
-                {{ form.price_calculator.label_tag }}:
-            </div>
-            {% if form.price_calculator.errors %}
-                <div class="error">
-                    {{ form.price_calculator }}
-                    {{ form.price_calculator.errors }}
-                </div>
-            {% else %}
-                <div>
-                    {{ form.price_calculator }}
-                </div>
-            {% endif %}
-        </div>
-    </fieldset>
-    <fieldset>
-        <legend>{% trans 'Format' %}</legend>
-        <div class="field">
-            <div class="label">
-                {{ form.product_cols.label_tag }}:
-            </div>
-
-            {% if form.product_cols.errors %}
-                <div class="error">
-                    {{ form.product_cols }}
-                    {{ form.product_cols.errors }}
-                </div>
-            {% else %}
-                <div>
-                    {{ form.product_cols }}
-                </div>
-            {% endif %}
-        </div>
-
-        <div class="field">
-            <div class="label">
-                {{ form.product_rows.label_tag }}:
-            </div>
-
-            {% if form.product_rows.errors %}
-                <div class="error">
-                    {{ form.product_rows }}
-                    {{ form.product_rows.errors }}
-                </div>
-            {% else %}
-                <div>
-                    {{ form.product_rows }}
-                </div>
-            {% endif %}
-        </div>
-
-        <div class="field">
-            <div class="label">
-                {{ form.category_cols.label_tag }}:
-            </div>
-
-            {% if form.category_cols.errors %}
-                <div class="error">
-                    {{ form.category_cols }}
-                    {{ form.category_cols.errors }}
-                </div>
-            {% else %}
-                <div>
-                    {{ form.category_cols }}
-                </div>
-            {% endif %}
-        </div>
-    </fieldset>
-
-    <fieldset>
-        <legend>{% trans 'Countries' %}</legend>
-        <div class="field">
-            <div class="label">
-                {{ form.invoice_countries.label_tag }}:
-            </div>
-            {% if form.invoice_countries.errors %}
-                <div class="error">
-                    {{ form.invoice_countries }}
-                    {{ form.invoice_countries.errors }}
-                </div>
-            {% else %}
-                <div>
-                    {{ form.invoice_countries }}
-                </div>
-            {% endif %}
-        </div>
-        <div class="field">
-            <div class="label">
-                {{ form.shipping_countries.label_tag }}:
-            </div>
-            {% if form.shipping_countries.errors %}
-                <div class="error">
-                    {{ form.shipping_countries }}
-                    {{ form.shipping_countries.errors }}
-                </div>
-            {% else %}
-                <div>
-                    {{ form.shipping_countries }}
-                </div>
-            {% endif %}
-        </div>
-
-        <div class="field">
-            <div class="label">
-                {{ form.default_country.label_tag }}:
-            </div>
-            {% if form.default_country.errors %}
-                <div class="error">
-                    {{ form.default_country }}
-                    {{ form.default_country.errors }}
-                </div>
-            {% else %}
-                <div>
-                    {{ form.default_country }}
-                </div>
-            {% endif %}
-        </div>
-    </fieldset>
-
-    <fieldset>
-        <legend>{% trans "Localization" %}</legend>
-        <div class="field">
-            <div class="label">
-                {{ form.default_locale.label_tag }}:
-            </div>
-            {% if form.default_locale.errors %}
-                <div class="error">
-                    {{ form.default_locale }}
-                    {{ form.default_locale.errors }}
-                </div>
-            {% else %}
-                <div>
-                    {{ form.default_locale }}
-                </div>
-            {% endif %}
-        </div>
-        <div class="field">
-            <div class="label">
-                {{ form.use_international_currency_code.label_tag }}:
-            </div>
-            <div>
-                {{ form.use_international_currency_code }}
-            </div>
-        </div>
-
-    </fieldset>
-    <div class="buttons">
-        <input class="ajax-save-button button"
-               type="submit"
-               value="{% trans 'Save Default Values' %}">
-    </div>
-</form>

File lfs/templates/manage/shop/default_values_tab.html

View file
+{% load i18n %}
+<h2>
+    {% trans 'Default Values' %}
+</h2>
+
+<form action="{% url lfs_save_shop_default_values_tab %}"
+      method="post">
+    <fieldset>
+        <legend>{% trans "Price Calculator" %}</legend>
+        <div class="field">
+            <div class="label">
+                {{ form.price_calculator.label_tag }}:
+            </div>
+            {% if form.price_calculator.errors %}
+                <div class="error">
+                    {{ form.price_calculator }}
+                    {{ form.price_calculator.errors }}
+                </div>
+            {% else %}
+                <div>
+                    {{ form.price_calculator }}
+                </div>
+            {% endif %}
+        </div>
+    </fieldset>
+    <fieldset>
+        <legend>{% trans 'Format' %}</legend>
+        <div class="field">
+            <div class="label">
+                {{ form.product_cols.label_tag }}:
+            </div>
+
+            {% if form.product_cols.errors %}
+                <div class="error">
+                    {{ form.product_cols }}
+                    {{ form.product_cols.errors }}
+                </div>
+            {% else %}
+                <div>
+                    {{ form.product_cols }}
+                </div>
+            {% endif %}
+        </div>
+
+        <div class="field">
+            <div class="label">
+                {{ form.product_rows.label_tag }}:
+            </div>
+
+            {% if form.product_rows.errors %}
+                <div class="error">
+                    {{ form.product_rows }}
+                    {{ form.product_rows.errors }}
+                </div>
+            {% else %}
+                <div>
+                    {{ form.product_rows }}
+                </div>
+            {% endif %}
+        </div>
+
+        <div class="field">
+            <div class="label">
+                {{ form.category_cols.label_tag }}:
+            </div>
+
+            {% if form.category_cols.errors %}
+                <div class="error">
+                    {{ form.category_cols }}
+                    {{ form.category_cols.errors }}
+                </div>
+            {% else %}
+                <div>
+                    {{ form.category_cols }}
+                </div>
+            {% endif %}
+        </div>
+    </fieldset>
+
+    <fieldset>
+        <legend>{% trans 'Countries' %}</legend>
+        <div class="field">
+            <div class="label">
+                {{ form.invoice_countries.label_tag }}:
+            </div>
+            {% if form.invoice_countries.errors %}
+                <div class="error">
+                    {{ form.invoice_countries }}
+                    {{ form.invoice_countries.errors }}
+                </div>
+            {% else %}
+                <div>
+                    {{ form.invoice_countries }}
+                </div>
+            {% endif %}
+        </div>
+        <div class="field">
+            <div class="label">
+                {{ form.shipping_countries.label_tag }}:
+            </div>
+            {% if form.shipping_countries.errors %}
+                <div class="error">
+                    {{ form.shipping_countries }}
+                    {{ form.shipping_countries.errors }}
+                </div>
+            {% else %}
+                <div>
+                    {{ form.shipping_countries }}
+                </div>
+            {% endif %}
+        </div>
+
+        <div class="field">
+            <div class="label">
+                {{ form.default_country.label_tag }}:
+            </div>
+            {% if form.default_country.errors %}
+                <div class="error">
+                    {{ form.default_country }}
+                    {{ form.default_country.errors }}
+                </div>
+            {% else %}
+                <div>
+                    {{ form.default_country }}
+                </div>
+            {% endif %}
+        </div>
+    </fieldset>
+
+    <fieldset>
+        <legend>{% trans "Localization" %}</legend>
+        <div class="field">
+            <div class="label">
+                {{ form.default_locale.label_tag }}:
+            </div>
+            {% if form.default_locale.errors %}
+                <div class="error">
+                    {{ form.default_locale }}
+                    {{ form.default_locale.errors }}
+                </div>
+            {% else %}
+                <div>
+                    {{ form.default_locale }}
+                </div>
+            {% endif %}
+        </div>
+        <div class="field">
+            <div class="label">
+                {{ form.use_international_currency_code.label_tag }}:
+            </div>
+            <div>
+                {{ form.use_international_currency_code }}
+            </div>
+        </div>
+
+    </fieldset>
+    <div class="buttons">
+        <input class="ajax-save-button button"
+               type="submit"
+               value="{% trans 'Save Default Values' %}">
+    </div>
+</form>

File lfs/templates/manage/shop/seo_tab.html

View file
+{% load i18n %}
+<h2>
+    {% trans 'SEO' %}
+</h2>
+
+<form action="{% url lfs_save_shop_seo_tab %}"
+      method="post">
+      {% include "manage/lfs_form.html" %}
+    <div class="buttons">
+        <input type="submit"
+               class="button ajax-save-button"
+               value="{% trans 'Save SEO' %}">
+    </div>
+</form>

File lfs/templates/manage/shop/shop.html

View file
         <ul>
             <li class="ui-tabs-nav-item"><a href="#data">{% trans 'Shop' %}</a></li>
             <li class="ui-tabs-nav-item"><a href="#default-values">{% trans 'Default Values' %}</a></li>
+            <li class="ui-tabs-nav-item"><a href="#seo">{% trans 'SEO' %}</a></li>
             <li class="ui-tabs-nav-item"><a href="#portlets">{% trans 'Portlets' %}</a></li>
         </ul>
 
         <div id="data">
-            <h2>{% trans 'Data' %}</h2>
-            <form action="{% url lfs_manage_shop %}"
-                  method="post"
-                  enctype="multipart/form-data">
-                {% csrf_token %}  
-                <fieldset>
-                    <legend>{% trans "General" %}</legend>
-                    <div class="field">
-                        <div class="label">
-                            {{ form.name.label_tag }}:
-                        </div>
-
-                        {% if field.errors %}
-                            <div class="error">
-                                {{ form.name }}
-                                {{ form.name.errors }}
-                            </div>
-                        {% else %}
-                            <div>
-                                {{ form.name }}
-                            </div>
-                        {% endif %}
-                    </div>
-                    <div class="field">
-                        <div class="label">
-                            {{ form.shop_owner.label_tag }}:
-                        </div>
-
-                        {% if field.errors %}
-                            <div class="error">
-                                {{ form.shop_owner }}
-                                {{ form.shop_owner.errors }}
-                            </div>
-                        {% else %}
-                            <div>
-                                {{ form.shop_owner }}
-                            </div>
-                        {% endif %}
-                    </div>
-                </fieldset>
-                <fieldset>
-                    <legend>{% trans "E-Mails" %}</legend>
-
-                    <div class="field">
-                        <div class="label">
-                            {{ form.from_email.label_tag }}:
-                        </div>
-
-                        {% if field.errors %}
-                            <div class="error">
-                                {{ form.from_email }}
-                                {{ form.from_email.errors }}
-                            </div>
-                        {% else %}
-                            <div>
-                                {{ form.from_email }}
-                            </div>
-                        {% endif %}
-                    </div>
-
-                    <div class="field">
-                        <div class="label">
-                            {{ form.notification_emails.label_tag }}:
-                        </div>
-
-                        {% if field.errors %}
-                            <div class="error">
-                                {{ form.notification_emails }}
-                                {{ form.notification_emails.errors }}
-                            </div>
-                        {% else %}
-                            <div>
-                                {{ form.notification_emails }}
-                            </div>
-                        {% endif %}
-                    </div>
-                </fieldset>
-
-                <fieldset>
-                    <legend>{% trans "Google" %}</legend>
-                    <div class="field">
-                        <div class="label">
-                            {{ form.google_analytics_id.label_tag }}:
-                        </div>
-                        {% if field.errors %}
-                            <div class="error">
-                                {{ form.google_analytics_id }}
-                                {{ form.google_analytics_id.errors }}
-                            </div>
-                        {% else %}
-                            <div>
-                                {{ form.google_analytics_id }}
-                            </div>
-                        {% endif %}
-                    </div>
-                    <div class="field">
-                        <div class="label">
-                            {{ form.ga_site_tracking.label_tag }}:
-                        </div>
-                        <div>
-                            {{ form.ga_site_tracking }}
-                        </div>
-                    </div>
-                    <div class="field">
-                        <div class="label">
-                            {{ form.ga_ecommerce_tracking.label_tag }}:
-                        </div>
-                        <div>
-                            {{ form.ga_ecommerce_tracking }}
-                        </div>
-                    </div>
-                </fieldset>
-
-                <fieldset>
-                    <legend>{% trans "Checkout" %}</legend>
-                        <div class="field">
-                            <div class="label">
-                                {{ form.checkout_type.label_tag }}:
-                            </div>
-                            {% if field.errors %}
-                                <div class="error">
-                                    {{ form.checkout_type }}
-                                    {{ form.checkout_type.errors }}
-                                </div>
-                            {% else %}
-                                <div>
-                                    {{ form.checkout_type }}
-                                </div>
-                            {% endif %}
-                        </div>
-                        <div class="field">
-                            <div class="label">
-                                {{ form.confirm_toc.label_tag }}:
-                            </div>
-                            <div>
-                                {{ form.confirm_toc }}
-                            </div>
-                        </div>
-                </fieldset>
-
-                <fieldset>
-                    <legend>{% trans "Content" %}</legend>
-                        <div class="field">
-                            <div class="label">
-                                {{ form.description.label_tag }}:
-                            </div>
-                            {% if field.errors %}
-                                <div class="error">
-                                    {{ form.description }}
-                                    {{ form.description.errors }}
-                                </div>
-                            {% else %}
-                                <div>
-                                    {{ form.description }}
-                                </div>
-                            {% endif %}
-                        </div>
-                        <div class="field">
-                            <div class="label">
-                                {{ form.image.label_tag }}:
-                            </div>
-                            {% if field.errors %}
-                                <div class="error">
-                                    {{ form.image }}
-                                    {{ form.image.errors }}
-                                </div>
-                            {% else %}
-                                <div>
-                                    {{ form.image }}
-                                </div>
-                            {% endif %}
-                        </div>
-                        <div class="field">
-                            <div class="label">
-                                {{ form.static_block.label_tag }}:
-                            </div>
-                            {% if field.errors %}
-                                <div class="error">
-                                    {{ form.static_block }}
-                                    {{ form.static_block.errors }}
-                                </div>
-                            {% else %}
-                                <div>
-                                    {{ form.static_block }}
-                                </div>
-                            {% endif %}
-                        </div>
-                </fieldset>
-                <div class="buttons">
-                    <input type="submit"
-                           class="button"
-                           value="{% trans 'Save shop' %}" />
-                </div>
-            </form>
+            {{ data|safe }}
         </div>
         <div id="default-values">
-            {{ default_values }}
+            {{ default_values|safe }}
+        </div>
+        <div id="seo">
+            {{ seo|safe }}
         </div>
         <div id="portlets">
             {{ portlets|safe }}
         </div>
     </div>
-{% endblock %}
+{% endblock %}