Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix category breadcrumbs
Krzysztof Białogłowicza1664e4d3935
diff --git a/saleor/static/js/components/CategoryFilter.js b/saleor/static/js/components/CategoryFilter.jsindex 71f5f19fe4..0070df30f3 100644--- a/saleor/static/js/components/CategoryFilter.js+++ b/saleor/static/js/components/CategoryFilter.js@@ -9,7 +9,6 @@ export default class CategoryFilter extends Component {render() {const { category } = this.props;- console.log(category.ancestors);return (<div className="categories">diff --git a/saleor/static/js/components/CategoryPage.js b/saleor/static/js/components/CategoryPage.jsindex 56af5dbadf..fc290ddabf 100644--- a/saleor/static/js/components/CategoryPage.js+++ b/saleor/static/js/components/CategoryPage.js@@ -6,6 +6,7 @@ import CategoryFilter from './CategoryFilter';import PriceFilter from './PriceFilter';import ProductFilters from './ProductFilters';import ProductList from './ProductList';+import SortBy from './SortBy';const PAGINATE_BY = 20;@@ -126,35 +127,53 @@ class CategoryPage extends Component {render() {const { attributes, category, relay: { variables } } = this.props;return (- <div className="row">- <div className="col-md-3">- <div className="product-filters">- <CategoryFilter- category={category}- />- </div>- <h2>Filters:</h2>- <div className="product-filters">- <ProductFilters- attributes={attributes}- checkedAttributes={variables.attributesFilter}- onFilterChanged={this.updateAttributesFilter}- />- <PriceFilter- onFilterChanged={this.updatePriceFilter}- maxPrice={variables.maxPrice}- minPrice={variables.minPrice}- />+ <div className="category-page">+ <div className="category-top">+ <div className="row">+ <div className="col-md-8">+ <ul className="category-breadcrumbs">+ <li><a href="/">Home</a></li>+ {category.ancestors && (category.ancestors.map((ancestor) => {+ return (+ <li key={ancestor.pk}><a href={ancestor.url}>{ancestor.name}</a></li>+ );+ }))}+ <li><a href={category.url}>{category.name}</a></li>+ </ul>+ </div>+ <div className="col-md-4">+ <SortBy sortedValue={variables.sortBy} setSorting={this.setSorting} />+ </div></div></div>- <div className="col-md-9">- <div className="row">- <ProductList- onLoadMore={this.incrementProductsCount}- products={category.products}- sortedValue={variables.sortBy}- setSorting={this.setSorting}- />+ <div className="row">+ <div className="col-md-3">+ <div className="product-filters">+ <CategoryFilter+ category={category}+ />+ </div>+ <h2>Filters:</h2>+ <div className="product-filters">+ <ProductFilters+ attributes={attributes}+ checkedAttributes={variables.attributesFilter}+ onFilterChanged={this.updateAttributesFilter}+ />+ <PriceFilter+ onFilterChanged={this.updatePriceFilter}+ maxPrice={variables.maxPrice}+ minPrice={variables.minPrice}+ />+ </div>+ </div>+ <div className="col-md-9">+ <div className="row">+ <ProductList+ onLoadMore={this.incrementProductsCount}+ products={category.products}+ />+ </div></div></div></div>@@ -182,6 +201,11 @@ export default Relay.createContainer(CategoryPage, {name,url}+ ancestors {+ name+ pk+ url+ }children {namepkdiff --git a/saleor/static/js/components/ProductList.js b/saleor/static/js/components/ProductList.jsindex 607e20c906..c95b0d5a86 100644--- a/saleor/static/js/components/ProductList.js+++ b/saleor/static/js/components/ProductList.js@@ -2,15 +2,12 @@ import React, { Component, PropTypes } from 'react';import Relay from 'react-relay';import ProductItem from './ProductItem';-import SortBy from './SortBy';class ProductList extends Component {static propTypes = {onLoadMore: PropTypes.func.isRequired,products: PropTypes.object,- sortedValue: PropTypes.string,- setSorting: PropTypes.func};onLoadMore = () => this.props.onLoadMore();@@ -20,7 +17,6 @@ class ProductList extends Component {const { edges, pageInfo: { hasNextPage } } = this.props.products;return (<div>- <SortBy sortedValue={this.props.sortedValue} setSorting={this.setSorting} /><div>{edges && (edges.map((edge, i) => (<ProductItem key={i} product={edge.node} />diff --git a/saleor/static/scss/demo/components/_category-page.scss b/saleor/static/scss/demo/components/_category-page.scssindex 9f4a6ed8c4..2ba7bb98ad 100644--- a/saleor/static/scss/demo/components/_category-page.scss+++ b/saleor/static/scss/demo/components/_category-page.scss@@ -5,6 +5,88 @@font-weight: bold;padding-bottom: $global-padding/2;}+ .category-top {+ border-bottom: solid 1px $gray;+ padding-bottom: $global-padding;+ .category-breadcrumbs {+ list-style: none;+ padding-left: 0;+ margin-bottom: 0;+ li {+ display: inline-block;+ a {+ color: $body-color;+ }+ &:after {+ content: "/";+ padding: 0 $global-padding/2;+ }+ &:last-child:after {+ content: "";+ }+ }+ }+ .sort-by {+ text-align: right;+ position: relative;+ button {+ color: $body-color;+ padding-right: $global-padding;+ outline: 0;+ i {+ padding-left: $global-padding/2;+ }+ }+ ul {+ width: 20rem;+ list-style: none;+ background: $light-gray;+ box-shadow: 3px 3px 3px 0px rgba($gray, 0.75);+ position: absolute;+ top: 2.5rem;+ right: 0;+ z-index: 999;+ padding: $global-padding $global-padding*2;+ li {+ text-align: left;+ padding-top: $global-padding/2;+ overflow: hidden;+ border-bottom: solid 1px $gray;+ padding-bottom: $global-padding;+ span {+ &:hover {+ cursor: pointer;+ text-decoration: underline;+ }+ }+ i {+ padding-top: $global-padding/3;+ }+ &:last-child {+ border: none;+ padding-bottom: 0;+ }+ &:after {+ content: "";+ }+ }+ &:before {+ content: '';+ display: block;+ width: 15px;+ height: 10px;+ position: absolute;+ top: -10px;+ right: 15px;+ background-color: $light-gray;+ clip-path: polygon(50% 0%, 0% 100%, 100% 100%);+ }+ }+ }+ }+++.product-filters {.hide {display: none;@@ -99,61 +181,6 @@}}- .sort-by {- text-align: right;- position: relative;- button {- color: $body-color;- padding-right: $global-padding;- outline: 0;- i {- padding-left: $global-padding/2;- }- }- ul {- list-style: none;- background: $light-gray;- box-shadow: 3px 3px 3px 0px rgba($gray, 0.75);- position: absolute;- top: 2.5rem;- right: 0;- z-index: 999;- padding: $global-padding $global-padding*2;- li {- width: 16rem;- text-align: left;- padding-top: $global-padding/2;- overflow: hidden;- border-bottom: solid 1px $gray;- padding-bottom: $global-padding;- span {- &:hover {- cursor: pointer;- text-decoration: underline;- }- }- i {- padding-top: $global-padding/3;- }- &:last-child {- border: none;- padding-bottom: 0;- }- }- &:before {- content: '';- display: block;- width: 15px;- height: 10px;- position: absolute;- top: -10px;- right: 15px;- background-color: $light-gray;- clip-path: polygon(50% 0%, 0% 100%, 100% 100%);- }- }- }-.load-more {clear: both;button {