2014-10-21 04:40:36 -04:00
|
|
|
class @Profile
|
|
|
|
constructor: ->
|
2015-06-05 18:01:45 -04:00
|
|
|
# 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()
|
2012-12-02 06:29:24 -05:00
|
|
|
|
2014-10-21 04:40:36 -04:00
|
|
|
$('.update-username form').on 'ajax:before', ->
|
|
|
|
$('.loading-gif').show()
|
|
|
|
$(this).find('.update-success').hide()
|
|
|
|
$(this).find('.update-failed').hide()
|
2012-12-02 06:29:24 -05:00
|
|
|
|
2014-10-21 04:40:36 -04:00
|
|
|
$('.update-username form').on 'ajax:complete', ->
|
2015-05-26 18:33:04 -04:00
|
|
|
$(this).find('.btn-save').enable()
|
2014-10-21 04:40:36 -04:00
|
|
|
$(this).find('.loading-gif').hide()
|
2013-08-27 05:18:53 -04:00
|
|
|
|
2014-10-21 04:40:36 -04:00
|
|
|
$('.update-notifications').on 'ajax:complete', ->
|
2015-05-26 18:33:04 -04:00
|
|
|
$(this).find('.btn-save').enable()
|
2013-10-06 14:13:56 -04:00
|
|
|
|
2014-10-21 04:40:36 -04:00
|
|
|
$('.js-choose-user-avatar-button').bind "click", ->
|
|
|
|
form = $(this).closest("form")
|
|
|
|
form.find(".js-user-avatar-input").click()
|
2013-10-06 14:13:56 -04:00
|
|
|
|
2014-10-21 04:40:36 -04:00
|
|
|
$('.js-user-avatar-input').bind "change", ->
|
|
|
|
form = $(this).closest("form")
|
|
|
|
filename = $(this).val().replace(/^.*[\\\/]/, '')
|
|
|
|
form.find(".js-avatar-filename").text(filename)
|