aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/app/assets/javascripts/rails-ujs.coffee
blob: bd6e9bb8819be95e6f518b5e524a38b92d964564 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#= require ./rails-ujs/BANNER
#= export Rails
#= require_self
#= require_tree ./rails-ujs/utils
#= require_tree ./rails-ujs/features
#= require ./rails-ujs/start

@Rails =
  # Link elements bound by rails-ujs
  linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]'

  # Button elements bound by rails-ujs
  buttonClickSelector:
    selector: 'button[data-remote]:not([form]), button[data-confirm]:not([form])'
    exclude: 'form button'

  # Select elements bound by rails-ujs
  inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]'

  # Form elements bound by rails-ujs
  formSubmitSelector: 'form'

  # Form input elements bound by rails-ujs
  formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])'

  # Form input elements disabled during form submission
  formDisableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled'

  # Form input elements re-enabled after form submission
  formEnableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled'

  # Form file input elements
  fileInputSelector: 'input[name][type=file]:not([disabled])'

  # Link onClick disable selector with possible reenable after remote submission
  linkDisableSelector: 'a[data-disable-with], a[data-disable]'

  # Button onClick disable selector with possible reenable after remote submission
  buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]'