[Задача 12794] Добавил вывод сообщений пользователю с помощью библиотеки alertify.js.

parent 7d669ad3
...@@ -35,7 +35,7 @@ export default class Typo extends Component { ...@@ -35,7 +35,7 @@ export default class Typo extends Component {
<CardBody> <CardBody>
<CardTitle><del>{typo.originalText}</del> -> {typo.correctedText}</CardTitle> <CardTitle><del>{typo.originalText}</del> -> {typo.correctedText}</CardTitle>
<CardText><div>{typo.context}</div></CardText> <CardText>{typo.context}</CardText>
<div className="card-buttons"> <div className="card-buttons">
<div className="buttons-wrapper"> <div className="buttons-wrapper">
......
import React, {Component} from 'react'; import React, {Component} from 'react';
import Typo from "./Typo/index"; import Typo from "./Typo/index";
const alertify = require("alertify.js");
export default class TypoList extends Component { export default class TypoList extends Component {
state = { state = {
currentTypo: 0, currentTypo: 0,
...@@ -15,6 +17,8 @@ export default class TypoList extends Component { ...@@ -15,6 +17,8 @@ export default class TypoList extends Component {
*/ */
acceptCorrection(typoId) { acceptCorrection(typoId) {
this._setTypoStatus(1, typoId, this.state.siteId, () => { this._setTypoStatus(1, typoId, this.state.siteId, () => {
alertify.success(`<p>Опечатка ${typoId} была подтверждена.</p>
<p>Исправления применены к тексту, содержащему опечатку.</p>`);
this.state.currentTypo++; this.state.currentTypo++;
this.forceUpdate(); this.forceUpdate();
}); });
...@@ -28,6 +32,7 @@ export default class TypoList extends Component { ...@@ -28,6 +32,7 @@ export default class TypoList extends Component {
*/ */
declineCorrection(typoId) { declineCorrection(typoId) {
this._setTypoStatus(0, typoId, this.state.siteId, () => { this._setTypoStatus(0, typoId, this.state.siteId, () => {
alertify.success(`Опечатка ${typoId} была отклонена`);
this.state.currentTypo++; this.state.currentTypo++;
this.forceUpdate(); this.forceUpdate();
}); });
...@@ -48,10 +53,9 @@ export default class TypoList extends Component { ...@@ -48,10 +53,9 @@ export default class TypoList extends Component {
$.ajax({ $.ajax({
url: `${window.baseUrl}users/typos/setTypoStatus/${typoId}/${siteId}/${status}`, url: `${window.baseUrl}users/typos/setTypoStatus/${typoId}/${siteId}/${status}`,
}).done(() => { }).done(() => {
alert("Status changed");
then(); then();
}).fail((error) => { }).fail((error) => {
alert("Status change error"); alertify.fail("Ошибка исправления опечатки, попробуйте позже");
console.error(error.message); console.error(error.message);
}); });
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
"version": "0.0.1", "version": "0.0.1",
"private": true, "private": true,
"dependencies": { "dependencies": {
"alertify.js": "^1.0.12",
"bootstrap": "^4.0.0", "bootstrap": "^4.0.0",
"free-jqgrid": "^4.15.3", "free-jqgrid": "^4.15.3",
"jquery": "^3.3.1", "jquery": "^3.3.1",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment