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
DLCM
UI
DLCM-Portal
Commits
7b941ce4
Commit
7b941ce4
authored
Sep 09, 2020
by
Nicolas.Rod
Browse files
refacto(ResearchDomainLabel): rename into ResearchDomainTranslation
parent
1aa20cb8
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/app/features/admin/research-domain/components/presentationals/admin-research-domain-form/admin-research-domain-form.presentational.ts
View file @
7b941ce4
...
...
@@ -15,7 +15,7 @@ import {
}
from
"
@models
"
;
import
{
SharedAbstractFormPresentational
}
from
"
@shared/components/presentationals/shared-abstract-form/shared-abstract-form.presentational
"
;
import
{
BaseFormDefinition
}
from
"
@shared/models/base-form-definition.model
"
;
import
{
ResearchDomain
Label
}
from
"
@shared/models/business/research-domain-
label
.model
"
;
import
{
ResearchDomain
Translation
}
from
"
@shared/models/business/research-domain-
translation
.model
"
;
import
{
isNullOrUndefined
,
PropertyName
,
...
...
@@ -38,11 +38,11 @@ export class AdminResearchDomainFormPresentational extends SharedAbstractFormPre
return
;
}
this
.
languages
.
forEach
(
language
=>
{
if
(
isNullOrUndefined
(
this
.
model
)
||
isNullOrUndefined
(
this
.
model
.
label
s
))
{
if
(
isNullOrUndefined
(
this
.
model
)
||
isNullOrUndefined
(
this
.
model
.
translation
s
))
{
this
.
addControl
(
language
.
resId
);
return
;
}
const
existingValue
=
(
this
.
model
.
label
s
as
ResearchDomain
Label
[]).
find
(
label
=>
label
.
language
.
resId
===
language
.
resId
);
const
existingValue
=
(
this
.
model
.
translation
s
as
ResearchDomain
Translation
[]).
find
(
label
=>
label
.
language
.
resId
===
language
.
resId
);
if
(
isNullOrUndefined
(
existingValue
))
{
this
.
addControl
(
language
.
resId
);
return
;
...
...
@@ -84,9 +84,9 @@ export class AdminResearchDomainFormPresentational extends SharedAbstractFormPre
}
protected
treatmentBeforeSubmit
(
researchDomains
:
ResearchDomain
):
ResearchDomain
{
const
new
Label
s
:
ResearchDomain
Label
[]
=
[];
const
new
Translation
s
:
ResearchDomain
Translation
[]
=
[];
this
.
languages
.
forEach
(
language
=>
{
new
Label
s
.
push
({
new
Translation
s
.
push
({
description
:
researchDomains
[
language
.
resId
],
language
:
language
,
});
...
...
@@ -95,7 +95,7 @@ export class AdminResearchDomainFormPresentational extends SharedAbstractFormPre
code
:
researchDomains
.
code
,
name
:
researchDomains
.
name
,
source
:
researchDomains
.
source
,
labels
:
newLabel
s
,
translations
:
newTranslation
s
,
};
}
}
...
...
src/app/models/index.ts
View file @
7b941ce4
...
...
@@ -253,7 +253,7 @@ export interface PreservationJobScheduling extends PreservationJobSchedulingPart
}
export
interface
ResearchDomain
extends
ResearchDomainPartial
,
BaseResource
{
label
s
?:
any
[];
translation
s
?:
any
[];
}
export
interface
Role
extends
RolePartial
,
BaseResource
{
...
...
src/app/shared/components/presentationals/shared-admin-research-domain-label/shared-admin-research-domain-label.presentational.ts
View file @
7b941ce4
...
...
@@ -6,7 +6,7 @@ import {
import
{
FormBuilder
}
from
"
@angular/forms
"
;
import
{
ResearchDomain
}
from
"
@models
"
;
import
{
SharedAbstractPresentational
}
from
"
@shared/components/presentationals/shared-abstract/shared-abstract.presentational
"
;
import
{
ResearchDomain
Label
}
from
"
@shared/models/business/research-domain-
label
.model
"
;
import
{
ResearchDomain
Translation
}
from
"
@shared/models/business/research-domain-
translation
.model
"
;
import
{
isNullOrUndefined
}
from
"
solidify-frontend
"
;
@
Component
({
...
...
@@ -41,13 +41,13 @@ export class SharedAdminResearchDomainLabelPresentational extends SharedAbstract
return
this
.
_language
;
}
value
:
ResearchDomain
Label
|
undefined
;
value
:
ResearchDomain
Translation
|
undefined
;
private
computeLabel
():
void
{
if
(
isNullOrUndefined
(
this
.
language
)
||
isNullOrUndefined
(
this
.
researchDomain
))
{
return
;
}
this
.
value
=
this
.
researchDomain
.
labels
.
find
(
label
=>
label
.
language
.
resId
===
this
.
language
);
this
.
value
=
this
.
researchDomain
.
translations
.
find
(
translation
=>
translation
.
language
.
resId
===
this
.
language
);
return
;
}
...
...
src/app/shared/models/business/research-domain-
label
.model.ts
→
src/app/shared/models/business/research-domain-
translation
.model.ts
View file @
7b941ce4
import
{
Language
}
from
"
@models
"
;
export
interface
ResearchDomain
Label
{
export
interface
ResearchDomain
Translation
{
description
:
string
;
language
:
Language
;
}
src/test-helpers/mock-translate.service.ts
View file @
7b941ce4
...
...
@@ -21,8 +21,8 @@ export class MockTranslateService {
constructor
()
{
}
get
(
label
s
:
string
[]):
Observable
<
String
[]
>
{
return
of
(
label
s
);
get
(
translation
s
:
string
[]):
Observable
<
String
[]
>
{
return
of
(
translation
s
);
}
getTranslation
(
labels
:
string
[]):
Observable
<
any
>
{
...
...
Write
Preview
Supports
Markdown
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