From 77991fd4612ae6a434e23aef3fd4d0ed83507740 Mon Sep 17 00:00:00 2001 From: duker33 Date: Sat, 28 Sep 2019 09:55:25 +0300 Subject: [PATCH] #971,969 Seo fixes from 25.09.19 (#972) * #971 Fix contacts page styles * #971 Fix tile-about text about accums * #971 Fix subcategories sorting * #971 Add "Add to cart" button for the product tile * #971 Rm doubled data from the product microdata * #971 Subtask top menu subcategories sorting * #971 Fix search icon in header * #971 Grade refarm to 0.7.2 --- front/less/pages/category.less | 24 ++++++------- front/less/pages/contacts.less | 3 +- front/less/pages/main.less | 18 +++++++++- requirements.txt | 2 +- shopelectro/tests/tests_views.py | 32 +++++++++++++++++ templates/catalog/category.html | 2 +- templates/catalog/category_children.html | 4 +-- templates/catalog/product.html | 3 +- templates/catalog/product_feedback.html | 1 + templates/index/product_thumbnail.html | 2 +- templates/index/tile_about.html | 5 +-- templates/layout/header.html | 5 +-- templates/layout/tile_products.html | 44 ++++++++++++++---------- 13 files changed, 99 insertions(+), 46 deletions(-) diff --git a/front/less/pages/category.less b/front/less/pages/category.less index 211b063f..3c63ce7f 100644 --- a/front/less/pages/category.less +++ b/front/less/pages/category.less @@ -175,6 +175,15 @@ cursor: pointer; text-decoration: none; } + + .btn-category-buy { + height: 44px; + float: right; + font-size: @f-size-base + 3; + padding: 6px 10px; + margin-left: 5px; + width: 105px; + } } .product-card-desc { @@ -260,7 +269,6 @@ .order { bottom: 3px; - position: absolute; right: 15px; width: 200px; } @@ -297,18 +305,8 @@ } }); -.btn { - &-category-buy { - height: 44px; - float: right; - font-size: @f-size-base + 3; - padding: 6px 10px; - margin-left: 5px; - } - - &-load-more { - margin: 5px auto 25px; - } +.btn-load-more { + margin: 5px auto 25px; } // ================================================================ diff --git a/front/less/pages/contacts.less b/front/less/pages/contacts.less index d78c26f4..b3a9454b 100644 --- a/front/less/pages/contacts.less +++ b/front/less/pages/contacts.less @@ -9,7 +9,6 @@ & .text { background-color: white; padding: 55px 0 0 40px; - width: 45%; .Q(@xs; { margin: 0 auto; @@ -20,6 +19,8 @@ .Q(@md; { display: inline-block; vertical-align: top; + width: 45%; + padding-left: 0px; }); & ul.items { diff --git a/front/less/pages/main.less b/front/less/pages/main.less index ceaf878d..ab9452c2 100644 --- a/front/less/pages/main.less +++ b/front/less/pages/main.less @@ -1,6 +1,23 @@ @import "../common/variables"; @import "../common/utilities/mixins"; +.index-page .product-card { + &-text { + padding-bottom: 15px; + + .input-group { + display: none; + } + + .btn-category-buy { + height: 44px; + font-size: @f-size-base + 3; + margin: 5px 6% 0 6%; + width: 88%; + } + } +} + .page-front { margin: -20px 0 0; @@ -365,7 +382,6 @@ &-description { .sub-plate; font-size: @f-size-base - 2; - height: 150px; padding: 5px 12px; } diff --git a/requirements.txt b/requirements.txt index 0c020044..c0e9ab9e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,4 +25,4 @@ sorl-thumbnail==12.5.0 python-telegram-bot==11.1.0 sentry-sdk==0.7.2 https://github.com/selwin/django-user_agents/archive/master.zip -https://github.com/fidals/refarm-site/archive/0.7.1.zip +https://github.com/fidals/refarm-site/archive/0.7.2.zip diff --git a/shopelectro/tests/tests_views.py b/shopelectro/tests/tests_views.py index f22697a5..170e5f23 100644 --- a/shopelectro/tests/tests_views.py +++ b/shopelectro/tests/tests_views.py @@ -480,6 +480,38 @@ class Category(ViewsTestCase): fixtures = ['dump.json'] + def get_url( + self, + category: models.Category = None, + tags: models.TagQuerySet = None, + sorting: int = None, + query_string: dict = None, + ): + category = category or self.category + return reverse_catalog_url( + 'category', {'slug': category.page.slug}, tags, sorting, query_string, + ) + + def get_page(self, *args, **kwargs): + return self.client.get(self.get_category_url(*args, **kwargs)) + + def get_soup(self, *args, **kwargs) -> BeautifulSoup: + category_page = self.get_page(*args, **kwargs) + return BeautifulSoup( + category_page.content.decode('utf-8'), + 'html.parser' + ) + + def test_subcategories_presented(self): + child = models.Category.objects.active().exclude(parent=None).first() + category = child.parent + soup = self.get_soup(category) + db_names = list(category.get_children().values_list('name', flat=True)) + soup_names = [ + t.text.strip() for t in soup.find_all(class_='subcategory-list-link') + ] + self.assertEqual(db_names, soup_names) + def test_page_db_template_with_special_chars(self): """ DB template works with many cyrillic chars in string. diff --git a/templates/catalog/category.html b/templates/catalog/category.html index b07aae26..5198f3ba 100644 --- a/templates/catalog/category.html +++ b/templates/catalog/category.html @@ -9,7 +9,7 @@

{{ page.display.h1|ca
- {% include 'catalog/category_children.html' with category=category tags=tags only %} + {% include 'catalog/category_children.html' with children=children only %} {% include 'catalog/category_tags.html' with group_tags_pairs=group_tags_pairs request=request only %} diff --git a/templates/catalog/category_children.html b/templates/catalog/category_children.html index 189de6e6..b5a66820 100644 --- a/templates/catalog/category_children.html +++ b/templates/catalog/category_children.html @@ -1,6 +1,6 @@ -{% if not category.is_leaf_node %} +{% if children %}

data-id="{{ feedback.id }}" title="Удалить отзыв"> {% endif %}
+
diff --git a/templates/index/product_thumbnail.html b/templates/index/product_thumbnail.html index 958ff682..d8a7821b 100644 --- a/templates/index/product_thumbnail.html +++ b/templates/index/product_thumbnail.html @@ -12,5 +12,5 @@ {% placeholder_image_url as image_url %} {% get_img_alt product.page %} + alt="{% get_img_alt product.page %}"> {% endif %} diff --git a/templates/index/tile_about.html b/templates/index/tile_about.html index 21439b89..a75a6388 100644 --- a/templates/index/tile_about.html +++ b/templates/index/tile_about.html @@ -40,10 +40,7 @@
-
- Делаем блоки питания под заказ — паяем аккумуляторы любого типоразмера, емкости - и конфигурации -
+
Паяем аккумуляторные сборки
diff --git a/templates/layout/header.html b/templates/layout/header.html index 28bd3f64..cff143a8 100644 --- a/templates/layout/header.html +++ b/templates/layout/header.html @@ -97,7 +97,7 @@
- +
@@ -110,7 +110,7 @@ - {% comment %}Cache for a day{% endcomment %} + {# Cache for a day #} {% cache 86400 categories_menu %}