fixed merge conflict and fixed number formatting

pull/594/head
mulili 6 years ago
parent 027c59a7f7
commit faae82efb5
  1. 21
      apps/block_scout_web/assets/js/lib/smart_contract/wei_ether_converter.js
  2. 4
      apps/block_scout_web/lib/block_scout_web/templates/smart_contract/_functions.html.eex
  3. 11
      apps/block_scout_web/priv/gettext/default.pot
  4. 10
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po

@ -10,17 +10,16 @@ const weiToEtherConverter = (element, event) => {
const $conversionUnit = $element.find('[data-conversion-unit]')
let unitVal = new BigNumber(numeral($conversionUnit.html()).value())
if (event.target.checked) {
$conversionTextWei.removeClass('d-inline-block').hide()
$conversionTextEth.removeClass('d-none').show()
unitVal = unitVal.dividedBy(weiUnit)
$conversionUnit.html(unitVal.toFixed() > 0 ? unitVal.toFixed() : numeral(unitVal).format('0[.000000000000000000]'))
} else {
$conversionTextWei.addClass('d-inline-block')
$conversionTextEth.addClass('d-none')
unitVal = unitVal.multipliedBy(weiUnit)
$conversionUnit.html(unitVal.toFixed())
}
if (event.target.checked) {
$conversionTextWei.removeClass('d-inline-block').hide()
$conversionTextEth.removeClass('d-none').show()
unitVal = unitVal.dividedBy(weiUnit)
$conversionUnit.html(unitVal.toFixed() > 0 ? unitVal.toFixed() : numeral(unitVal).format('0[.000000000000000000]'))
} else {
$conversionTextWei.addClass('d-inline-block')
$conversionTextEth.addClass('d-none')
unitVal = unitVal.multipliedBy(weiUnit)
$conversionUnit.html(unitVal.toFixed())
}
}

@ -48,8 +48,8 @@
</span>
<span class="py-2 px-2">
<input class="wei-ether" type="checkbox" autocomplete="off">
<span class="d-inline-block" data-conversion-text-wei><%= gettext("WEI")%></span>
<span class="d-none" data-conversion-text-eth><%= gettext("ETH")%></span>
<span class="d-inline-block" data-conversion-text-wei><%= gettext "WEI" %></span>
<span class="d-none" data-conversion-text-eth><%= gettext "ETH" %></span>
</div>
<% else %>
<%= output["value"] %>

@ -1272,3 +1272,14 @@ msgstr ""
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:128
msgid "There are no token transfers for this address."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:51
msgid "WEI"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:52
msgid "ETH"
msgstr ""

@ -1284,3 +1284,13 @@ msgstr ""
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:128
msgid "There are no token transfers for this address."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:51
msgid "WEI"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/smart_contract/_functions.html.eex:52
msgid "ETH"
msgstr ""

Loading…
Cancel
Save