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).ready(initialize_modules);
|
||||||
$(document).on('page:load', initialize_modules);
|
$(document).on('page:load', initialize_modules);
|
||||||
$(document).on('ajax:complete', function(){
|
$(document).on('ajax:complete', initialize_modules);
|
||||||
App.Users.initialize();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,7 +17,17 @@ App.Comments =
|
|||||||
$("#js-comment-form-#{id}").toggle()
|
$("#js-comment-form-#{id}").toggle()
|
||||||
|
|
||||||
initialize: ->
|
initialize: ->
|
||||||
$('body').on 'click', '.js-add-comment-link', ->
|
# $('body').on 'click', '.js-add-comment-link', ->
|
||||||
id = $(this).data().id
|
# id = $(this).data().id
|
||||||
App.Comments.toggle_form(id)
|
# App.Comments.toggle_form(id)
|
||||||
false
|
# 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