Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
e-epal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Σταύρος Παπαδάκης
e-epal
Commits
c160894c
Commit
c160894c
authored
Jan 16, 2017
by
Χάρης Παπαδόπουλος
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes to not call service if already called. Populate the saved selections into form array
parent
eec152a7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
12 deletions
+19
-12
source/actions/coursefields.actions.ts
source/actions/coursefields.actions.ts
+11
-8
source/components/student-application-form/course-fields-select.ts
...mponents/student-application-form/course-fields-select.ts
+8
-4
No files found.
source/actions/coursefields.actions.ts
View file @
c160894c
...
...
@@ -11,14 +11,17 @@ export class CourseFieldsActions {
private
_hds
:
HelperDataService
)
{}
getCourseFields
=
()
=>
{
return
this
.
_hds
.
getCourseFields
().
then
(
courseFields
=>
{
return
this
.
_ngRedux
.
dispatch
({
type
:
COURSEFIELDS_RECEIVED
,
payload
:
{
courseFields
}
});
});
const
{
courseFields
}
=
this
.
_ngRedux
.
getState
();
if
(
courseFields
.
size
===
0
)
{
return
this
.
_hds
.
getCourseFields
().
then
(
courseFields
=>
{
return
this
.
_ngRedux
.
dispatch
({
type
:
COURSEFIELDS_RECEIVED
,
payload
:
{
courseFields
}
});
});
}
};
saveCourseFieldsSelected
=
(
courseFieldsSelected
)
=>
{
...
...
source/components/student-application-form/course-fields-select.ts
View file @
c160894c
...
...
@@ -4,7 +4,7 @@ import { Observable } from 'rxjs/Rx';
import
{
Injectable
}
from
"
@angular/core
"
;
import
{
CourseFieldsActions
}
from
'
../../actions/coursefields.actions
'
;
import
{
DevToolsExtension
,
NgRedux
,
select
}
from
'
ng2-redux
'
;
import
{
ICourseFields
}
from
'
../../store/coursefields/coursefields.types
'
;
import
{
ICourseFields
,
ICourseField
}
from
'
../../store/coursefields/coursefields.types
'
;
import
{
IAppState
}
from
'
../../store/store
'
;
import
{
...
...
@@ -53,12 +53,14 @@ import {AppSettings} from '../../app.settings';
};
ngOnInit
()
{
this
.
_cfa
.
getCourseFields
();
this
.
courseFields$
=
this
.
_ngRedux
.
select
(
state
=>
{
for
(
let
courseField
in
state
.
courseFields
)
{
this
.
cfs
.
push
(
new
FormControl
(
''
,
[]));
}
state
.
courseFields
.
reduce
(({},
courseField
)
=>
{
this
.
cfs
.
push
(
new
FormControl
(
courseField
.
selected
,
[]));
return
courseField
;
},
{});
return
state
.
courseFields
;
});
...
...
@@ -67,4 +69,6 @@ import {AppSettings} from '../../app.settings';
saveSelected
()
{
this
.
_cfa
.
saveCourseFieldsSelected
(
this
.
formGroup
.
value
.
formArray
);
}
}
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