Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
retypos-webclient
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eterfund
retypos-webclient
Commits
d5e9eb40
Commit
d5e9eb40
authored
Jun 29, 2018
by
Георгий Попов
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve modal dialog. Add comment field to it
parent
35b99b73
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
17 deletions
+50
-17
Localization.js
src/Localization.js
+11
-9
index.js
src/Modal/index.js
+39
-8
No files found.
src/Localization.js
View file @
d5e9eb40
...
...
@@ -2,15 +2,17 @@ import LocalizedStrings from 'react-localization'
export
const
i18n
=
new
LocalizedStrings
({
ru
:
{
modalTitle
:
"Система исправления опечаток Etersoft"
,
modalInfo
:
"Пожалуйста, введите исправленный вариант и комментарий (необязательно) "
+
"для отправки отчёта об опечатке на сервер"
,
modalCorrectLabel
:
"Исправленный вариант"
,
modalCorrectHelp
:
"Модераторы проверят исправления и внесут поправки в текст"
,
modalTypoLabel
:
"Текст с ошибкой"
,
errorSelectionLength
:
"Опечатка должна быть длиной от {0} до {1} символов"
,
close
:
"Закрыть"
,
saveChanges
:
"Сохранить изменения"
modalTitle
:
"Система исправления опечаток Etersoft"
,
modalInfo
:
"Пожалуйста, введите исправленный вариант и комментарий (необязательно) "
+
"для отправки отчёта об опечатке на сервер"
,
modalCorrectLabel
:
"Исправленный вариант"
,
modalCorrectHelp
:
"Модераторы проверят исправления и внесут поправки в текст"
,
modalTypoLabel
:
"Текст с ошибкой"
,
modalCommentPlaceholder
:
`Например, "опечатка"`
,
modalCommentLabel
:
"Пояснения к исправлению"
,
errorSelectionLength
:
"Опечатка должна быть длиной от {0} до {1} символов"
,
close
:
"Закрыть"
,
saveChanges
:
"Сохранить изменения"
},
en
:
{
...
...
src/Modal/index.js
View file @
d5e9eb40
...
...
@@ -10,10 +10,12 @@ class TypoModal extends Component {
super
(
props
,
context
);
this
.
state
=
{
show
:
this
.
props
.
show
show
:
this
.
props
.
show
,
text
:
this
.
props
.
text
,
correct
:
this
.
props
.
text
,
comment
:
""
}
this
.
text
=
props
.
text
;
this
.
closeCallback
=
props
.
closeCallback
;
}
...
...
@@ -22,10 +24,31 @@ class TypoModal extends Component {
}
handleClose
=
()
=>
{
this
.
setState
({
show
:
false
})
this
.
setState
({
show
:
false
,
text
:
this
.
props
.
text
,
comment
:
""
});
this
.
closeCallback
();
}
// Comment data binding
onChangeComment
=
(
event
)
=>
{
this
.
setState
({
comment
:
event
.
target
.
value
});
}
// Correct data binding
onChangeCorrect
=
(
event
)
=>
{
this
.
setState
({
correct
:
event
.
target
.
value
});
}
// Send typo to the typos server
submitTypo
=
(
corrected
,
comment
)
=>
{
alert
(
`Submit typo
${
this
.
state
.
text
}
->
${
this
.
state
.
correct
}
(
${
this
.
state
.
comment
}
)`
);
this
.
handleClose
();
}
render
()
{
if
(
!
this
.
state
.
show
)
return
null
;
...
...
@@ -37,25 +60,33 @@ class TypoModal extends Component {
<
Modal
.
Body
>
<
p
>
{
i18n
.
modalInfo
}
<
/p
>
<
form
>
<
form
onSubmit
=
{
this
.
submitTypo
}
>
<
FormGroup
className
=
"es-typo-text-fg"
>
<
ControlLabel
>
{
i18n
.
modalTypoLabel
}
<
/ControlLabel
>
<
p
className
=
"es-typo-text"
>
{
this
.
text
}
<
/p
>
<
p
className
=
"es-typo-text"
>
{
this
.
state
.
text
}
<
/p
>
<
/FormGroup
>
<
FormGroup
className
=
"es-typo-correct-fg"
>
<
ControlLabel
>
{
i18n
.
modalCorrectLabel
}
<
/ControlLabel
>
<
FormControl
type
=
"text"
value
=
{
this
.
text
}
/>
defaultValue
=
{
this
.
state
.
correct
}
onChange
=
{
this
.
onChangeCorrect
}
required
/>
<
HelpBlock
>
{
i18n
.
modalCorrectHelp
}
<
/HelpBlock
>
<
ControlLabel
>
{
i18n
.
modalCommentLabel
}
<
/ControlLabel
>
<
FormControl
type
=
"text"
placeholder
=
{
i18n
.
modalCommentPlaceholder
}
onChange
=
{
this
.
onChangeComment
}
/>
<
/FormGroup
>
<
/form
>
<
/Modal.Body
>
<
Modal
.
Footer
>
<
Button
>
{
i18n
.
close
}
<
/Button
>
<
Button
bsStyle
=
"primary"
>
{
i18n
.
saveChanges
}
<
/Button
>
<
Button
onClick
=
{
this
.
handleClose
}
>
{
i18n
.
close
}
<
/Button
>
<
Button
onClick
=
{
this
.
submitTypo
}
bsStyle
=
"primary"
>
{
i18n
.
saveChanges
}
<
/Button
>
<
/Modal.Footer
>
<
/Modal
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment