1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-26 03:30:48 +03:00

Исправлено редактирование комментариев

* Исправлено редактирование комментариев сразу после добавления
This commit is contained in:
Denis Shakhov 2015-04-13 20:49:32 +07:00
parent 2e56a973db
commit 3b87384f84

View file

@ -246,6 +246,14 @@
}
},
/**
* Сбрасывает текущий комментарий
*/
resetCommentCurrent: function() {
if ( this._currentComment.length ) this._currentComment.lsComment( 'notCurrent' );
this._currentComment = $();
},
/**
* Получает текущий комментарий
*
@ -263,7 +271,10 @@
setCommentCurrent: function( comment ) {
if ( this.getCommentCurrent().is( comment ) ) return;
this.getCommentCurrent().lsComment( 'notCurrent' );
if ( this.getCommentCurrent().length ) {
this.getCommentCurrent().lsComment( 'notCurrent' );
}
comment.lsComment( 'markAsCurrent' );
this._currentComment = comment;
},
@ -326,12 +337,19 @@
/**
* Удаляет комментарий по его ID
*
* @param {Number} commentId ID комментария
* @param {Number} commentId ID комментария
*/
removeCommentById: function( commentId ) {
var _this = this;
this.elements.comment = this.getComments().filter(function () {
if ( $( this ).lsComment( 'getId' ) == commentId ) {
$( this ).lsComment( 'destroy' );
var comment = $( this );
if ( comment.lsComment( 'getId' ) == commentId ) {
if ( comment.lsComment( 'isCurrent' ) ) _this.resetCommentCurrent();
comment.lsComment( 'destroy' );
return false;
}