make a comments module. Move module initializing to application.js
This commit is contained in:
@@ -18,4 +18,13 @@
|
|||||||
//= require app
|
//= require app
|
||||||
//= require_tree .
|
//= require_tree .
|
||||||
|
|
||||||
$(function(){ $(document).foundation(); });
|
var initialize_modules = function() {
|
||||||
|
App.Comments.initialize();
|
||||||
|
};
|
||||||
|
|
||||||
|
$(function(){
|
||||||
|
$(document).foundation();
|
||||||
|
|
||||||
|
$(document).ready(initialize_modules)
|
||||||
|
$(document).on('page:load', initialize_modules)
|
||||||
|
});
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
jQuery ->
|
|
||||||
|
|
||||||
toggle_comment = (id) ->
|
App.Comments =
|
||||||
|
|
||||||
|
toggle_form: (id) ->
|
||||||
$("#js-comment-form-#{id}").toggle()
|
$("#js-comment-form-#{id}").toggle()
|
||||||
|
|
||||||
ready = ->
|
initialize: ->
|
||||||
$('body').on 'click', '.js-add-comment-link', ->
|
$('body').on 'click', '.js-add-comment-link', ->
|
||||||
id = $(this).data().id
|
id = $(this).data().id
|
||||||
toggle_comment(id)
|
App.Comments.toggle_form(id)
|
||||||
false
|
false
|
||||||
|
|
||||||
$(document).ready(ready)
|
|
||||||
$(document).on('page:load', ready)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user