Skip to content

Instantly share code, notes, and snippets.

@Ninigi
Last active October 8, 2018 03:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ninigi/1ad421e927243fe61e927e5d62ae3a38 to your computer and use it in GitHub Desktop.
Save Ninigi/1ad421e927243fe61e927e5d62ae3a38 to your computer and use it in GitHub Desktop.
defmodule UselessWeb.ShopController do
# ...
def new(conn, %{"hmac" => _, "shop" => shopify_domain}) do
shop = ShopifyApp.find_shop_by(%{shopify_domain: shopify_domain})
conn
|> put_layout({UselessWeb.EmbeddedAppView, "layout.html"})
|> render("show.html", shop: shop)
end
def new(conn, %{"shop" => shop_name}) when is_bitstring(shop_name),
do: signup(conn, %{"shop" => %{"shopify_domain" => shop_name}})
def new(conn, _params) do
changeset = ShopifyApp.change_shop(%Shop{})
render(conn, "new.html", changeset: changeset)
end
# ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment