prevents for Comments.initialize to be called twice causing unexpected behaviour in forms, when initialize_modules is called on ajax:complete
This commit is contained in:
@@ -31,7 +31,5 @@ $(function(){
|
||||
|
||||
$(document).ready(initialize_modules);
|
||||
$(document).on('page:load', initialize_modules);
|
||||
$(document).on('ajax:complete', function(){
|
||||
App.Users.initialize();
|
||||
});
|
||||
$(document).on('ajax:complete', initialize_modules);
|
||||
});
|
||||
|
||||
@@ -17,7 +17,17 @@ App.Comments =
|
||||
$("#js-comment-form-#{id}").toggle()
|
||||
|
||||
initialize: ->
|
||||
$('body').on 'click', '.js-add-comment-link', ->
|
||||
id = $(this).data().id
|
||||
App.Comments.toggle_form(id)
|
||||
false
|
||||
# $('body').on 'click', '.js-add-comment-link', ->
|
||||
# id = $(this).data().id
|
||||
# App.Comments.toggle_form(id)
|
||||
# false
|
||||
#
|
||||
$('body .js-add-comment-link').each ->
|
||||
$this = $(this)
|
||||
|
||||
unless $this.data('initialized') is 'yes'
|
||||
$this.on('click', ->
|
||||
id = $(this).data().id
|
||||
App.Comments.toggle_form(id)
|
||||
false
|
||||
).data 'initialized', 'yes'
|
||||
|
||||
Reference in New Issue
Block a user