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

27 lines
982 B
CoffeeScript
Raw Normal View History

2015-04-26 12:48:37 +05:30
class @Profile
constructor: ->
2015-09-11 14:41:01 +05:30
# Automatically submit the Preferences form when any of its radio buttons change
$('.js-preferences-form').on 'change.preference', 'input[type=radio]', ->
$(this).parents('form').submit()
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', ->
2015-09-11 14:41:01 +05:30
$(this).find('.btn-save').enable()
2015-04-26 12:48:37 +05:30
$(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', ->
2015-09-11 14:41:01 +05:30
$(this).find('.btn-save').enable()
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)