Run all inline JS on window.ready

This commit is contained in:
Artur Beljajev 2018-01-26 01:53:16 +02:00
parent d2ea3fc944
commit 627069e776
7 changed files with 15 additions and 8 deletions

View file

@ -22,6 +22,7 @@
= text_field_tag "domain[contacts_attributes][#{k}][code_helper]", contacts.find_by(code: v['code']).try(:search_name), class: 'form-control', data: {autocomplete: search_contacts_registrar_domains_path}, required: true = text_field_tag "domain[contacts_attributes][#{k}][code_helper]", contacts.find_by(code: v['code']).try(:search_name), class: 'form-control', data: {autocomplete: search_contacts_registrar_domains_path}, required: true
:coffee :coffee
window.ready = ->
clone = $('.js-contact:first').clone() clone = $('.js-contact:first').clone()
$("#js-domain-contacts").nestedAttributes $("#js-domain-contacts").nestedAttributes
bindAddTo: $(".add-domain-contact") bindAddTo: $(".add-domain-contact")

View file

@ -68,6 +68,7 @@
class: 'form-control' class: 'form-control'
:coffee :coffee
window.ready = ->
$("#dnskeys").nestedAttributes $("#dnskeys").nestedAttributes
bindAddTo: $(".add-dnskey") bindAddTo: $(".add-dnskey")
afterAdd: (item) -> afterAdd: (item) ->

View file

@ -27,5 +27,6 @@
= text_field_tag "domain[nameservers_attributes][#{k}][ipv6]", v['ipv6'], = text_field_tag "domain[nameservers_attributes][#{k}][ipv6]", v['ipv6'],
class: 'form-control'#, ipv6: true class: 'form-control'#, ipv6: true
:coffee :coffee
window.ready = ->
$("#nameservers").nestedAttributes $("#nameservers").nestedAttributes
bindAddTo: $(".add-nameserver") bindAddTo: $(".add-nameserver")

View file

@ -6,5 +6,5 @@
:coffeescript :coffeescript
$(document).ready -> window.ready = ->
$('.payment-form form').submit() $('.payment-form form').submit()

View file

@ -82,8 +82,9 @@
%p.bg-info{style: 'padding: 15px;'}= t(:you_have_no_new_messages) %p.bg-info{style: 'padding: 15px;'}= t(:you_have_no_new_messages)
:coffee :coffee
$(".js-keyrelay-confirm").on "click", -> window.ready = ->
$(".js-keyrelay-form").submit() $(".js-keyrelay-confirm").on "click", ->
$(".js-keyrelay-form").submit()
$(".js-transfer-confirm").on "click", -> $(".js-transfer-confirm").on "click", ->
$(".js-transfer-form").submit() $(".js-transfer-form").submit()

View file

@ -13,7 +13,8 @@
00007, 60000007, 00000766 00007, 60000007, 00000766
:coffee :coffee
$('.js-login').attr('disabled', false) window.ready = ->
$('.js-login').attr('disabled', false)
status_interval = null status_interval = null
mid_status = () -> mid_status = () ->

View file

@ -61,8 +61,10 @@
= CodeRay.scan(@result.to_s.force_encoding("UTF-8"), :xml).div().html_safe = CodeRay.scan(@result.to_s.force_encoding("UTF-8"), :xml).div().html_safe
:javascript :javascript
window.addEventListener('load',
function(){
$('.js-load-xml').click(function() { $('.js-load-xml').click(function() {
$.get('xml_console/load_xml', {obj: $(this).data('obj'), epp_action: $(this).data('epp-action')}, function(data) { $.get('xml_console/load_xml', {obj: $(this).data('obj'), epp_action: $(this).data('epp-action')}, function(data) {
$('textarea[name="payload"]').html(data); $('textarea[name="payload"]').html(data);
}); });
}); });});