From 0e2e5b8fb93dc77c2cc6652f5ae5f6dafbe87ec3 Mon Sep 17 00:00:00 2001 From: Senad Uka Date: Tue, 26 Jan 2016 05:01:18 +0100 Subject: [PATCH] put items into links - because of the SEO --- front-ui/app/components/items/singleItem.js | 14 ++++++++++++-- front-ui/app/stores/navigationStore.js | 7 ++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/front-ui/app/components/items/singleItem.js b/front-ui/app/components/items/singleItem.js index db6315e..7290b11 100644 --- a/front-ui/app/components/items/singleItem.js +++ b/front-ui/app/components/items/singleItem.js @@ -11,6 +11,8 @@ var SingleItem = React.createClass({ var hidePrice = this.props.hidePrice || false; var self = this; var itemClick = this.itemClick; + var stopPropagation = this.stopPropagation; + var itemUrl = NavigationStore.getUrlForItem(this.props.item); var firstImage = this.props.item.get('multi_media_descriptions')[0]; firstImage = firstImage || { resized_url: "https://res.cloudinary.com/lfvt7ps2n/image/upload/c_fit,h_172,w_226/v1421732950/http_www.asms.ru_bitrix_templates_main_images_nophoto_irnofq.png" } ; if (hidePrice) { @@ -29,7 +31,7 @@ var SingleItem = React.createClass({ } else { return ( - +
product image @@ -40,14 +42,22 @@ var SingleItem = React.createClass({
+
); } - }, + }, + stopPropagation: function(e){ + e.stopPropagation(); + e.nativeEvent.stopImmediatePropagation(); + return false; + }, itemClick: function(e) { NavigationActions.goToItemDetails(this.props.item); } + + }); diff --git a/front-ui/app/stores/navigationStore.js b/front-ui/app/stores/navigationStore.js index 09c4665..dc0fe8b 100644 --- a/front-ui/app/stores/navigationStore.js +++ b/front-ui/app/stores/navigationStore.js @@ -53,8 +53,13 @@ var NavigationStore = _.extend({}, EventEmitter.prototype, { } else { return false; } + }, + + getUrlForItem: function(item) { + return '/artikal/' + item.get('id') +'/' + Globals.Slugify(item.get('name')) } + }); @@ -84,4 +89,4 @@ NavigationStore.dispatchToken = AppDispatcher.register(function(payload) { }); -module.exports = NavigationStore; \ No newline at end of file +module.exports = NavigationStore;