Run all inline JS on window.load

This commit is contained in:
Artur Beljajev 2018-01-26 11:04:48 +02:00
parent 2c73154948
commit 578d60cf44
7 changed files with 35 additions and 36 deletions

View file

@ -12,7 +12,8 @@
%div.text-center %div.text-center
00007, 60000007, 00000766 00007, 60000007, 00000766
:coffee :coffee
window.onload = ->
$('.js-login').attr('disabled', false) $('.js-login').attr('disabled', false)
status_interval = null status_interval = null
@ -37,4 +38,3 @@
flash_alert(data.responseJSON.message) flash_alert(data.responseJSON.message)
$('.js-login').attr('disabled', false) $('.js-login').attr('disabled', false)
) )

View file

@ -22,22 +22,22 @@
= 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 = -> window.onload = ->
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")
afterAdd: (item) -> afterAdd: (item) ->
# preselect type # preselect type
item.find('select.js-contact-type').each (k, v) -> item.find('select.js-contact-type').each (k, v) ->
$(v).val($(v).find('option:last-child').val()) $(v).val($(v).find('option:last-child').val())
# add combobex # add combobex
item.find('select.js-contact-code').each (k, v) -> item.find('select.js-contact-code').each (k, v) ->
$(v).select2 $(v).select2
width: "100%" width: "100%"
selectOnBlur: true selectOnBlur: true
dropdownAutoWidth: if self==top then true else false dropdownAutoWidth: if self==top then true else false
# remove link for temp # remove link for temp
item.find('a.add-domain-contact').each (k, v) -> item.find('a.add-domain-contact').each (k, v) ->
$(v).hide() $(v).hide()
new Autocomplete() new Autocomplete()
$clone: clone $clone: clone

View file

@ -68,11 +68,11 @@
class: 'form-control' class: 'form-control'
:coffee :coffee
window.ready = -> window.onload = ->
$("#dnskeys").nestedAttributes $("#dnskeys").nestedAttributes
bindAddTo: $(".add-dnskey") bindAddTo: $(".add-dnskey")
afterAdd: (item) -> afterAdd: (item) ->
item.find('select').each (k, v) -> item.find('select').each (k, v) ->
$(v).val($(v).find('option:first-child').val()) $(v).val($(v).find('option:first-child').val())

View file

@ -27,6 +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 = -> window.onload = ->
$("#nameservers").nestedAttributes $("#nameservers").nestedAttributes
bindAddTo: $(".add-nameserver") bindAddTo: $(".add-nameserver")

View file

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

View file

@ -82,7 +82,7 @@
%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
window.ready = -> window.onload = ->
$(".js-keyrelay-confirm").on "click", -> $(".js-keyrelay-confirm").on "click", ->
$(".js-keyrelay-form").submit() $(".js-keyrelay-form").submit()

View file

@ -12,9 +12,9 @@
%div.text-center %div.text-center
00007, 60000007, 00000766 00007, 60000007, 00000766
:coffee :coffee
window.ready = -> window.onload = ->
$('.js-login').attr('disabled', false) $('.js-login').attr('disabled', false)
status_interval = null status_interval = null
mid_status = () -> mid_status = () ->
@ -38,4 +38,3 @@
flash_alert(data.responseJSON.message) flash_alert(data.responseJSON.message)
$('.js-login').attr('disabled', false) $('.js-login').attr('disabled', false)
) )