Commit 01441f54 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #8120 from cirosantilli/profile-js-only-needed

Only run profile js on pages that need it
parents 367d4db4 93e8a056
...@@ -76,6 +76,8 @@ class Dispatcher ...@@ -76,6 +76,8 @@ class Dispatcher
# Ensure we don't create a particular shortcut handler here. This is # Ensure we don't create a particular shortcut handler here. This is
# already created, where the network graph is created. # already created, where the network graph is created.
shortcut_handler = true shortcut_handler = true
when 'users:show'
new User()
switch path.first() switch path.first()
when 'admin' when 'admin'
...@@ -85,6 +87,8 @@ class Dispatcher ...@@ -85,6 +87,8 @@ class Dispatcher
new NamespaceSelect() new NamespaceSelect()
when 'dashboard' when 'dashboard'
shortcut_handler = new ShortcutsDashboardNavigation() shortcut_handler = new ShortcutsDashboardNavigation()
when 'profiles'
new Profile()
when 'projects' when 'projects'
new Project() new Project()
switch path[1] switch path[1]
......
$ -> class @Profile
$('.edit_user .application-theme input, .edit_user .code-preview-theme input').click -> constructor: ->
# Submit the form $('.edit_user .application-theme input, .edit_user .code-preview-theme input').click ->
$('.edit_user').submit() # Submit the form
$('.edit_user').submit()
new Flash("Appearance settings saved", "notice") new Flash("Appearance settings saved", "notice")
$('.update-username form').on 'ajax:before', -> $('.update-username form').on 'ajax:before', ->
$('.loading-gif').show() $('.loading-gif').show()
$(this).find('.update-success').hide() $(this).find('.update-success').hide()
$(this).find('.update-failed').hide() $(this).find('.update-failed').hide()
$('.update-username form').on 'ajax:complete', -> $('.update-username form').on 'ajax:complete', ->
$(this).find('.btn-save').enableButton() $(this).find('.btn-save').enableButton()
$(this).find('.loading-gif').hide() $(this).find('.loading-gif').hide()
$('.update-notifications').on 'ajax:complete', -> $('.update-notifications').on 'ajax:complete', ->
$(this).find('.btn-save').enableButton() $(this).find('.btn-save').enableButton()
$('.js-choose-user-avatar-button').bind "click", -> $('.js-choose-user-avatar-button').bind "click", ->
form = $(this).closest("form") form = $(this).closest("form")
form.find(".js-user-avatar-input").click() form.find(".js-user-avatar-input").click()
$('.js-user-avatar-input').bind "change", -> $('.js-user-avatar-input').bind "change", ->
form = $(this).closest("form") form = $(this).closest("form")
filename = $(this).val().replace(/^.*[\\\/]/, '') filename = $(this).val().replace(/^.*[\\\/]/, '')
form.find(".js-avatar-filename").text(filename) form.find(".js-avatar-filename").text(filename)
$('.profile-groups-avatars').tooltip("placement": "top")
class @User
constructor: ->
$('.profile-groups-avatars').tooltip("placement": "top")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment