Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hard refresh on clicking tag link on product detail page #2489

Merged
merged 4 commits into from
Jun 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions imports/plugins/core/ui/client/components/tags/tag.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import classnames from "classnames";
import Autosuggest from "react-autosuggest";
import Velocity from "velocity-animate";
import "velocity-animate/velocity.ui";
import { Router } from "/client/api";
import { i18next } from "/client/api";
import { Button, Handle } from "/imports/plugins/core/ui/client/components";
import { SortableItem } from "../../containers";
Expand Down Expand Up @@ -170,12 +169,6 @@ class Tag extends Component {
* @return {JSX} simple tag
*/
renderTag() {
const url = Router.pathFor("tag", {
hash: {
slug: this.props.tag.slug
}
});

const baseClassName = classnames({
"rui": true,
"tag": true,
Expand All @@ -186,7 +179,7 @@ class Tag extends Component {
return (
<a
className={baseClassName}
href={url}
href="#"
onMouseOut={this.handleTagMouseOut}
onMouseOver={this.handleTagMouseOver}
onClick={this.handleClick}
Expand Down
7 changes: 7 additions & 0 deletions imports/plugins/core/ui/client/components/tags/tags.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component } from "react";
import PropTypes from "prop-types";
import { PropTypes as ReactionPropTypes } from "/lib/api";
import { TagItem } from "./";
import { Router } from "/client/api";
import classnames from "classnames";

class Tags extends Component {
Expand Down Expand Up @@ -63,6 +64,10 @@ class Tags extends Component {
}
};

handleTagClick = (event, tag) => {
Router.go("tag", { slug: tag.slug });
}

hasDropdownClassName = (tag) => {
if (this.props.hasDropdownClassName) {
return this.props.hasDropdownClassName(tag);
Expand Down Expand Up @@ -103,6 +108,7 @@ class Tags extends Component {
onTagRemove={this.handleTagRemove}
onTagSave={this.handleTagSave}
onTagUpdate={this.handleTagUpdate}
onTagClick={this.handleTagClick}
/>
{this.props.children}
</div>
Expand Down Expand Up @@ -181,6 +187,7 @@ Tags.propTypes = {
onMoveTag: PropTypes.func,
onNewTagSave: PropTypes.func,
onNewTagUpdate: PropTypes.func,
onTagClick: PropTypes.func,
onTagMouseOut: PropTypes.func,
onTagMouseOver: PropTypes.func,
onTagRemove: PropTypes.func,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ <h4 class="panel-title" data-i18n="productDetailEdit.size">Size</h4>
<template name="productSettingsListItem">
<div class="list-group-item product-settings-list-item {{listItemActiveClassName _id}}" data-id="{{_id}}" id="{{_id}}">
<a
href="{{pdpPath}}"
href="#"
data-event-category="grid"
data-event-action="product-click"
data-event-label="grid product click"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,15 @@ Template.productSettings.helpers({
}
});

Template.productSettingsListItem.helpers({
pdpPath() {
const product = this;

if (product) {
let handle = product.handle;

if (product.__published) {
handle = product.__published.handle;
}

return Reaction.Router.pathFor("product", {
hash: {
handle
}
});
}

return "/";
},
Template.productSettingsListItem.events({
"click [data-event-action=product-click]": function () {
Reaction.Router.go("product", {
handle: this.handle
});
}
});

Template.productSettingsListItem.helpers({
displayPrice() {
if (this._id) {
return ReactionProduct.getProductPriceRange(this._id).range;
Expand Down