-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* LDBR-3.18: Добавить комментарии с плохой версткой. * LDBR-3.18: Интегрировать с бэкендом. * LDBR-3.18: Исправить комментарии. * LDBR-3.18: Переписать стиль у комментов * LDBR-3.18: Исправить undefined при добавлении комментария в новую карточку * LDBR-3.18: Починить редактирование комментария * LDBR-3.18: Предзапрос профиля для работы комментов * LDBR-3.18: Исправить замечания линтера * LDBR-3.18: Исправить авторство комментария при создании комментария. Co-authored-by: Georgiy <[email protected]>
- Loading branch information
Showing
9 changed files
with
661 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
'use strict'; | ||
|
||
// Modules | ||
import Dispatcher from '../modules/Dispatcher/Dispatcher.js'; | ||
|
||
/** | ||
* Константа, содержащая в себе типы действий для списка досок. | ||
*/ | ||
export const CommentsActionTypes = { | ||
CARD_ADD_COMMENT: 'card/comment/add', | ||
CARD_EDIT_COMMENT: 'card/comment/edit', | ||
CARD_UPDATE_COMMENT: 'card/comment/update', | ||
CARD_DELETE_COMMENT: 'card/comment/delete', | ||
}; | ||
|
||
/** | ||
* Класс, содержащий в себе действия в системе. | ||
*/ | ||
export const commentsActions = { | ||
/** | ||
* Создает комментарий | ||
* @param {String} text текст комментария | ||
*/ | ||
createComment(text) { | ||
Dispatcher.dispatch({ | ||
actionName: CommentsActionTypes.CARD_ADD_COMMENT, | ||
data: {text}, | ||
}); | ||
}, | ||
|
||
/** | ||
* Удалить комментарий (не спрашиваем, хотим ли) | ||
* @param {Number} cmid id комментария | ||
*/ | ||
deleteComment(cmid) { | ||
Dispatcher.dispatch({ | ||
actionName: CommentsActionTypes.CARD_DELETE_COMMENT, | ||
data: {cmid}, | ||
}); | ||
}, | ||
|
||
/** | ||
* Переключает комментарий в режим редактирования | ||
* @param {Number} cmid id комментария | ||
*/ | ||
editComment(cmid) { | ||
Dispatcher.dispatch({ | ||
actionName: CommentsActionTypes.CARD_EDIT_COMMENT, | ||
data: {cmid}, | ||
}); | ||
}, | ||
|
||
/** | ||
* Обновляет список карточек | ||
* @param {String} text текст комментария | ||
* @param {Number} cmid id комментария | ||
*/ | ||
updateComment(text, cmid) { | ||
Dispatcher.dispatch({ | ||
actionName: CommentsActionTypes.CARD_UPDATE_COMMENT, | ||
data: { | ||
text, | ||
cmid, | ||
}, | ||
}); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import UserStore from '../../stores/UserStore/UserStore.js'; | ||
|
||
/** | ||
* Handelbars helper, проверяет авторство комментария | ||
* @param {any} author - логин автора комментария | ||
* @return {boolean} - результат сравнения | ||
* @constructor | ||
*/ | ||
export default function IsAuthorHelper(author) { | ||
return author === UserStore.getContext('userName'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.