debian-mirror-gitlab/app/assets/javascripts/profile.js.coffee

30 lines
996 B
CoffeeScript
Raw Normal View History

2015-04-26 12:48:37 +05:30
class @Profile
constructor: ->
$('.edit_user .application-theme input, .edit_user .code-preview-theme input').click ->
# Submit the form
$('.edit_user').submit()
2014-09-02 18:07:02 +05:30
2015-04-26 12:48:37 +05:30
new Flash("Appearance settings saved", "notice")
2014-09-02 18:07:02 +05:30
2015-04-26 12:48:37 +05:30
$('.update-username form').on 'ajax:before', ->
$('.loading-gif').show()
$(this).find('.update-success').hide()
$(this).find('.update-failed').hide()
2014-09-02 18:07:02 +05:30
2015-04-26 12:48:37 +05:30
$('.update-username form').on 'ajax:complete', ->
$(this).find('.btn-save').enableButton()
$(this).find('.loading-gif').hide()
2014-09-02 18:07:02 +05:30
2015-04-26 12:48:37 +05:30
$('.update-notifications').on 'ajax:complete', ->
$(this).find('.btn-save').enableButton()
2014-09-02 18:07:02 +05:30
2015-04-26 12:48:37 +05:30
$('.js-choose-user-avatar-button').bind "click", ->
form = $(this).closest("form")
form.find(".js-user-avatar-input").click()
2014-09-02 18:07:02 +05:30
2015-04-26 12:48:37 +05:30
$('.js-user-avatar-input').bind "change", ->
form = $(this).closest("form")
filename = $(this).val().replace(/^.*[\\\/]/, '')
form.find(".js-avatar-filename").text(filename)