Skip to content

Commit

Permalink
#971,969 Seo fixes from 25.09.19 (#972)
Browse files Browse the repository at this point in the history
* #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
  • Loading branch information
duker33 committed Sep 28, 2019
1 parent ea63381 commit 77991fd
Show file tree
Hide file tree
Showing 13 changed files with 99 additions and 46 deletions.
24 changes: 11 additions & 13 deletions front/less/pages/category.less
Expand Up @@ -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 {
Expand Down Expand Up @@ -260,7 +269,6 @@

.order {
bottom: 3px;
position: absolute;
right: 15px;
width: 200px;
}
Expand Down Expand Up @@ -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;
}

// ================================================================
Expand Down
3 changes: 2 additions & 1 deletion front/less/pages/contacts.less
Expand Up @@ -9,7 +9,6 @@
& .text {
background-color: white;
padding: 55px 0 0 40px;
width: 45%;

.Q(@xs; {
margin: 0 auto;
Expand All @@ -20,6 +19,8 @@
.Q(@md; {
display: inline-block;
vertical-align: top;
width: 45%;
padding-left: 0px;
});

& ul.items {
Expand Down
18 changes: 17 additions & 1 deletion 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;

Expand Down Expand Up @@ -365,7 +382,6 @@
&-description {
.sub-plate;
font-size: @f-size-base - 2;
height: 150px;
padding: 5px 12px;
}

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Expand Up @@ -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
32 changes: 32 additions & 0 deletions shopelectro/tests/tests_views.py
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion templates/catalog/category.html
Expand Up @@ -9,7 +9,7 @@ <h1 class="category-title" data-name="{{ category.name }}">{{ page.display.h1|ca

<div class="row overflow-anchor-control">
<div class="col-md-3 category-left-block">
{% 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 %}

Expand Down
4 changes: 2 additions & 2 deletions templates/catalog/category_children.html
@@ -1,6 +1,6 @@
{% if not category.is_leaf_node %}
{% if children %}
<ul class="subcategory-list list-unstyled">
{% for child in category.get_children_sorted_by_position %}
{% for child in children %}
<li class="subcategory-list-item">
<a class="subcategory-list-link" href="{{ child.url }}">
{{ child.name }}
Expand Down
3 changes: 2 additions & 1 deletion templates/catalog/product.html
Expand Up @@ -14,7 +14,8 @@
{% endif %}
{% endwith %}
</p>
<div itemprop="offers" itemscope itemtype="https://schema.org/Offer" class="hide">
<div class="hidden" itemprop="offers" itemscope itemtype="https://schema.org/Offer">
<a href="{{ product.url }}" itemprop="url"></a>
<span itemprop="price">{{ product.price|humanize_price }}</span>
<span itemprop="priceCurrency">RUB</span>
<link itemprop="availability"
Expand Down
1 change: 1 addition & 0 deletions templates/catalog/product_feedback.html
Expand Up @@ -70,6 +70,7 @@ <h4>У этого товара пока нет отзывов.</h4>
data-id="{{ feedback.id }}" title="Удалить отзыв"></i>
{% endif %}
<div class="rating-review" itemprop="review" itemscope="" itemtype="https://schema.org/Review">
<meta itemprop="itemReviewed" content="1">
<meta itemprop="author" content="{{ feedback.name }}">
<meta itemprop="datePublished" content="2016-10-24T17:36:04Z">
<div class="rating-review-rating" itemprop="reviewRating" itemscope="" itemtype="https://schema.org/Rating">
Expand Down
2 changes: 1 addition & 1 deletion templates/index/product_thumbnail.html
Expand Up @@ -12,5 +12,5 @@
{% placeholder_image_url as image_url %}
<img src="{{ image_url }}"
class="img-centered img-responsive"
alt="{% get_img_alt product.page %}" itemprop="image">
alt="{% get_img_alt product.page %}">
{% endif %}
5 changes: 1 addition & 4 deletions templates/index/tile_about.html
Expand Up @@ -40,10 +40,7 @@
<path d="M52.748 2.06801C52.748 0.92576 51.8222 0 50.68 0H36.8932C35.751 0 34.8252 0.92576 34.8252 2.06801V4.13603H52.748V2.06801Z" fill="#2B6988"/>
</svg>
</div>
<div class="text">
Делаем блоки питания под заказ — паяем аккумуляторы любого типоразмера, емкости
и конфигурации
</div>
<div class="text">Паяем аккумуляторные сборки</div>
</div>
</div>
<div class="col-xs-12 col-md-3 tile-item">
Expand Down
5 changes: 3 additions & 2 deletions templates/layout/header.html
Expand Up @@ -97,7 +97,7 @@
</div>

<div class="col-md-1">
<button type="submit" class="btn btn-blue btn-search fa fa-search" id="search-submit"></button>
<button type="submit" class="btn btn-blue btn-search" id="search-submit"><i class=" fa fa-search"></i></button>
</div>
</div>
</form>
Expand All @@ -110,7 +110,7 @@
</div>
</div>

{% comment %}Cache for a day{% endcomment %}
{# Cache for a day #}
{% cache 86400 categories_menu %}
<div class="nav-category-wrapper hidden-xs hidden-sm">
<ul class="nav-category list-unstyled">
Expand Down Expand Up @@ -154,6 +154,7 @@
</a>
{% if root.get_children %}
<ul class="mobile-catalog-sub-list list-unstyled" style="display: none">
{# @todo #971:60m Sort top menu subcategories by name #}
{% for child in root.get_children %}
<li>
<a class="mobile-catalog-sub-link" href="{{ child.url }}">
Expand Down
44 changes: 25 additions & 19 deletions templates/layout/tile_products.html
Expand Up @@ -5,37 +5,43 @@
{% load thumbnail %}

{% if tile_products %}
<div itemscope itemtype="https://schema.org/Product" class="stuff-top">
<div class="stuff-top">
<p class="stuff-top-title">{{ tile_title }}</p>
{% for product in tile_products %}
<p class="hidden" itemprop="description">
{% with description=product.page.display.description %}
{% if description %}
{{ description }}
{% else %}
{{ product.name }}
{% endif %}
{% endwith %}
</p>
<div class="stuff-top-item">
<a href="{{ product.url }}" class="stuff-top-img js-browse-product" itemprop="url">
<div class="stuff-top-item index-page product-card">
<a href="{{ product.url }}" class="stuff-top-img js-browse-product">
{% with image=product_images|get_item:product.id %}
{% include 'index/product_thumbnail.html' with image=image dimensions='x174' only %}
{% endwith %}
</a>

<div class="stuff-top-description">
{% comment %}
@todo #971:60m Remove product tile cards code doubling.
Both in html templates and styles.
{% endcomment %}
<div class="stuff-top-description product-card-text">
<div class="stuff-top-wrap">
<a class="stuff-top-name js-browse-product"
href="{{ product.url }}" itemprop="name">
href="{{ product.url }}">
{{ product.name }}
</a>
</div>
<div itemprop="offers" itemscope itemtype="https://schema.org/Offer" class="stuff-top-price-new">
<link itemprop="availability" href="https://schema.org/InStock">
<meta itemprop="description" content="{{ product.page.display.description }}">
<meta itemprop="priceCurrency" content="RUB" />
<span itemprop="price">{{ product.price|humanize_price }}</span> руб
<div class="stuff-top-price-new">
<span>{{ product.price|humanize_price }}</span> руб
</div>
<div class="js-order order row">
{% comment %}
The input below should have type "number" by it's semantic.
But Firefox worked bad with our custom increase/decrease buttons.
On of the comments at #952 contains illustrating screen.
{% endcomment %}
<input class="col-xs-4 input-number category-prods-count js-product-count js-touchspin"
type="text" value="1">
<button class="btn btn-blue btn-category-buy js-product-to-cart"
data-product-id="{{ product.id }}" data-product-price="{{ product.price }}"
data-product-name="{{ product.name }}">
В корзину
</button>
</div>
</div>
</div>
Expand Down

2 comments on commit 77991fd

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 77991fd Sep 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 971-f15c5594 discovered in templates/layout/header.html and submitted as #974. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 77991fd Sep 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 971-a1bdb68c discovered in templates/layout/tile_products.html and submitted as #975. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.