Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rex Dri
Rex Dri
Commits
b68243af
Commit
b68243af
authored
Mar 01, 2019
by
Florent Chehab
Browse files
Restored University Dri and fixes accross the board
parent
65260c06
Changes
6
Hide whitespace changes
Inline
Side-by-side
frontend/src/components/university/editors/UniversityDriEditor.js
View file @
b68243af
...
...
@@ -5,18 +5,19 @@ import compose from "recompose/compose";
import
{
connect
}
from
"
react-redux
"
;
import
Editor
from
"
../shared/Editor
"
;
import
Form
from
"
../shared/Form
"
;
import
editorStyle
from
"
../shared/editorStyle
"
;
import
getMapStateToPropsForEditor
from
"
../shared/editorFunctions/getMapStateToPropsForEditor
"
;
import
getMapDispatchToPropsForEditor
from
"
../shared/editorFunctions/getMapDispatchToPropsForEditor
"
;
import
{
withSnackbar
}
from
"
notistack
"
;
const
styles
=
theme
=>
({
...
editorStyle
(
theme
)
});
class
UniversityDriEditor
extends
Editor
{
renderEditor
()
{
class
UniversityDriForm
extends
Form
{
render
()
{
return
(
<
div
>
{
this
.
renderTitleField
()}
...
...
@@ -29,12 +30,24 @@ class UniversityDriEditor extends Editor {
}
}
class
UniversityDriEditor
extends
Editor
{
renderForm
()
{
return
<
UniversityDriForm
modelData
=
{
this
.
props
.
modelData
}
outsideData
=
{
this
.
props
.
outsideData
}
ref
=
{
this
.
formRef
}
/>
;
}
}
UniversityDriEditor
.
propTypes
=
{
modelData
:
PropTypes
.
object
.
isRequired
,
};
export
default
compose
(
withSnackbar
,
withStyles
(
styles
,
{
withTheme
:
true
}),
connect
(
getMapStateToPropsForEditor
(
"
universityDri
"
),
...
...
frontend/src/components/university/modules/UniversityDri.js
View file @
b68243af
...
...
@@ -50,13 +50,12 @@ function parseRawModelData(rawModelData) {
class
UniversityDri
extends
Module
{
customRender
()
{
const
univ
DriItems
=
this
.
getReadData
(
"
universityDri
"
);
const
{
universities
,
classes
}
=
this
.
props
;
const
{
univ
ersities
,
classes
}
=
this
.
props
,
outsideData
=
{
universities
}
;
const
outsideData
=
{
universities
};
const
univDriItems
=
this
.
getReadData
(
"
universityDri
"
);
return
(
<
GenericGroupModule
...
...
@@ -72,9 +71,9 @@ class UniversityDri extends Module {
}}
>
{
univDriItems
.
map
(
(
rawModelData
,
idx
)
=>
(
univDriItems
.
map
(
rawModelData
=>
(
<
GenericModule
key
=
{
idx
}
key
=
{
rawModelData
.
id
}
// use the id of the model to prevent useless unmount
buildTitle
=
{(
modelData
)
=>
modelData
.
title
}
rawModelData
=
{
rawModelData
}
parseRawModelData
=
{
parseRawModelData
}
...
...
frontend/src/components/university/shared/Form.js
View file @
b68243af
...
...
@@ -160,6 +160,7 @@ Object.assign(Form.prototype, renderFieldsMixIn);
Form
.
propTypes
=
{
modelData
:
PropTypes
.
object
.
isRequired
,
outsideData
:
PropTypes
.
object
,
};
export
default
Form
;
frontend/src/components/university/shared/GenericGroupModule.js
View file @
b68243af
...
...
@@ -56,7 +56,7 @@ class GenericGroupModule extends CustomComponentForAPI {
this
.
setState
({
editorOpen
:
true
});
}
handle
Close
Editor
=
(
somethingWasSaved
=
false
)
=>
{
handleEditor
WasClosed
=
(
somethingWasSaved
=
false
)
=>
{
this
.
setState
({
editorOpen
:
false
});
if
(
somethingWasSaved
)
{
this
.
props
.
invalidateGroup
();
...
...
@@ -64,16 +64,16 @@ class GenericGroupModule extends CustomComponentForAPI {
};
customRender
()
{
const
{
classes
,
groupTitle
}
=
this
.
props
;
const
{
endPoint
}
=
this
.
props
;
const
userCanPostTo
=
this
.
getReadData
(
"
userData
"
).
owner_can_post_to
;
const
disabled
=
userCanPostTo
.
indexOf
(
endPoint
)
<
0
;
const
{
classes
,
groupTitle
,
endPoint
}
=
this
.
props
,
userCanPostTo
=
this
.
getReadData
(
"
userData
"
).
owner_can_post_to
,
disabled
=
userCanPostTo
.
indexOf
(
endPoint
)
<
0
;
return
(
<
Paper
className
=
{
classes
.
root
}
>
<
this
.
props
.
editor
{...
this
.
props
.
propsForEditor
}
open
=
{
this
.
state
.
editorOpen
}
handle
Close
Editor
=
{
this
.
handle
Close
Editor
}
handleEditor
WasClosed
=
{
this
.
handleEditor
WasClosed
}
userData
=
{
this
.
props
.
userData
}
/
>
<
Grid
container
spacing
=
{
8
}
alignItems
=
'
center
'
>
...
...
frontend/src/components/university/shared/GenericModule.js
View file @
b68243af
...
...
@@ -68,7 +68,7 @@ class GenericModule extends CustomComponentForAPI {
handleEditorWasClosed
=
(
somethingWasSaved
=
false
)
=>
{
this
.
setState
({
editorOpen
:
false
,
dataToSave
:
null
});
if
(
somethingWasSaved
&&
this
.
props
.
moduleInGroupInfos
.
isInGroup
)
{
//
this.props.moduleInGroupInfos.invalidateGroup();
this
.
props
.
moduleInGroupInfos
.
invalidateGroup
();
}
};
...
...
frontend/src/components/university/shared/Module.js
View file @
b68243af
...
...
@@ -7,8 +7,6 @@ import CustomComponentForAPI from "../../CustomComponentForAPI";
* @extends React.Component
*/
class
Module
extends
CustomComponentForAPI
{
// prevent hard reset of module when refetching
// ignoreInvalidation = true;
componentWillUnmount
()
{
this
.
props
.
invalidateData
(
true
);
...
...
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