Refactor block list partial on homepage

Co-authored-by: Stamates <stamates@hotmail.com>
pull/462/head
jimmay5469 6 years ago committed by Stamates
parent b9a8471558
commit e3f6737e3a
  1. 18
      apps/explorer_web/lib/explorer_web/templates/chain/_block.html.eex
  2. 32
      apps/explorer_web/lib/explorer_web/templates/chain/_blocks.html.eex
  3. 12
      apps/explorer_web/lib/explorer_web/templates/chain/show.html.eex

@ -0,0 +1,18 @@
<div class="col-sm-3">
<div class="tile d-flex flex-column" data-test="chain_block">
<%= link(@block, to: block_path(ExplorerWeb.Endpoint, :show, @locale, @block), class: "tile-title") %>
<div>
<%= @block.transactions |> Enum.count %> Transactions
<span class="ml-2" data-from-now="<%= @block.timestamp %>"> </span>
</div>
<span class="text-truncate">
Validated by
<%= link to: address_path(ExplorerWeb.Endpoint, :show, @locale, @block.miner),
"data-toggle": "tooltip",
"data-placement": "top",
title: @block.miner do %>
<%= @block.miner %>
<% end %>
</span>
</div>
</div>

@ -1,32 +0,0 @@
<div class="card">
<div class="card-body">
<%= link(gettext("View All Blocks →"), to: block_path(@conn, :index, Gettext.get_locale), class: "button button--secondary button--xsmall float-right") %>
<h2 class="card-title"><%= gettext "Blocks" %></h2>
<div class="row">
<%= for block <- @chain.blocks do %>
<div class="col-sm-3">
<div class="tile d-flex flex-column" data-test="chain_block">
<%= link(block, to: block_path(@conn, :show, @conn.assigns.locale, block), class: "tile-title") %>
<div>
<%= block.transactions |> Enum.count %> Transactions
<span class="ml-2" data-from-now="<%= block.timestamp %>"> </span>
</div>
<span class="text-truncate">
Validated by
<%= link to: address_path(ExplorerWeb.Endpoint, :show, @locale, block.miner),
"data-toggle": "tooltip",
"data-placement": "top",
title: block.miner do %>
<%= block.miner %>
<% end %>
</span>
</div>
</div>
<% end %>
</div>
</div>
</div>

@ -52,6 +52,16 @@
</div> </div>
</div> </div>
<section class="container"> <section class="container">
<%= render ExplorerWeb.ChainView, "_blocks.html", assigns %> <div class="card">
<div class="card-body">
<%= link(gettext("View All Blocks →"), to: block_path(@conn, :index, Gettext.get_locale), class: "button button--secondary button--xsmall float-right") %>
<h2 class="card-title"><%= gettext "Blocks" %></h2>
<div class="row">
<%= for block <- @chain.blocks do %>
<%= render ExplorerWeb.ChainView, "_block.html", locale: @locale, block: block %>
<% end %>
</div>
</div>
</div>
<%= render ExplorerWeb.ChainView, "_transactions.html", assigns %> <%= render ExplorerWeb.ChainView, "_transactions.html", assigns %>
</section> </section>

Loading…
Cancel
Save