File tree Expand file tree Collapse file tree
client/javascripts/components/modules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ JS.Modules.EditComment = (function() {
5151 // ----- Delete Button ----- //
5252
5353 _settings . $deleteBtn . on ( 'click' , function ( event ) {
54- _deleteComment ( ) ;
54+ _deleteComment ( $ ( this ) . closest ( _settings . $element ) ) ;
5555 } ) ;
5656
5757 // ----- Save Button ----- //
@@ -66,8 +66,15 @@ JS.Modules.EditComment = (function() {
6666 // Delete Comment
6767 // -------------------------------------
6868
69- var _deleteComment = function ( parameters ) {
70- console . log ( '_deleteComment()' ) ;
69+ var _deleteComment = function ( $element ) {
70+ var id = $element . data ( 'id' ) ,
71+ body = $element . find ( _settings . $textarea ) . val ( ) ;
72+
73+ $ . ajax ( {
74+ beforeSend : function ( xhr ) { xhr . setRequestHeader ( 'csrf-token' , _settings . token ) ; } ,
75+ url : '/news/' + _settings . storySlug + '/comment/' + id ,
76+ type : 'delete'
77+ } ) ;
7178
7279 // Ajax to delete
7380 } ;
You can’t perform that action at this time.
0 commit comments