Sha256: ba5b1c9cc0013af3c79c662e119791a72b6c12f2ef11d4b1edc49cfb1f1d4e5d

Contents?: true

Size: 931 Bytes

Versions: 7

Compression:

Stored size: 931 Bytes

Contents

/**
 * ShopifyAdminLink
 *
 * Renders a link pointing to an object (such as an order or customer) inside
 * the given shop's Shopify admin. This helper makes it easy to  create links
 * to objects within the admin that support both right-clicking and opening in
 * a new tab as well as capturing a left click and redirecting to the relevant
 * object using `ShopifyApp.redirect()`.
 *
 * This component is the React equivalent to the link_to_shopify_admin helper
 * found in app/helpers/disco_app/application_helper.rb.
 */
var ShopifyAdminLink = React.createClass({

    handleClick: function(e) {
        e.preventDefault();
        ShopifyApp.redirect(this.props.href);
    },

    render: function() {
        var href = '/admin' + this.props.href;
        return (
            <a className={this.props.className} href={href} onClick={this.handleClick}>
                {this.props.label}
            </a>
        )
    }

});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
disco_app-0.6.3 app/assets/javascripts/disco_app/components/shopify_admin_link.js.jsx
disco_app-0.6.4 app/assets/javascripts/disco_app/components/shopify_admin_link.js.jsx
disco_app-0.6.5 app/assets/javascripts/disco_app/components/shopify_admin_link.js.jsx
disco_app-0.6.6 app/assets/javascripts/disco_app/components/shopify_admin_link.js.jsx
disco_app-0.6.7 app/assets/javascripts/disco_app/components/shopify_admin_link.js.jsx
disco_app-0.6.8 app/assets/javascripts/disco_app/components/shopify_admin_link.js.jsx
disco_app-0.6.9 app/assets/javascripts/disco_app/components/shopify_admin_link.js.jsx