Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
retypos-server
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
2
Merge Requests
2
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-server
Commits
d7b5a4e4
Commit
d7b5a4e4
authored
May 21, 2018
by
Георгий Попов
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Задача 12794] Добавил возможность перейти к статье, содержащей ошибку
parent
e5852bad
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
6 deletions
+62
-6
Typo.php
cp/application/models/Typo.php
+14
-2
index.jsx
cp/javascript/src/components/Typo/index.jsx
+6
-3
style.css
cp/javascript/src/components/Typo/style.css
+11
-0
TypoList.jsx
cp/javascript/src/components/TypoList.jsx
+27
-1
stylesheet.css
cp/stylesheet/stylesheet.css
+4
-0
No files found.
cp/application/models/Typo.php
View file @
d7b5a4e4
...
...
@@ -186,12 +186,13 @@ class Typo extends CI_Model {
* сайта. Возвращает список.
*
* @param $siteId
* @return array Список опечаток
*/
function
getSiteTypos
(
$siteId
)
{
$this
->
db
->
select
(
"id, text as originalText, context, comment as correctedText, date, status as isCorrected"
);
$this
->
db
->
select
(
"id,
link,
text as originalText, context, comment as correctedText, date, status as isCorrected"
);
$this
->
db
->
from
(
"messages"
);
$this
->
db
->
where
(
"site_id"
,
$siteId
);
$this
->
db
->
where
(
"status"
,
0
);
return
$this
->
db
->
get
()
->
result
();
}
...
...
@@ -353,6 +354,16 @@ class Typo extends CI_Model {
curl_close
(
$curl
);
}
/**
* Устанавливает статус опечатки как исправлено,
* но при этом не вносит изменений в текст статьи.
*
* @param $typoId Идентификатор опечатки
*/
function
declineTypo
(
$typoId
)
{
}
}
/**/
\ No newline at end of file
cp/javascript/src/components/Typo/index.jsx
View file @
d7b5a4e4
...
...
@@ -10,7 +10,7 @@ export default class Typo extends Component {
};
render
()
{
const
{
typo
}
=
this
.
props
;
const
{
typo
,
acceptCallback
,
declineCallback
}
=
this
.
props
;
const
display
=
this
.
state
.
show
?
"d-block"
:
"d-none"
;
const
textColor
=
"text-white"
;
...
...
@@ -22,6 +22,9 @@ export default class Typo extends Component {
<
Card
className=
{
className
}
>
<
CardHeader
>
Опечатка #
{
typo
.
id
}
<
span
id=
"typo-id"
>
<
a
href=
{
typo
.
link
}
target=
"_blank"
>
Ссылка на текст
</
a
>
</
span
>
</
CardHeader
>
<
CardBody
>
...
...
@@ -30,8 +33,8 @@ export default class Typo extends Component {
<
div
className=
"card-buttons"
>
<
div
className=
"buttons-wrapper"
>
<
button
className=
"accept-button btn btn-warning"
>
Исправить
</
button
>
<
button
className=
"decline-button btn btn-danger"
>
Отклонить
</
button
>
<
button
className=
"accept-button btn btn-warning"
onClick=
{
acceptCallback
}
>
Исправить
</
button
>
<
button
className=
"decline-button btn btn-danger"
onClick=
{
declineCallback
}
>
Отклонить
</
button
>
</
div
>
</
div
>
</
CardBody
>
...
...
cp/javascript/src/components/Typo/style.css
View file @
d7b5a4e4
...
...
@@ -17,4 +17,14 @@
bottom
:
0
;
width
:
100%
;
margin-bottom
:
20px
;
}
.TypoCard
a
{
color
:
white
;
}
.TypoCard
#typo-id
{
position
:
absolute
;
right
:
10px
;
top
:
12px
;
}
\ No newline at end of file
cp/javascript/src/components/TypoList.jsx
View file @
d7b5a4e4
...
...
@@ -6,13 +6,39 @@ export default class TypoList extends Component {
currentTypo
:
0
};
/**
* Одобряет предложеное исправление опечатки
* и вносит соответствующее исправление в текст.
*
* @param typoId Идентификатор опечатки
*/
acceptCorrection
(
typoId
)
{
alert
(
"Accept"
);
this
.
state
.
currentTypo
++
;
this
.
forceUpdate
();
}
/**
* Отклоняет исправление опечатки.
* Опечатка не исправляется автоматически.
*
* @param typoId Идентификатор опечатки.
*/
declineCorrection
(
typoId
)
{
alert
(
"Decline"
);
this
.
state
.
currentTypo
++
;
this
.
forceUpdate
();
}
render
()
{
const
{
typos
}
=
this
.
props
;
const
typoCards
=
typos
.
map
((
typo
,
index
)
=>
<
Typo
key=
{
typo
.
id
}
typo=
{
typos
[
this
.
state
.
currentTypo
]
}
show=
{
this
.
state
.
currentTypo
===
index
}
/>
show=
{
this
.
state
.
currentTypo
===
index
}
acceptCallback=
{
this
.
acceptCorrection
.
bind
(
this
,
typo
.
id
)
}
declineCallback=
{
this
.
declineCorrection
.
bind
(
this
,
typo
.
id
)
}
/>
);
return
(
...
...
cp/stylesheet/stylesheet.css
View file @
d7b5a4e4
...
...
@@ -49,6 +49,10 @@ body {
margin-bottom
:
5px
!important
;
}
.header
.nav-item
{
border-bottom
:
none
!important
;
}
li
.nav-item
{
cursor
:
pointer
;
border-bottom
:
1px
solid
transparent
;
...
...
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