Merge pull request #7097 from blockscout/vb-force-display-token-instance-page
Force display token instance pagepull/7119/head
commit
d3758c0d7d
@ -0,0 +1,21 @@ |
||||
defmodule BlockScoutWeb.Tokens.Instance.Helper do |
||||
@moduledoc """ |
||||
Token instance controllers common helper |
||||
""" |
||||
|
||||
use BlockScoutWeb, :controller |
||||
|
||||
alias BlockScoutWeb.Controller |
||||
alias Explorer.Chain |
||||
|
||||
def render(conn, token_instance, hash, token_id, token) do |
||||
render( |
||||
conn, |
||||
"index.html", |
||||
token_instance: %{instance: token_instance, token_id: Decimal.new(token_id)}, |
||||
current_path: Controller.current_full_path(conn), |
||||
token: token, |
||||
total_token_transfers: Chain.count_token_transfers_from_token_hash_and_token_id(hash, token_id) |
||||
) |
||||
end |
||||
end |
@ -1,28 +1,28 @@ |
||||
defmodule BlockScoutWeb.NFTHelpersTest do |
||||
use BlockScoutWeb.ConnCase, async: true |
||||
|
||||
alias BlockScoutWeb.{NFTHelpers} |
||||
alias BlockScoutWeb.NFTHelpers |
||||
|
||||
describe "compose_ipfs_url/1" do |
||||
test "transforms ipfs link like ipfs://${id}" do |
||||
url = "ipfs://QmYFf7D2UtqnNz8Lu57Gnk3dxgdAiuboPWMEaNNjhr29tS/hidden.png" |
||||
|
||||
assert "https://ipfs.io/ipfs/QmYFf7D2UtqnNz8Lu57Gnk3dxgdAiuboPWMEaNNjhr29tS/hidden.png" == |
||||
BlockScoutWeb.NFTHelpers.compose_ipfs_url(url) |
||||
NFTHelpers.compose_ipfs_url(url) |
||||
end |
||||
|
||||
test "transforms ipfs link like ipfs://ipfs" do |
||||
url = "ipfs://ipfs/Qmbgk4Ps5kiVdeYCHufMFgqzWLFuovFRtenY5P8m9vr9XW/animation.mp4" |
||||
|
||||
assert "https://ipfs.io/ipfs/Qmbgk4Ps5kiVdeYCHufMFgqzWLFuovFRtenY5P8m9vr9XW/animation.mp4" == |
||||
BlockScoutWeb.NFTHelpers.compose_ipfs_url(url) |
||||
NFTHelpers.compose_ipfs_url(url) |
||||
end |
||||
|
||||
test "transforms ipfs link in different case" do |
||||
url = "IpFs://baFybeid4ed2ua7fwupv4nx2ziczr3edhygl7ws3yx6y2juon7xakgj6cfm/51.json" |
||||
|
||||
assert "https://ipfs.io/ipfs/baFybeid4ed2ua7fwupv4nx2ziczr3edhygl7ws3yx6y2juon7xakgj6cfm/51.json" == |
||||
BlockScoutWeb.NFTHelpers.compose_ipfs_url(url) |
||||
NFTHelpers.compose_ipfs_url(url) |
||||
end |
||||
end |
||||
end |
||||
|
Loading…
Reference in new issue