Only run avatar chooser Js on pages that need it
This commit is contained in:
parent
c3b81e5f40
commit
38670a663c
|
@ -67,6 +67,8 @@ class Dispatcher
|
|||
new TeamMembers()
|
||||
when 'groups:members'
|
||||
new GroupMembers()
|
||||
when 'groups:new', 'groups:edit', 'admin:groups:edit'
|
||||
new GroupAvatar()
|
||||
when 'projects:tree:show'
|
||||
new TreeView()
|
||||
shortcut_handler = new ShortcutsNavigation()
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
class @GroupAvatar
|
||||
constructor: ->
|
||||
$('.js-choose-group-avatar-button').bind "click", ->
|
||||
form = $(this).closest("form")
|
||||
form.find(".js-group-avatar-input").click()
|
||||
$('.js-group-avatar-input').bind "change", ->
|
||||
form = $(this).closest("form")
|
||||
filename = $(this).val().replace(/^.*[\\\/]/, '')
|
||||
form.find(".js-avatar-filename").text(filename)
|
|
@ -2,14 +2,3 @@ class @GroupMembers
|
|||
constructor: ->
|
||||
$('li.group_member').bind 'ajax:success', ->
|
||||
$(this).fadeOut()
|
||||
|
||||
$ ->
|
||||
# avatar
|
||||
$('.js-choose-group-avatar-button').bind "click", ->
|
||||
form = $(this).closest("form")
|
||||
form.find(".js-group-avatar-input").click()
|
||||
|
||||
$('.js-group-avatar-input').bind "change", ->
|
||||
form = $(this).closest("form")
|
||||
filename = $(this).val().replace(/^.*[\\\/]/, '')
|
||||
form.find(".js-avatar-filename").text(filename)
|
||||
|
|
Loading…
Reference in New Issue