summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/profile.js.coffee
blob: 0e99921f899fdedf560249e8f709dc0e936d6427 (plain)
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
$ ->
  $('.edit_user .application-theme input, .edit_user .code-preview-theme input').click ->
    # Submit the form
    $('.edit_user').submit()

    new Flash("Appearance settings saved", "notice")

  $('.update-username form').on 'ajax:before', ->
    $('.loading-gif').show()
    $(this).find('.update-success').hide()
    $(this).find('.update-failed').hide()

  $('.update-username form').on 'ajax:complete', ->
    $(this).find('.btn-save').enableButton()
    $(this).find('.loading-gif').hide()

  $('.update-notifications').on 'ajax:complete', ->
    $(this).find('.btn-save').enableButton()


  $('.js-choose-user-avatar-button').bind "click", ->
    form = $(this).closest("form")
    form.find(".js-user-avatar-input").click()

  $('.js-user-avatar-input').bind "change", ->
    form = $(this).closest("form")
    filename = $(this).val().replace(/^.*[\\\/]/, '')
    form.find(".js-avatar-filename").text(filename)

  $('.profile-groups-avatars').tooltip("placement": "top")