Sha256: 9d3f51d45608ff28740336540dcf4e002e9f612e0f5f965b14ef90f01fe83939

Contents?: true

Size: 675 Bytes

Versions: 5

Compression:

Stored size: 675 Bytes

Contents

module DiscoApp::ApplicationHelper

  # Generates 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()`.
  def link_to_shopify_admin(shop, name, admin_path, options = {})
    options[:onclick] = "ShopifyApp.redirect('#{admin_path}'); return false;"
    options[:'data-no-turbolink'] = true
    link_to(name, "https://#{shop.shopify_domain}/admin/#{admin_path}", options)
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
disco_app-0.6.3 app/helpers/disco_app/application_helper.rb
disco_app-0.6.4 app/helpers/disco_app/application_helper.rb
disco_app-0.6.5 app/helpers/disco_app/application_helper.rb
disco_app-0.6.6 app/helpers/disco_app/application_helper.rb
disco_app-0.6.7 app/helpers/disco_app/application_helper.rb