Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kszkepzes-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Köpeczi-Bócz Gergely
kszkepzes-frontend
Commits
110768c3
Commit
110768c3
authored
6 years ago
by
Bereczki Sandor
Browse files
Options
Downloads
Patches
Plain Diff
Proper state updates for correction modals, key fixes
parent
dbf9f685
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/forms/SolutionDetailsForm.js
+9
-6
9 additions, 6 deletions
src/components/forms/SolutionDetailsForm.js
src/components/pages/Homework.js
+0
-3
0 additions, 3 deletions
src/components/pages/Homework.js
src/reducers/HomeworksReducer.js
+6
-0
6 additions, 0 deletions
src/reducers/HomeworksReducer.js
with
15 additions
and
9 deletions
src/components/forms/SolutionDetailsForm.js
+
9
−
6
View file @
110768c3
...
@@ -6,6 +6,7 @@ import { emptyMessage } from '../pages/Homework';
...
@@ -6,6 +6,7 @@ import { emptyMessage } from '../pages/Homework';
import
'
./Forms.css
'
;
import
'
./Forms.css
'
;
import
{
import
{
getSolutions
,
getSolutions
,
getDocuments
,
}
from
'
../../actions/homework
'
;
}
from
'
../../actions/homework
'
;
class
SolutionDetailsForm
extends
Component
{
class
SolutionDetailsForm
extends
Component
{
...
@@ -25,7 +26,7 @@ class SolutionDetailsForm extends Component {
...
@@ -25,7 +26,7 @@ class SolutionDetailsForm extends Component {
const
noAcceptStudents
=
[];
const
noAcceptStudents
=
[];
const
acceptedStudents
=
[];
const
acceptedStudents
=
[];
this
.
props
.
homeworks
.
profiles
.
forEach
(
profile
=>
{
this
.
props
.
homeworks
.
profiles
.
forEach
(
(
profile
)
=>
{
const
profileSolutions
=
taskSolutions
.
filter
(
solution
=>
const
profileSolutions
=
taskSolutions
.
filter
(
solution
=>
solution
.
created_by
===
profile
.
id
);
solution
.
created_by
===
profile
.
id
);
...
@@ -53,6 +54,7 @@ class SolutionDetailsForm extends Component {
...
@@ -53,6 +54,7 @@ class SolutionDetailsForm extends Component {
onClick
=
{()
=>
{
onClick
=
{()
=>
{
this
.
setState
({
showModal
:
true
});
this
.
setState
({
showModal
:
true
});
this
.
props
.
getSolutions
();
this
.
props
.
getSolutions
();
this
.
props
.
getDocuments
();
}}
}}
>
>
<
Icon
name
=
'
external
'
/>
<
Icon
name
=
'
external
'
/>
...
@@ -65,13 +67,13 @@ class SolutionDetailsForm extends Component {
...
@@ -65,13 +67,13 @@ class SolutionDetailsForm extends Component {
<
/Modal.Header
>
<
/Modal.Header
>
<
Modal
.
Content
>
<
Modal
.
Content
>
<
Header
as
=
'
h3
'
>
A
feladat
leírása
:
<
/Header
>
<
Header
as
=
'
h3
'
>
A
feladat
leírása
:
<
/Header
>
{
this
.
props
.
taskdesc
.
split
(
'
\n
'
).
map
(
s
=>
(
<
p
>
{
s
}
<
/p>
))
}
{
this
.
props
.
taskdesc
.
split
(
'
\n
'
).
map
(
s
=>
(
<
p
key
=
{
Math
.
random
()}
>
{
s
}
<
/p>
))
}
<
Divider
/>
<
Divider
/>
<
Header
as
=
'
h3
'
>
Nem
érkezett
még
megoldás
:
<
/Header
>
<
Header
as
=
'
h3
'
>
Nem
érkezett
még
megoldás
:
<
/Header
>
{
noSubmitStudents
.
length
===
0
?
{
noSubmitStudents
.
length
===
0
?
emptyMessage
(
emptyStudentText
)
:
emptyMessage
(
emptyStudentText
)
:
noSubmitStudents
.
map
(
student
=>
(
noSubmitStudents
.
map
(
student
=>
(
<
Button
color
=
'
blue
'
style
=
{{
marginRight
:
'
1.5em
'
,
marginTop
:
'
1.5em
'
}}
>
{
student
.
full_name
}
<
/Button
>
<
Button
key
=
{
Math
.
random
()}
color
=
'
blue
'
style
=
{{
marginRight
:
'
1.5em
'
,
marginTop
:
'
1.5em
'
}}
>
{
student
.
full_name
}
<
/Button
>
))
))
}
}
<
Divider
/>
<
Divider
/>
...
@@ -80,6 +82,7 @@ class SolutionDetailsForm extends Component {
...
@@ -80,6 +82,7 @@ class SolutionDetailsForm extends Component {
emptyMessage
(
emptyStudentText
)
:
emptyMessage
(
emptyStudentText
)
:
waitForCorrectionStudents
.
map
(
student
=>
(
waitForCorrectionStudents
.
map
(
student
=>
(
<
CorrectSolutionForm
<
CorrectSolutionForm
key
=
{
Math
.
random
()}
studentName
=
{
student
.
nick
}
studentName
=
{
student
.
nick
}
studentFullName
=
{
student
.
full_name
}
studentFullName
=
{
student
.
full_name
}
studentId
=
{
student
.
id
}
studentId
=
{
student
.
id
}
...
@@ -93,7 +96,7 @@ class SolutionDetailsForm extends Component {
...
@@ -93,7 +96,7 @@ class SolutionDetailsForm extends Component {
{
noAcceptStudents
.
length
===
0
?
{
noAcceptStudents
.
length
===
0
?
emptyMessage
(
emptyStudentText
)
:
emptyMessage
(
emptyStudentText
)
:
noAcceptStudents
.
map
(
student
=>
(
noAcceptStudents
.
map
(
student
=>
(
<
Button
color
=
'
red
'
style
=
{{
marginRight
:
'
1.5em
'
,
marginTop
:
'
1.5em
'
}}
>
{
student
.
full_name
}
<
/Button
>
<
Button
key
=
{
Math
.
random
()}
color
=
'
red
'
style
=
{{
marginRight
:
'
1.5em
'
,
marginTop
:
'
1.5em
'
}}
>
{
student
.
full_name
}
<
/Button
>
))
))
}
}
<
Divider
/>
<
Divider
/>
...
@@ -101,7 +104,7 @@ class SolutionDetailsForm extends Component {
...
@@ -101,7 +104,7 @@ class SolutionDetailsForm extends Component {
{
acceptedStudents
.
length
===
0
?
{
acceptedStudents
.
length
===
0
?
emptyMessage
(
emptyStudentText
)
:
emptyMessage
(
emptyStudentText
)
:
acceptedStudents
.
map
(
student
=>
(
acceptedStudents
.
map
(
student
=>
(
<
Button
color
=
'
green
'
style
=
{{
marginRight
:
'
1.5em
'
,
marginTop
:
'
1.5em
'
}}
>
{
student
.
full_name
}
<
/Button
>
<
Button
key
=
{
Math
.
random
()}
color
=
'
green
'
style
=
{{
marginRight
:
'
1.5em
'
,
marginTop
:
'
1.5em
'
}}
>
{
student
.
full_name
}
<
/Button
>
))
))
}
}
<
/Modal.Content
>
<
/Modal.Content
>
...
@@ -124,5 +127,5 @@ class SolutionDetailsForm extends Component {
...
@@ -124,5 +127,5 @@ class SolutionDetailsForm extends Component {
const
mapStateToProps
=
({
homeworks
,
user
})
=>
({
homeworks
,
user
});
const
mapStateToProps
=
({
homeworks
,
user
})
=>
({
homeworks
,
user
});
export
default
connect
(
mapStateToProps
,
{
export
default
connect
(
mapStateToProps
,
{
getSolutions
,
getSolutions
,
getDocuments
,
})(
SolutionDetailsForm
);
})(
SolutionDetailsForm
);
This diff is collapsed.
Click to expand it.
src/components/pages/Homework.js
+
0
−
3
View file @
110768c3
...
@@ -18,7 +18,6 @@ import {
...
@@ -18,7 +18,6 @@ import {
deleteTask
,
deleteTask
,
addDocument
,
addDocument
,
getProfiles
,
getProfiles
,
getDocuments
,
}
from
'
../../actions/homework
'
;
}
from
'
../../actions/homework
'
;
import
AddTaskForm
from
'
../forms/AddTaskForm
'
;
import
AddTaskForm
from
'
../forms/AddTaskForm
'
;
import
AddSolutionForm
from
'
../forms/AddSolutionForm
'
;
import
AddSolutionForm
from
'
../forms/AddSolutionForm
'
;
...
@@ -70,7 +69,6 @@ class Homework extends Component {
...
@@ -70,7 +69,6 @@ class Homework extends Component {
this
.
props
.
getTasks
();
this
.
props
.
getTasks
();
this
.
props
.
getProfiles
();
this
.
props
.
getProfiles
();
this
.
props
.
getSolutions
(
this
.
props
.
user
.
id
);
this
.
props
.
getSolutions
(
this
.
props
.
user
.
id
);
this
.
props
.
getDocuments
();
}
}
getTaskDisplayStyle
(
task
)
{
getTaskDisplayStyle
(
task
)
{
...
@@ -337,6 +335,5 @@ export default connect(
...
@@ -337,6 +335,5 @@ export default connect(
deleteTask
,
deleteTask
,
addDocument
,
addDocument
,
getProfiles
,
getProfiles
,
getDocuments
,
},
},
)(
Homework
);
)(
Homework
);
This diff is collapsed.
Click to expand it.
src/reducers/HomeworksReducer.js
+
6
−
0
View file @
110768c3
import
{
GET_TASKS
,
import
{
GET_TASKS
,
GET_SOLUTIONS
,
GET_SOLUTIONS
,
CORRECT_SOLUTION
,
ADD_TASK
,
ADD_TASK
,
DELETE_TASK
,
DELETE_TASK
,
EDIT_TASK
,
EDIT_TASK
,
...
@@ -22,6 +23,11 @@ export default (state = INITIAL_STATE, action) => {
...
@@ -22,6 +23,11 @@ export default (state = INITIAL_STATE, action) => {
return
{
...
state
,
tasks
:
action
.
payload
};
return
{
...
state
,
tasks
:
action
.
payload
};
case
GET_SOLUTIONS
:
case
GET_SOLUTIONS
:
return
{
...
state
,
solutions
:
action
.
payload
};
return
{
...
state
,
solutions
:
action
.
payload
};
case
CORRECT_SOLUTION
:
const
modifiedSolution
=
state
.
solutions
.
find
(
sol
=>
sol
.
id
===
action
.
payload
.
id
);
const
modifiedSolutions
=
state
.
solutions
.
slice
();
modifiedSolutions
.
splice
(
state
.
solutions
.
indexOf
(
modifiedSolution
),
1
,
action
.
payload
);
return
{
...
state
,
solutions
:
[...
modifiedSolutions
]
};
case
ADD_SOLUTION
:
case
ADD_SOLUTION
:
return
{
...
state
,
solutions
:
[
action
.
payload
,
...
state
.
solutions
],
id
:
action
.
payload
.
id
};
return
{
...
state
,
solutions
:
[
action
.
payload
,
...
state
.
solutions
],
id
:
action
.
payload
.
id
};
case
ADD_TASK
:
case
ADD_TASK
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment