From 575afa806d28ae052fb598ea9d8085266ca5c9e2 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Tue, 9 Jul 2019 14:02:43 +0300 Subject: [PATCH] fix external libary function --- .../smart_contract/new_smart_contract_form.js | 28 ---------- .../assets/js/pages/verification_form.js | 55 +++++++++++++++++++ 2 files changed, 55 insertions(+), 28 deletions(-) delete mode 100644 apps/block_scout_web/assets/js/lib/smart_contract/new_smart_contract_form.js diff --git a/apps/block_scout_web/assets/js/lib/smart_contract/new_smart_contract_form.js b/apps/block_scout_web/assets/js/lib/smart_contract/new_smart_contract_form.js deleted file mode 100644 index 43419aeb9b..0000000000 --- a/apps/block_scout_web/assets/js/lib/smart_contract/new_smart_contract_form.js +++ /dev/null @@ -1,28 +0,0 @@ -import $ from 'jquery' - -$(function () { - $('.js-btn-add-contract-libraries').on('click', function () { - $('.js-smart-contract-libraries-wrapper').show() - $(this).hide() - }) - - $('.js-smart-contract-form-reset').on('click', function () { - $('.js-contract-library-form-group').removeClass('active') - $('.js-contract-library-form-group').first().addClass('active') - $('.js-smart-contract-libraries-wrapper').hide() - $('.js-btn-add-contract-libraries').show() - $('.js-add-contract-library-wrapper').show() - }) - - $('.js-btn-add-contract-library').on('click', function () { - let nextContractLibrary = $('.js-contract-library-form-group.active').next('.js-contract-library-form-group') - - if (nextContractLibrary) { - nextContractLibrary.addClass('active') - } - - if ($('.js-contract-library-form-group.active').length === $('.js-contract-library-form-group').length) { - $('.js-add-contract-library-wrapper').hide() - } - }) -}) diff --git a/apps/block_scout_web/assets/js/pages/verification_form.js b/apps/block_scout_web/assets/js/pages/verification_form.js index 28a654d999..619a8e1326 100644 --- a/apps/block_scout_web/assets/js/pages/verification_form.js +++ b/apps/block_scout_web/assets/js/pages/verification_form.js @@ -51,6 +51,34 @@ const elements = { $('button[data-button-loading="animation"]').click(event => { $('#loading').removeClass('d-none') }) + + $(function () { + $('.js-btn-add-contract-libraries').on('click', function () { + $('.js-smart-contract-libraries-wrapper').show() + $(this).hide() + }) + + $('.js-smart-contract-form-reset').on('click', function () { + $('.js-contract-library-form-group').removeClass('active') + $('.js-contract-library-form-group').first().addClass('active') + $('.js-smart-contract-libraries-wrapper').hide() + $('.js-btn-add-contract-libraries').show() + $('.js-add-contract-library-wrapper').show() + }) + + $('.js-btn-add-contract-library').on('click', function () { + let nextContractLibrary = $('.js-contract-library-form-group.active').next('.js-contract-library-form-group') + + if (nextContractLibrary) { + nextContractLibrary.addClass('active') + } + + if ($('.js-contract-library-form-group.active').length === $('.js-contract-library-form-group').length) { + $('.js-add-contract-library-wrapper').hide() + } + }) + }) + return $el } return $el @@ -86,4 +114,31 @@ if ($contractVerificationPage.length) { $('button[data-button-loading="animation"]').click(event => { $('#loading').removeClass('d-none') }) + + $(function () { + $('.js-btn-add-contract-libraries').on('click', function () { + $('.js-smart-contract-libraries-wrapper').show() + $(this).hide() + }) + + $('.js-smart-contract-form-reset').on('click', function () { + $('.js-contract-library-form-group').removeClass('active') + $('.js-contract-library-form-group').first().addClass('active') + $('.js-smart-contract-libraries-wrapper').hide() + $('.js-btn-add-contract-libraries').show() + $('.js-add-contract-library-wrapper').show() + }) + + $('.js-btn-add-contract-library').on('click', function () { + let nextContractLibrary = $('.js-contract-library-form-group.active').next('.js-contract-library-form-group') + + if (nextContractLibrary) { + nextContractLibrary.addClass('active') + } + + if ($('.js-contract-library-form-group.active').length === $('.js-contract-library-form-group').length) { + $('.js-add-contract-library-wrapper').hide() + } + }) + }) }